nrpe sudo issues on a remote box

Andy Riedel ariedel at atlas-mobile.com
Sat Dec 6 22:04:31 CET 2003


I narrowed the problem down to the stop() function in the httpd script. If
you comment out the 'echo' line, the full restart works. My guess is that
since plugins are only allowed to return 1 line of response text, nrpe is
getting confused and terminating the plugin when the first line of ech is
received. Perhaps their is some way to pipe the output somewhere else so
nrpe doesn't see it?

stop() {
        echo -n $"Stopping $prog: "
        killproc $httpd
        RETVAL=$?
#       echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}

Andy

"Robert Bilbrey" <rbilbrey at cymark.com> wrote in message
news:20031203065741.29196.qmail at mail.cyberdown.com...
> I modified the example http-restart script to use sudo to restart
coldfusion
> and apache after they have been down hard twice. The event triggers on the
> nagios box and the nrpe daemon executes the script. It kills apache and
> coldfusion, but fails to restart apache (w/o a corrosponding error),
> coldfusion restarts. The really flaky thing is that if I su to nrpe and
run
> the script, it runs as it should, both services stop and restart.
>
> The only differnece in the secure log between both methods of invocation
is
> that when the daemon does it, there is no tty entry.
>
> relevant sudoer config:
> Cmnd_Alias      R  = /etc/init.d/httpd start,/etc/init.d/httpd
> stop,/etc/init.d/httpd restart,/usr/sbin/httpd,/etc/init.d/coldfusion
> stop,/etc/init.d/coldfusion
start,/usr/lib/nagios/eventhandlers/http-restart
>
> nrpe ALL=  NOPASSWD: R
>
>
> secure log entries: (DAEMON Initiated)
> Dec  2 21:08:28 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/httpd stop
> Dec  2 21:08:28 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/coldfusion stop
> Dec  2 21:08:29 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/coldfusion start
> Dec  2 21:08:29 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/httpd start
> Dec  3 00:32:38 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/httpd stop
> Dec  3 00:32:40 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/coldfusion stop
> Dec  3 00:32:46 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/coldfusion start
> Dec  3 00:32:46 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/httpd start
> Dec  3 00:33:29 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/httpd stop
> Dec  3 00:33:29 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/coldfusion stop
> Dec  3 00:33:30 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/coldfusion start
> Dec  3 00:33:30 cb01 sudo:     nrpe : TTY=unknown ; PWD=/ ; USER=root ;
> COMMAND=/etc/init.d/httpd start
>
> secure log entries: (Initiated from console as nrpe)
>
>
> Dec  3 01:52:51 cb01 sudo:     nrpe : TTY=pts/1 ; PWD=/var/log ; USER=root
;
> COMMAND=/etc/init.d/httpd stop
> Dec  3 01:52:53 cb01 sudo:     nrpe : TTY=pts/1 ; PWD=/var/log ; USER=root
;
> COMMAND=/etc/init.d/coldfusion stop
> Dec  3 01:52:54 cb01 sudo:     nrpe : TTY=pts/1 ; PWD=/var/log ; USER=root
;
> COMMAND=/etc/init.d/coldfusion start
> Dec  3 01:52:54 cb01 sudo:     nrpe : TTY=pts/1 ; PWD=/var/log ; USER=root
;
> COMMAND=/etc/init.d/httpd start
>
>
> So can anyone enlighten me to what I have missed ?
> Thanks, Bob
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?  SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list