

• La AWS Systems Manager CloudWatch dashboard non sarà più disponibile dopo il 30 aprile 2026. I clienti possono continuare a utilizzare la CloudWatch console Amazon per visualizzare, creare e gestire le proprie CloudWatch dashboard Amazon, proprio come fanno oggi. Per ulteriori informazioni, consulta la [documentazione di Amazon CloudWatch Dashboard](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html). 

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Creazione manuale di OpsItems (AWS CLI)
<a name="OpsCenter-creating-OpsItems-CLI"></a>

Nella procedura riportata di seguito viene descritto come creare un OpsItem tramite AWS Command Line Interface (AWS CLI).

**Per creare un file OpsItem utilizzando il AWS CLI**

1. Installa e configura AWS Command Line Interface (AWS CLI), se non l'hai già fatto.

   Per informazioni, consulta la pagina [Installazione o aggiornamento della versione più recente di AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).

1. Apri AWS CLI ed esegui il seguente comando per creare unOpsItem. Sostituisci ogni {{example resource placeholder}} con le tue informazioni.

   ```
   aws ssm create-ops-item \
       --title "{{Descriptive_title}}" \
       --description "{{Information_about_the_issue}}" \
       --priority {{Number_between_1_and_5}} \
       --source {{Source_of_the_issue}} \
       --operational-data {{Up_to_20_KB_of_data_or_path_to_JSON_file}} \
       --notifications Arn="{{SNS_ARN_in_same_Region}}" \
       --tags "Key={{key_name}},Value={{a_value}}"
   ```

   **Specificare i dati operativi da un file**

   Quando crei un OpsItem, è possibile specificare i dati operativi da un file. Il file deve essere un file JSON e i contenuti del file devono avere il formato seguente.

   ```
   {
     "{{key_name}}": {
       "Type": "SearchableString",
       "Value": "{{Up to 20 KB of data}}"
     }
   }
   ```

   Ecco un esempio.

   ```
   aws ssm create-ops-item ^
       --title "EC2 instance disk full" ^
       --description "Log clean up may have failed which caused the disk to be full" ^
       --priority 2 ^
       --source ec2 ^
       --operational-data file:///Users/TestUser1/Desktop/OpsItems/opsData.json ^
       --notifications Arn="arn:aws:sns:us-west-1:12345678:TestUser1" ^
       --tags "Key=EC2,Value=Production"
   ```
**Nota**  
Per informazioni su come inserire JSON-formatted i parametri nella riga di comando su diversi sistemi operativi locali, vedere [Uso delle virgolette con le stringhe AWS CLI nella Guida dell'AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html)*utente*.

   Il sistema restituisce informazioni simili alle seguenti.

   ```
   {
       "OpsItemId": "oi-1a2b3c4d5e6f"
   }
   ```

1. Esegui questo comando per visualizzare i dettagli sull'OpsItem che hai creato.

   ```
   aws ssm get-ops-item --ops-item-id {{ID}}
   ```

   Il sistema restituisce informazioni simili alle seguenti.

   ```
   {
       "OpsItem": {
           "CreatedBy": "arn:aws:iam::12345678:user/TestUser",
           "CreatedTime": 1558386334.995,
           "Description": "Log clean up may have failed which caused the disk to be full",
           "LastModifiedBy": "arn:aws:iam::12345678:user/TestUser",
           "LastModifiedTime": 1558386334.995,
           "Notifications": [
               {
                   "Arn": "arn:aws:sns:us-west-1:12345678:TestUser"
               }
           ],
           "Priority": 2,
           "RelatedOpsItems": [],
           "Status": "Open",
           "OpsItemId": "oi-1a2b3c4d5e6f",
           "Title": "EC2 instance disk full",
           "Source": "ec2",
           "OperationalData": {
               "EC2": {
                   "Value": "12345",
                   "Type": "SearchableString"
               }
           }
       }
   }
   ```

1. Eseguire il seguente comando per aggiornare OpsItem. Questo comando modifica lo stato da `Open` (predefinito) a `InProgress`.

   ```
   aws ssm update-ops-item --ops-item-id {{ID}} --status InProgress
   ```

   Il comando non ha output.

1. Esegui nuovamente il seguente comando per verificare che lo stato sia cambiato in `InProgress`.

   ```
   aws ssm get-ops-item --ops-item-id {{ID}}
   ```

## Esempi di creazione di un OpsItem
<a name="OpsCenter_creating_OpsItems-CLI_examples"></a>

Negli esempi seguenti viene illustrato come creare un OpsItem utilizzando il portale di gestione Linux, macOS oppure Windows Server. 

**Portale di gestione Linux oppure macOS**

Il comando seguente crea un OpsItem quando un disco istanza Amazon Elastic Compute Cloud (Amazon EC2) è pieno. 

```
aws ssm create-ops-item \
    --title "EC2 instance disk full" \
    --description "Log clean up may have failed which caused the disk to be full" \
    --priority 2 \
    --source ec2 \
    --operational-data '{"EC2":{"Value":"12345","Type":"SearchableString"}}' \
    --notifications Arn="arn:aws:sns:us-west-1:12345678:TestUser1" \
    --tags "Key=EC2,Value=ProductionServers"
```

Il comando seguente utilizza la chiave `/aws/resources` in `OperationalData` per creare un OpsItem con una risorsa correlata ad Amazon DynamoDB.

```
aws ssm create-ops-item \
    --title "EC2 instance disk full" \
    --description "Log clean up may have failed which caused the disk to be full" \
    --priority 2 \
    --source ec2 \
    --operational-data '{"/aws/resources":{"Value":"[{\"arn\": \"arn:aws:dynamodb:us-west-2:12345678:table/OpsItems\"}]","Type":"SearchableString"}}' \
    --notifications Arn="arn:aws:sns:us-west-2:12345678:TestUser"
```

Il comando seguente utilizza la chiave `/aws/automations` in `OperationalData` per creare un OpsItem che specifica il documento `AWS-ASGEnterStandby` come runbook Automation associato.

```
aws ssm create-ops-item \
    --title "EC2 instance disk full" \
    --description "Log clean up may have failed which caused the disk to be full" \
    --priority 2 \
    --source ec2 \
    --operational-data '{"/aws/automations":{"Value":"[{\"automationId\": \"AWS-ASGEnterStandby\", \"automationType\": \"AWS::SSM::Automation\"}]","Type":"SearchableString"}}' \
    --notifications Arn="arn:aws:sns:us-west-2:12345678:TestUser"
```

**Windows**

Il comando seguente crea un OpsItem quando un'istanza Amazon Relational Database Service (Amazon RDS) non risponde. 

```
aws ssm create-ops-item ^
    --title "RDS instance not responding" ^
    --description "RDS instance not responding to ping" ^
    --priority 1 ^
    --source RDS ^
    --operational-data={\"RDS\":{\"Value\":\"abcd\",\"Type\":\"SearchableString\"}} ^
    --notifications Arn="arn:aws:sns:us-west-1:12345678:TestUser1" ^
    --tags "Key=RDS,Value=ProductionServers"
```

Il comando seguente utilizza la chiave `/aws/resources` in `OperationalData` per creare un OpsItem con una risorsa correlata a un'istanza Amazon EC2.

```
aws ssm create-ops-item ^
    --title "EC2 instance disk full" ^
    --description "Log clean up may have failed which caused the disk to be full" ^
    --priority 2 ^
    --source ec2 ^
    --operational-data={\"/aws/resources\":{\"Value\":\"[{\\"""arn\\""":\\"""arn:aws:ec2:us-east-1:123456789012:instance/i-1234567890abcdef0\\"""}]\",\"Type\":\"SearchableString\"}}
```

Il comando seguente utilizza la chiave `/aws/automations` in `OperationalData` per creare un OpsItem che specifica il runbook `AWS-RestartEC2Instance` come runbook Automation associato.

```
aws ssm create-ops-item ^
    --title "EC2 instance disk full" ^
    --description "Log clean up may have failed which caused the disk to be full" ^
    --priority 2 ^
    --source ec2 ^
    --operational-data={\"/aws/automations\":{\"Value\":\"[{\\"""automationId\\""":\\"""AWS-RestartEC2Instance\\”"",\\"""automationType\\""":\\"""AWS::SSM::Automation\\"""}]\",\"Type\":\"SearchableString\"}}
```