Go to main content

Guide d'administration d'Oracle® ZFS Storage Appliance, version OS8.8.x

Quitter la vue de l'impression

Mis à jour : Août 2021
 
 

Utilisation des fonctions d'alerte personnalisée

La fonction createalert crée une alerte personnalisée, et la fonction postalert publie cette alerte. La fonction createalert peut être appelée à partir d'un script ou d'un workflow. La fonction postalert doit être appelée à partir d'un workflow. Reportez-vous à la section Création et publication d'alertes personnalisées à partir d'un workflow.

  1. L'appel de fonction suivant crée une alerte personnalisée minimaliste.
    createalert([{'handler': 'syslog', 'args': {}}], {description: 'Writes to syslog'});
  2. Le script suivant spécifie des paramètres supplémentaires et capture la valeur de renvoi.

    La valeur de renvoi est requise pour publier l'alerte. Même si l'appel postalert figure dans ce script, postalert doit être appelé à partir d'un workflow en réponse à un événement qui se produit dans le workflow.

    script
    ("." to run)> var actions = [{
    ("." to run)>     handler: 'email',
    ("." to run)>     args: {
    ("." to run)>         address: 'admin@example.com',
    ("." to run)>         subject: 'Custom Alert Response'
    ("." to run)>     }
    ("." to run)> }];
    ("." to run)> var params = {
    ("." to run)>     severity: 'Minor',
    ("." to run)>     description: 'Custom alert description',
    ("." to run)>     response: 'What the alert action does',
    ("." to run)>     impact: 'What happened to the appliance',
    ("." to run)>     recommended_action: 'What the administrator should do'
    ("." to run)> };
    ("." to run)> var cuuid = createalert(actions, params);
    ("." to run)> print(cuuid);
    ("." to run)> var puuid = postalert(cuuid);
    ("." to run)> .
    54c24732-b9c5-4b57-9aee-aeaf195afdae