define command{
command_name submit_check_result
command_line /usr/local/nagios/libexec/eventhandlers/submit_check_result $HOSTNAME$ ‘$SERVICEDESC$’ $SERVICESTATE$ ‘$OUTPUT$’ | tee -a /tmp/nagios.log
}
I’ve put the tee command in to log if this command was actually being called. There is no output in this log unless I run the submit__check_result manually.
I’ve only set up the check_cron on the client, and it is being run successfully every minute… so why isn’t the submit_check_result being called?
did you try following the instructions in the sticky thread “how to best use NCSA”? there’s some useful info… i’m no big expert at it.
Luca
PS: i just read this in your fierrst post:
"I’ve only set up the check_cron on the client, and it is being run successfully every minute… so why isn’t the submit_check_result being called?"
submit check result should not be called directly… you shoul dbe checking some value on the local machine to be sent to the central nagios server…
Thanks Luca. I re-read the NSCA thread, but couldn’t find anything.
I don’t understand your PS, maybe I’m missing something… this is how I understand the process.
I’m trying to set up a distributed monitor.
distributed-host is running nagios and check client-a using nrpe, client-a returns its result and is supposed to run the submit_check_result command due to “obsess_over_services=1” and “ocsp_command=submit_check_result”. Obsess over service then uses send_nsca to pass results over to the central server.
The distributed server also has obssess_over_service=1, so it should return all results.
Thanks Luca. I re-read the NSCA thread, but couldn’t find anything.
I don’t understand your PS, maybe I’m missing something… this is how I understand the process.
I’m trying to set up a distributed monitor.
distributed-host is running nagios and check client-a using nrpe, client-a returns its result and is supposed to run the submit_check_result command due to “obsess_over_services=1” and “ocsp_command=submit_check_result”. Obsess over service then uses send_nsca to pass results over to the central server.
The distributed server also has obssess_over_service=1, so it should return all results.
as for my PS i re read it myself and it looks like i misunderstood you
but what i’m not sure about what you wrote now is: The main host is checking via NRPE and the remote host uses NSCA to send the result back? that is wrong. either you use NRPE or you use NSCA… if you use NSCA the check is remotely initiated by the nagios instance which sends the result to the main server, in NRPE it’s the central server who runs the plugins remotely so there should be no need for nagios on the remote host. (this is how i understood it, no tusing NRPE i’m not really sure)
As the nagios user the submit_check_results works, with or without the tee command. I put the tee command there to prove that the submit_check_result was never being called.
luca
The distributed host checks the client using nrpe, receives the result and then should forward the result using the submit_nsca command inside the submit_check_result script, which should be called due to the obssessive compulsive command.
From my tests, the format of your last line is missing tabs(\t).
Try these 2 command lines and see which one works. Only the last one worked for me.
YOUR FORMAT:
/bin/echo “SOMEREALHOSTNAME VALIDSERVICEDESC 1 TEST” | /usr/local/nagios/bin/send_nsca xxx.xxx.xxx.xxx -p 5667 -c /usr/local/nagios/etc/send_nsca.cfg
SUGGESTED FORMAT:
/bin/echo “SOMEREALHOSTNAME\tVALIDSERVICEDESC\t1\tTEST\n” | /usr/local/nagios/bin/send_nsca xxx.xxx.xxx.xxx -p 5667 -c /usr/local/nagios/etc/send_nsca.cfg
FYI: in order to get a backslash \ to show up in this forum, you have to type 2 of them in a row. Like this:
I type 2 backslashes \ and yet you only see one of them.
I’ve got actual tabbed space in the last line by pressing control-v-tab. This script does work and updates the Nagios server when I run it. It just doesn’t ever get run by nagios.
Most likely nagios doesn’t like your syntax and I’ve stated already what the syntax should look like. If you choose to change that syntax and it doesn’t work, then please stop asking for assistance, since you already know how it should work, apparently. Control-v-tab instead of \t
Thanks for the help, but there is no need to be rude. If you look at any of my posts or the heading, the problem is that the obsessive compulsive command is not being called. Not that it doesn’t work. Nagios does like my syntax as I previously stated, when I run the script it works.
Sorry 'bout being rude. I only figured it wouldn’t hurt to at least try a suggestion. I don’t have the time to try your syntax and test it, but then, I"m not the one with the problem. Good luck.
I’m not sure I understand what you have done here. You do realize that these settings/command definitions are made on the REMOTE host that will attempt to send the output of service checks to the central nagios server.