#!/bin/sh
# This is a sample shell script showing how you can submit the ACKNOWLEDGE_SVC_PROBLEM command
# to Nagios. Adjust variables to fit your environment as necessary.
now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'
/bin/printf "[%lu] ACKNOWLEDGE_SVC_PROBLEM;host1;service1;2;1;1;Some One;Some Acknowledgement Comment\n" $now > $commandfile
#!/bin/sh
# This is a sample shell script showing how you can submit the ACKNOWLEDGE_SVC_PROBLEM command
# to Nagios. Adjust variables to fit your environment as necessary.
now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'
/bin/printf "[%lu] ACKNOWLEDGE_SVC_PROBLEM;%host%;%service%;2;1;1;NagiosXI;Acknowledgement has been auto generated by NagiosXI\n" $now > $commandfile
Im just trying to have nagios acknowledge a service when it goes down. Im going to create an event handler that will run this script when the service goes down.
#!/bin/sh
# This is a sample shell script showing how you can submit the ACKNOWLEDGE_SVC_PROBLEM command
# to Nagios. Adjust variables to fit your environment as necessary.
host=$1
service=$2
now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'
`which printf` "[%lu] ACKNOWLEDGE_SVC_PROBLEM;$host;$service;2;1;1;nagiosadmin;Acknowledgement has been auto generated by NagiosXI\n" $now > $commandfile
Then your command for the event handler would look like this