Page 1 of 1

How External Command or shell script use to disable host chk

Posted: Wed Oct 06, 2021 7:52 am
by bvanarse
How can we write correct code for disable host check for nagios

I used following script, but does not work, also want to add comment while disable the server monitoring

===============================================================================================

#!/bin/sh
# This is a sample shell script showing how you can submit the DISABLE_HOST_CHECK command
# to Nagios. Adjust variables to fit your environment as necessary.

now=`date +%s`
commandfile='/appl/Nagios/Node/var/NagiosNode/rw/nagios.cmd'

/bin/printf "[%lu] DISABLE_HOST_CHECK;<host>\n" $now > $commandfile

===============================================================================================

Please assist

Re: How External Command or shell script use to disable host

Posted: Wed Oct 06, 2021 10:45 am
by mcapra
Have you followed these instructions?
https://assets.nagios.com/downloads/nag ... mands.html
In order to have Nagios process external commands, make sure you do the following:
  • Enable external command checking with the check_external_commands option.
  • Specify the location of the command file with the command_file option.
  • Setup proper permissions on the directory containing the external command file, as described in the quickstart guide.
Does your nagios.log file contain any "External command error" messages?