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.
createalert([{'handler': 'syslog', 'args': {}}], {description: 'Writes to syslog'});
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