Page 1 of 1

Error while scheduling host downtime

Posted: Thu Oct 18, 2018 6:31 am
by rituraj966323
Hi Team,

I have followed below scripts for scheduling downtime for respective hosts.
#!/bin/sh
# This is a sample shell script showing how you can submit the SCHEDULE_HOST_DOWNTIME command
# to Nagios. Adjust variables to fit your environment as necessary.

now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'

/usr/bin/printf "[%lu] SCHEDULE_HOST_DOWNTIME;nagios-test;1539852657;1539853857;0;0;600;nagios;Test Downtime Comment\n" $now > $commandfile

if [ $? -ne 1 ]; then
echo "Works....";
fi

[root@test ~]#
[root@test ~]# cat /etc/group | grep nag
nagios:x:1000:
nagcmd:x:1001:nagios,apache
[root@test ~]# sestatus
SELinux status: disabled

but getting error as below

October 18, 2018 16:00

External Command[10-18-2018 16:50:17] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;nagios-test;1539852657;1539853857;0;0;600;nagios;Test Downtime Comment
External Command[10-18-2018 16:45:12] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;nagios-test;1539852657;1539853857;0;0;600;nagios;Test Downtime Comment
External Command[10-18-2018 16:39:16] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;nagios-test;1539852657;1539853857;0;0;600;nagios;Test Downtime Comment
Informational Message[10-18-2018 16:36:19] Auto-save of retention data completed successfully.
Informational Message[10-18-2018 16:19:15] External command error: Command failed

Request you to guide me to fix this issue.

I m using NagiosĀ® Coreā„¢ 4.1.1 - http://www.nagios.org on centos 7

Regards,
Rituraj

Re: Error while scheduling host downtime

Posted: Thu Oct 18, 2018 6:43 am
by rituraj966323
it works after enable external command .thank you

Re: Error while scheduling host downtime

Posted: Thu Oct 18, 2018 3:14 pm
by cdienger
Thanks for the update and posting the solution! :)