Eventhandlers and SUDO

twebster at daksoft.com twebster at daksoft.com
Fri Sep 20 17:45:47 CEST 2002


I am setting up a clustering system using the Heartbeat project.  I have
configured the distributed monitoring on each system, and the Master
(active) server sends results back to our Central Nagios server via the
send_nsca script, works great.

My problem, when Nagios detects either a problem with httpd, sendmail,
named or ftp, I calling an EventHandler called resetart-httpd,
restart-sendmail, restart-named, restart-xinetd, respectively.

I have use the standard restart-httpd available in the Nagios installation
for my "template" eventhandler script.

In addition, I for each of the restart command I appended a sudo to the
beginning of the line so my restart command looks like
      sudo /etc/rc.d/init.d/httpd restart

I have tried multiple /etc/sudoers configs but the service is never able to
restart,  I have included several variations that I have tried.

nagios  localhost = NOPASSWD: /etc/rc.d/init.d/sendmail
nagios localhost = (ALL) NOPASSWD: ALL
nagios  ALL = NOPASSWD: ALL


One thing I notice, the sendmail will complet the STOP correctly but will
not perform the Start of the service.  When I execute restart-sendmail
CRITICAL SOFT 3 from the command line as the Nagios user, Sendmail, stops,
fails and then starts up fine.  But when Nagios runs the restart-sendmail
it fails at the STOP everytime, note I have manually caused sendmail to
stop and am trying to run restart.

Has anyone used SUDO for this purpose?


Tony




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf




More information about the Users mailing list