Automated Script Actions for Alerts
For any line in [PROTOPDIR]/etc/alert.[*].cfg, if the keyword “script” is included in the alert action list, ProTop will search for and execute the script named [PROTOPDIR]/bin/[metricName] if found.
ProTop will then send a white alert to the portal containing the script's output. This will occur in addition to any other items in the action list for that alert.
NOTE: At the moment, on Windows, you need two files in bin. One file named for the metric (it can be empty) and a bat file named for the metric that does the work you want done. So, e.g. bin\otrx and bin\otrx.bat.
CAREFUL: The spelling and case must match the Alertable Metric Name found on the Alertable Metrics pages.
For example, to have ProTop run a script that you wrote, which provides more information about the state of the lock table when this alert is fired, add this line to your [PROTOPDIR]/etc/alert.[*].cfg:
lkTableSize num > 500000 "" "daily" "&1 &2 &3" script,alert
This says when the lkTableSize exceeds 500000, ProTop will look for and execute [PROTOPDIR]/bin/lkTableSize (notice, no file name extension), passing in these parameters:
- $0=script reference (internally bin/alertMetric = scriptName)
- $1=alertMetric
- $2=friendlyName
- $3=full path to DB
- $4=metricValue
- $5=(varies)
- $6=alertContext
It will then send a white alert to the portal containing the output of your script, along with the normal yellow alert.
You can see the output of your script by viewing the details of the alert on the ProTop Portal. The bottom half of the message includes the script output.
