Error while scheduling host downtime
Posted: Thu Oct 18, 2018 6:31 am
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
1000:
nagcmd
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
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
nagcmd
[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