Help - I am unable to get theNSClient++ to restart services

Jonathan Williams jonathan.williams at us.g4s.com
Thu Jul 17 19:14:47 CEST 2008


OK...  A little more info.  I checked the Nagios.log and saw this error:

 

Warning: Attempoting to execute the command "/usr/local/nagios/libexec/send_mail.pl - n "Service Problem" -h "jwilliamspc" -s "Critical"... (all the parameters are correct)... jonathan.williams at us.g4s.com resulted in a return code of 126.  Make sure the script or binary you are trying to execute actually exists...  

 

The file send_mail.pl does exist in the /usr/local/Nagios/libexec folder.  Not sure why I am getting that return code.

 

Any thoughts?

 

________________________________

From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of Jonathan Williams
Sent: Thursday, July 17, 2008 9:21 AM
To: Valdinger, Stephen (DOV, MSX); nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Help - I am unable to get theNSClient++ to restart services

 

Ha!!  It does sound that way.  I used the "chmod +X send_mail.pl" command to grant the execute permission, so I would have assumed it would work.  When I run sudo /path.../send_mail.pl is get "command not found".  

 

________________________________

From: Valdinger, Stephen (DOV, MSX) [mailto:svalding at doverchem.com] 
Sent: Thursday, July 17, 2008 9:03 AM
To: Jonathan Williams; nagios-users at lists.sourceforge.net
Subject: RE: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

You just answered your own question....

 

Stephen Valdinger

MIS Helpdesk Coordinator

330.365.3622 -O

740.491.0958 - C

svalding at doverchem.com

 

________________________________

From: Jonathan Williams [mailto:jonathan.williams at us.g4s.com] 
Sent: Thursday, July 17, 2008 12:05 PM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

To further test the send_mail.pl function, I tried running it directly from a command prompt and I get a "Permission Denied" error.  Any idea why that would be.  I am using root credentials and the user "Nagios" is the owner.  

 

 

________________________________

From: Jonathan Williams 
Sent: Wednesday, July 16, 2008 1:47 PM
To: Valdinger, Stephen (DOV, MSX)
Cc: nagios-users at lists.sourceforge.net
Subject: RE: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

We have an open SMTP relay setup (IIS) and that is what we use for other apps.  As far as mail client, I am trying to use send_mail.pl plug-in found here:  http://www.nagiosexchange.org/cgi-bin/page.cgi?g=2002.html;d=1  and cannot get it to notify.  The online documentation differs from the documentation in the actual send_mail.pl config file.  My commands.cfg looks like this:

 

define command{

      command_name      host-notify-by-email

      command_line      /usr/local/Nagios/libexec/send_mail.pl -n "HOST $NOTIFICATIONTYPE$" -h "$HOSTNAME$"  -s "$HOSTSTATE$" -a "$HOSTADDRESS$" -i "$HOSTOUTPUT$" -d "$LONGDATETIME$" -e "$CONTACTEMAIL$"

 

define command{

      command_name      service-notify-by-email

      command_line      /usr/local/Nagios/libexec/send_mail.pl -n "SERVICE $NOTIFICATIONTYPE$" -h "$HOSTNAME$" -s "$SERVICESTATE$" -a "$HOSTADDRESS$" -i "$SERVICEDESC$ - $SERVICEOUTPUT$ - $SERVICECHECKCOMMAND$" -d "$LONGDATETIME$" -e "$CONTACTEMAIL$"

}

 

The sample documentation uses $USER1$/send_mail.pl rather than the actual path.  I am not sure what $USER1$ represents.  I tried it both ways.

 

My templates are also set up for services and hosts to allow for notification and reference these command_line entries.  

 

I am also not sure why an e-mail address is specified in the send_mail.pl file as well as the contacts.cfg.  When looking at the service notification settings in the Nagios CGI it is correct.

 

Is there anything I am missing?

 

Jon

 

________________________________

From: Valdinger, Stephen (DOV, MSX) [mailto:svalding at doverchem.com] 
Sent: Wednesday, July 16, 2008 11:05 AM
To: Jonathan Williams
Subject: RE: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

Here we use postfix as our mta pusing everything to our exchange server for sending out the mail. It's really very easy to set up, just make sure you have your contacts set up properly and that they have access to the cgi's as needed and configure your notification command to use whatever binary file your chosen mail client uses. 

 

Stephen Valdinger

MIS Helpdesk Coordinator

330.365.3622 -O

740.491.0958 - C

svalding at doverchem.com



________________________________

From: Jonathan Williams [mailto:jonathan.williams at us.g4s.com] 
Sent: Wednesday, July 16, 2008 1:42 PM
To: Paulo Ribas
Cc: Nagios Users Mailinglist
Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

I have read that.  Thank you.  That is actually also in the Nagios PDF file as well.  I remembered I did not restart Nagios after making a couple of changes so I did that and it finally works!!  Thanks everyone for all you help with my questions.  Now I need to get e-mail notifications up.  I noticed there are a few options and plug-ins people are using.  What are you guys having success with?

 

Thanks again,

 

Jon

 

________________________________

From: Paulo Ribas [mailto:paulo.ribas at opservices.com.br] 
Sent: Wednesday, July 16, 2008 10:35 AM
To: Jonathan Williams
Cc: Nagios Users Mailinglist
Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

Try the following url http://nagios.sourceforge.net/docs/3_0/eventhandlers.html


[]'s
--
 <https://mail.opservices.com.br/service/assinaturas/assinatura-email-paulo_01.jpg> 



----- "Jonathan Williams" wrote: 
> 

OK.. I am getting somewhere now.  I manually ran this command from the Nagios server terminal:

 

/usr/local/nagios/libexec/check_nrpe -H 10.10.113.51 -p 5666 -n -c service_control -a "spooler" start

 

And it worked!!  Meaning the OpMonagent works!  Now I jst need to find out why it will not work as an event_handler like so:

 

Define service{

      Use                     generic service

      Host_name               jwilliamspc

      Service_description     PrintSpooler

      Check_command           check_nt!SERVICESTATE!-d SHOWALL -l Spooler

      Event_handler           restart_Spooler

      }

 

define command{

command_name         restart-Spooler

command_line         PATH/check_nrpe -H $HOSTADDRESS$ -p 5666 -n -c service_control -a "Spooler" start

 

 

 

 

 

________________________________

From: Jonathan Williams 
> Sent: Wednesday, July 16, 2008 10:07 AM
> To: Fernando Rocha
> Cc: Nagios Users Mailinglist
> Subject: RE: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

OK.  OpMon is running on the test server and my define_command for spooler restart reads exactly as you posted, still no service restart.  I am still missing something.  I am not sure if I need to edit anything in the OpMonagent.ini or service_control.cmd.  

 

________________________________

From: Fernando Rocha [mailto:fernando.rocha at opservices.com.br] 
> Sent: Tuesday, July 15, 2008 2:11 PM
> To: Jonathan Williams
> Cc: Nagios Users Mailinglist
> Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

Jonathan,
> 
> The client installed on the host doesn't matter if both of them have support to nrpe. They will have a configuration file where you'll define the commands to run over check_nrpe.
> 
> NSClient++ uses NSC.ini
> OpMonAgent uses opmonagent.ini
> 
> But to make it easy, the OpMonAgent has a command to restart services built-in his configuration file.
> 
> So, if you have the OpMonAgent running on host, you just need run the following command from your nagios server:
> 
> /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -p 5666 -n -c service_control -a "spooler" start
> 
> But, if you are using NSClient++ you need define a command into the configuration file first, then you'll use this command in the check_nrpe.
> 
> Fernando Rocha
> OpServices Tecnologia da Informação
> 
> ----- Original Message -----
> From: "Jonathan Williams" <jonathan.williams at us.g4s.com>
> To: "Fernando Rocha" <fernando.rocha at opservices.com.br>
> Cc: "Nagios Users Mailinglist" <nagios-users at lists.sourceforge.net>
> Sent: Tuesday, July 15, 2008 4:57:07 PM (GMT-0300) Auto-Detected
> Subject: RE: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

I feel like I am back at square one.  It seems like a simple task to get Nagios to restart a service.  I have NRPE now running on the server under xinedt, and switched the client back to NSClient++ from OpMon Agent.  Both support NRPE.  I am not sure if I am supposed to get a service restarted with a NRPE_Check command like:

 

/usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -p 5666 -n -c service_control -a "spooler" start

      

Or am is supposed to create scripts on the host that will restart a service like a .bat file with a "net start spooler" command and than get an event_handler set up to call that script.  It seems there are different ways to do it and I am being pulled both directions.  I am new to Nagios as well as Linux and have been able to scrap my way thus far while learning a lot about both, but am about ready to call it quits.  I was pointed to the NakedNuns website to the section on CheckExternalScripts, but honestly could not make much sense of it.

 

________________________________

From: Fernando Rocha [mailto:fernando.rocha at opservices.com.br] 
> Sent: Tuesday, July 15, 2008 4:38 AM
> To: Jonathan Williams
> Cc: Nagios Users Mailinglist
> Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

Jonathan,
> 
> make sure that you have the xinetd installed and check if there is the following directory:
> 
> [root at fernando ~]# ls /etc/xinetd.d/
> chargen-dgram   daytime-dgram   discard-dgram   echo-dgram   eklogin       gssftp  krb5-telnet  ktalk  rsync          time-dgram
> chargen-stream  daytime-stream  discard-stream  echo-stream  ekrb5-telnet  klogin  kshell       nrpe   tcpmux-server  time-stream
> 
> if you don't have that, try to install by apt-get!
> 
> and then, run the command again
> 
> Make install-xinetd
> 
> or you can install just writing a file like this:
> [root at fernando ~]# cat /etc/xinetd.d/nrpe 
> service nrpe
> {
>         flags = REUSE
>         socket_type = stream
>         wait = no
>         only_from = 127.0.0.1 (PUT YOURS NARIOS SERVER'S IPS HERE)
>         user = nagios (PUT THE NAGIOS USER HERE)
>         server = /usr/local/nagios/libexec/nrpe (THE NRPE SERVER)
>         server_args = -c /usr/local/nagios/libexec/nrpe.cfg --inetd (THE NRPE CONFIG FILE)
>         log_on_failure += USERID
>         disable = no
> }
> 
> and then restart xinetd!

Fernando Rocha
> OpServices Tecnologia da Informação


> ----- Original Message -----
> From: "Jonathan Williams" <jonathan.williams at us.g4s.com>
> To: "Fernando Rocha" <fernando.rocha at opservices.com.br>
> Sent: Monday, July 14, 2008 7:07:57 PM (GMT-0300) Auto-Detected
> Subject: RE: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

I was able to compile that without ssl and was able to install the pugin's using the following

 

Make install-plugin

Make install-daemon

Make install-daemon-config

 

Those worked finer however the next step says:

 

Install the NRPE daemon as a service under xinetd

Make install-xinetd

 

I run that command and get:

root at nagiosserver:- /downloads/nrpe-2.8# cannot create regular file '/ect/xinetd.d/nrpe' No such file or directory

make: *** [install-xinetd] Error 1

 

Any thoughts??

 

Thanks,

 

Jon

 

________________________________

From: Fernando Rocha [mailto:fernando.rocha at opservices.com.br] 
> Sent: Monday, July 14, 2008 11:49 AM
> To: Jonathan Williams
> Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

Hi Jonathan!
> 
> try to use the option --disable-ssl when you run ./configure

Fernando Rocha
> OpServices Tecnologia da Informação


> 
> ----- Original Message -----
> From: "Jonathan Williams" <jonathan.williams at us.g4s.com>
> To: "Paulo Ribas" <paulo.ribas at opservices.com.br>
> Cc: nagios-users at lists.sourceforge.net
> Sent: Monday, July 14, 2008 11:52:48 AM (GMT-0300) Auto-Detected
> Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

I am having a little trouble installing the NRPE 2.8 plug in Ubuntu.  I am able to extract the source code tarball and than I am having issues after that.  Per the instructions I am trying to compile the NRPE add-on by running

 

./configure

make all

 

After I type ./configure I get a message at the end of the compile job saying "configuration error: Cannot find ssl libraries.  Than if I try to go further by installing the plugins by typing make all or the individual make install-pluggin I get an error saying ** No rule to make target 'all'.  Stop.  

 

________________________________

From: Paulo Ribas [mailto:paulo.ribas at opservices.com.br] 
> Sent: Friday, July 11, 2008 2:04 PM
> To: Jonathan Williams
> Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

Ok, If you need, contact me.

[]'s
> --


> 
> ----- "Jonathan Williams" wrote: 
> > 

I found the NRPE add-on (not plug-in) so I will download and install that.  I'll let you know if I run into anything.  You have been more than helpful.

 

Thanks,

 

Jon

 

________________________________

From: Paulo Ribas [mailto:paulo.ribas at opservices.com.br] 
> > Sent: Friday, July 11, 2008 1:49 PM
> > To: Jonathan Williams
> > Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

check_nrpe is part of the package nrpe, if you use ubuntu, I believe that only an "apt-get install nrpe" solve your problem.

[]'s
> > --
> > 


> > 
> > ----- "Jonathan Williams" wrote: 
> > > 

OK.. I do not have check_nrpe so apparently I need to download that plug-in on by Ubuntu box.

 

________________________________

From: Paulo Ribas [mailto:paulo.ribas at opservices.com.br] 
> > > Sent: Friday, July 11, 2008 1:42 PM
> > > To: Jonathan Williams
> > > Subject: Re: [Nagios-users] Help - I am unable to get the NSClient++ to restart services

 

The commando must be:
> > > 
> > > 

define command{

command_name         restart-Spooler

command_line         PATH/check_nrpe -H $HOSTADDRESS$ -p 5666 -n -c service_control -a "Spooler" start

}


> > > 
> > > ex:

define command{

command_name         restart-Spooler

command_line         /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -p 5666 -n -c service_control -a "Spooler" start

}

risk being sent to /dev/null


> ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________ 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 the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________ 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20080717/61398ae1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3605 bytes
Desc: image001.jpg
URL: <https://www.monitoring-lists.org/archive/users/attachments/20080717/61398ae1/attachment.jpg>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
-------------- next part --------------
_______________________________________________
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