Forum Discussion
hooleylist
May 05, 2011Cirrostratus
For our reference, here are the steps I cannibalized from C872450 from Chad:
1. Create a script file /usr/local/bin/mycustomscript.pl
vi /root/mycustomscript.pl
2. Add the script to the file and save:
!/usr/bin/perl
system("echo Alert was triggered > /var/tmp/mycustomscriptoutput.txt");
3. Set the permissions on the file:
chmod 755 /root/mycustomscript.pl
4. Edit /config/user_alert.conf and add the following alert definition. The quoted portion is a regex which must match the syslog message.
alert my_custom_alert "this is the text we look for in the syslog message" {
exec command="/usr/local/bin/mycustomscript.pl"
}
5. Trigger the script:
logger -p local0.info "this is the text we look for in the syslog message"
6. Review the script action which was to create a file and output some text:
less /var/tmp/mycustomscriptoutput.txt
Alert was triggered
Aaron