command_line commands
Posted: Fri Aug 05, 2011 3:19 pm
Just got Nagios up and running (in a matter of minutes
), with SNMP trapping enabled with no issues but I have command_line functionality question. We're not permitted to install sendmail, etc. on our machines so I need to run a simple system command to create a file in a directory. I thought this could be achieved by changing the notify-service-by-email comand_line to something like "/bin/echo alert > /sweep_dir/testfile.txt" but it doesn't seem to execute when the traps are received so I'm sure I'm missing something in the setup. What am I missing here?
In the host notification page, I'm seeing the notification is logged and using the notify-service-by-email command:
In the host notification page, I'm seeing the notification is logged and using the notify-service-by-email command:
Code: Select all
Host Service Type Time Contact Notification Command Information
myhost TRAP WARNING 08-05-2011 16:02:02 nagiosadmin notify-service-by-email common alert 100 TestConfig TestConfig TestConfig TestConfig
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /bin/echo alert >/sweep_dir/testfile.txt
}