Problems with restarting service

Neil neil-on-nagios at restricted.dyndns.org
Tue Feb 3 00:41:34 CET 2004


This is very interesting. I thought, Nagios only do monitoring. Is it true 
that nagios can restart a service using event handlers? What about services 
on remote like Windows using NRPE? 

Thanks. 


Chris Mason writes: 

> I have a server on which I am running nagios and a service similar to httpd. 
> 
> I want to restart the service should it stop responding. 
> 
> As a test, I have used httpd. 
> 
> Nagios is configured as follows:
> /etc/nagios/services.cfg 
> 
> ...
>         check_command                   check_http
>         event_handler                   restart-httpd
> ... 
> 
> /etc/nagios/checkcommands.cfg
> ...
> # 'check_http' command definition
> define command{
>         command_name    check_http
>         command_line    $USER1$/check_http -H $HOSTADDRESS$
>         }
> ... 
> 
> /usr/lib/nagios/plugins/eventhandlers/restart_httpd
> ...
>                         # Call the init script to restart the HTTPD server
>                         sudo /etc/init.d/httpd restart
> ... 
> 
> I have sudo'ed the nagios user "nagios" as follows
> # Cmnd alias specification
> Cmnd_Alias      HTTP = /etc/rc.d/init.d/httpd restart 
> 
> NAGUSERS        localhost=NOPASSWD: HTTP 
> 
> If I su to nagios, I can execute the restart. 
> 
> Nagios tries to execute it, but the message is:
> Feb  2 13:22:38 slimp3server sudo(pam_unix)[15754]: authentication failure;
> logname= uid=0 euid=0 tty= ruser= rhost=  user=nagios 
> 
> And the command is not executed. 
> 
> Any ideas? 
> 
>  
> 
>  
> 
>  
> 
> Chris Mason
> masonc at masonc.com
> Box 340, The Valley, Anguilla, British West Indies
> Yahoo IM: netconcepts_anguilla at yahoo.com
> 264 497-5670 Fax: 264 497-8463
> www.netconcepts.ai 
> 
>  
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> 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
 


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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