Misc commands as built-in shell functions

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
topi
Posts: 1
Joined: Fri Jun 28, 2013 6:09 am

Misc commands as built-in shell functions

Post by topi »

Hello,

I have a nagios distributed setup (operating system is debian wheezy), using ocsp-sweeper (http://exchange.nagios.org/directory/Ad ... er/details) to send check results from distributed instances to the central one, avoiding to fork a nsca client for each check result (ocsp-sweeper reads the pipe at regular intervals and send the results using send_nsca).

I'm wondering if i could set the "ocsp_command" to execute a printf built-in function, instead of my current submit_service_check_result:

Code: Select all

define command {
       command_name submit_service_check_result
       command_line /usr/bin/printf "%s\t%s\t%s\t%s\x17" "$HOSTNAME$" "$SERVICEDESC$" "$SERVICESTATEID$" "$SERVICEOUTPUT$|$SERVICEPERFDATA$ [$SERVICECHECKCOMMAND$]" >> /var/lib/nagios3/rw/ocsp.cmd
}
Currently, I've seen nagios executes

Code: Select all

sh -c /usr/bin/printf "%s\t%s\t%s\t%s\x17" "$HOSTNAME$" "$SERVICEDESC$" "$SERVICESTATEID$" "$SERVICEOUTPUT$|$SERVICEPERFDATA$ [$SERVICECHECKCOMMAND$]" >> /var/lib/nagios3/rw/ocsp.cmd
It's possible to do that?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Misc commands as built-in shell functions

Post by sreinhardt »

So you would like the nsca agent to run the additional printf, you would like to modify the present service command to include another, or you would like to modify the actions ocsp takes? Sorry if I am being dense here, just want to be sure we are working on the same goal.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked