How custom scripts for alert escalation work
Before writing a custom alert script, review the following information about the command arguments and script file location.
All custom scripts must be stored in the same root path that is defined in the properties of the Management Server that controls all Domains.
The example notification script notify.bat in Windows and notify.sh in Linux can be edited for your own use. In Linux, the sgadmin user needs read, write, and execute permissions in the script’s directory.
Argument Number | Content | Description |
---|---|---|
1 | Alert ID | The unique identifier for the alert. |
2 | Alert Name | The name defined in the alert properties. |
3 | Alert Originator | The IP address of the component that generated this alert. |
4 | Alert Date | The date when the alert was originally generated. |
5 | Alert Message | A short alert description. |
6 | Alert Severity | The Severity value of the alert from 1–10, where 1 is the least severe and 10 is the most severe. The numeric Severity value corresponds to the following Severity value in the generated alert: 1= Info, 2–4=Low, 5–7=High, and 8–10=Critical. |
7 | Alert Short Description | The contents of the Comment field in the alert properties. |
8 | Event ID | IPS only: reference to the event ID that triggered the alert. |
9 | Situation Description | Long description of the Situation that triggered the alert. |
Alert scripts stored in the directory defined in the Management Server element’s properties can be called from Alert Chains by their name.
When the alert script is executed, the output (stdout
) is appended to the
notify.out
file in the script’s directory. The error output (stderr
) is appended to the
notify.err
file in the script’s directory. The Linux script in the following illustration is an example of how to create an operating system log entry using the custom script alert notification.
Example custom alert script
#!/bin/sh
# This script uses the ‘logger’ utility to create an operating system
# log entry of the alert notification.
PATH=/bin:/usr/bin
# Create log entry: “SMC Alert (<ALERT_ID>): Severity <SEVERITY>
# : <ALERT_NAME> : <ALERT_DESCRIPTION>”
/usr/bin/logger “SMC Alert ($1): Severity $6 : $2 : $5”
exit 0