SOLVED!: Re: nrpe sudo issues on a remote box
Andy Riedel
ariedel at atlas-mobile.com
Sun Dec 7 06:02:30 CET 2003
One more modification to the sudo line will make it more compatible with
various other init scripts:
sudo /etc/init.d/httpd restart >/dev/null 2>&1
Andy
"Andy Riedel" <ariedel at atlas-mobile.com> wrote in message
news:bqtn8p$vkt$1 at sea.gmane.org...
> Add this pipe to /dev/null in your eventhandler script and everything
works
> properly. nrpe will indeed stop processing a script after the first line
of
> response text is received from the script. By piping to /dev/null, the
> entire script will complete.
>
> sudo /etc/rc.d/init.d/httpd restart >/dev/null
>
> 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
>
-------------------------------------------------------
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