I’m trying to implement passive checks under nagios 2.10…
I have a script that writes:
[1194617725] PROCESS_SERVICE_CHECK_RESULT;PASSIVE_CHECK;PASSIVE_CHECK;2;pouet
in the file /appli/nagios/var/rw/nagios.cmd as defined by this line in the nagios.cfg:
command_file=/appli/nagios/var/rw/nagios.cmd
I have also set these 2 variables:
check_external_commands=1
command_check_interval=15s
In the end, lines are written in the nagios.cmd file, but they don’t seem to be read at all (and of course, they are not deleted).
Do I need to configure something else to get the passive checks working ? or did I do something wrong.
Thanks in advance for your help.
If you need more information about my configurations, just ask
ps: it might be of interest or not, but the first time I changed the variable check_external_commands from 0 to 1, I reloaded nagios, which ended up stoped a few seconds afterward; I had to restart it…
Should be:
command_check_interval=-1
Your passive check information needs to be correct. i.e.
if you have a host1 with check-test then on the central server, you must have a host1 with a service check of check-test, and the spelling must be the identical.
passive_checks_enabled 1 needed in services.cfg for that service check check-test.
active_checks_enabled 0 for that service check.
Are you able to use the website and submit something like a forced check on some service? This will tell us if your external cmd file is working at all.
I just tried to re-schedule a test from the website;
the line
[1194856235] SCHEDULE_FORCED_SVC_CHECK;HTTP;URL;119485635
was writted in the nagios.cmd file … but that’s all:
it never got deleted
the test has never been succesfully re-scheduled
(I’ve also tried with the command_check_interval set to -1; the 15s I wrote was a test to see if I could get it to work)
Sorry; false alert!
In fact, while trying to get the passive checks working, I don’t why, but I deleted the nagios.cmd file; so I created another one … which was not a piped file as nagios creates it!
that’s why it was not working;
so this problem is solved: I just had to do a restart (not a reload!) so nagios could create a new nagios.cmd file.
So now, I’m back to my old problem: I can’t get a perl script to write in this nagios.cmd file (I know, I can do it in ksh, but I need it to be working in perl). If anyone knows how to do that, please, share with me
btw:
open(EXTERNAL,">>$ENV{NAGIOS_HOME}/var/rw/nagios.cmd")||die “Dying”
the nagios.cmd file does not exist until it has been created by some source. So if you are triing to write to it, it’s not there. Instead, >> to it. i.e. append to it, if it exists. If it doesn’t exist, create it.