Page 1 of 1

Misc commands as built-in shell functions

Posted: Fri Jul 26, 2013 2:40 am
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?

Re: Misc commands as built-in shell functions

Posted: Fri Jul 26, 2013 10:12 am
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.