OK, i noticed you're using SUDO in the script.

 

I wrote up my testing using event_handlers using NRPE which had SUDO in the 
scripts.  I think you may just need to tweak your SUDO config...

 

http://www.techadre.com/content/nagios-event-handler-restarting-service

 

Essentially it's the "requiretty" option that's enabled by default.  Of course 
you probably don't want to enable it outright for security.  I have info on my 
link about how I tried to lock it down a bit for use in my environment.

 

Hope this gets you in the right direction.

-- 
Mat W. - http://www.techadre.com


 


Date: Wed, 16 Sep 2009 20:14:26 -0500
From: [email protected]
To: [email protected]
Subject: [Nagios-users] Problem monitoring asterisk

Hi guys
I am a new user which is trying to monitor an asterisk server using nagios, 
rigth now i am stuck in a problem and i would like to know if somebody could 
help me  to fix my problem, any idea is more than welcome 
Thank you very much for your time

 My scenario is very simple

(NAGIOS  3.2.0)<====>(asterisk)

 i found in google a shell script developed by Peter Andersson, it looks like 
it do the job i mean if i run the shell the output is this In the remote server 
(asterisk), i run it using nagios user
And runs fine
=====================================================================================
 
[r...@pbx-millenium nrpe-2.12]# sudo 
/usr/local/nagios/libexec/check_asterisk_sip_peers.sh 7458030
OK: 7458030/7458030 10.8.12.114 5060 OK (8 ms)|time=8ms
=====================================================================================

In the Asterisk i define the shell script and /usr/local/nagios/etc/nrpe.cfg 
and my conf is this:

--------------------------------------------------------------------------------------------------------------------------------------
dont_blame_nrpe=1
debug=1
command[astpeer_7458030]=sudo 
/usr/local/nagios/libexec/check_asterisk_sip_peers.sh 7458030
---------------------------------------------------------------------------------------------------------------------------------------

Then i restart xinetd

=====================================================================================
service xinetd restart
=====================================================================================

**************************************************************************************
In the nagios Server

---------------------------------------------------------------------------------------------------------------------------------------
define host{
          use       linux-server    ; Inherit default values from a template
          host_name mpcpbx          ; The name we're giving to this server
          alias     pbx1            ; A longer name for the server
          address   192.168.222.3   ; IP address of the server
          }

define service{
          use                 generic-service
          host_name           mpcpbx
          service_description Asterisk Sip Provider
          check_command       check_nrpe!astpeer_7458030
          }

define service{
          use                 generic-service
          host_name           mpcpbx
          service_description CPU Load
          check_command       check_nrpe!check_load
          }
---------------------------------------------------------------------------------------------------------------------------------------
If i run the configuration test it shows

=====================================================================================
Things look okay - No serious problems were detected during the pre-flight check
=====================================================================================

If i test in the Asterisk the predefined services

=====================================================================================
[r...@pbx-millenium nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H 
localhost -c check_load
OK - load average: 0.01, 0.05, 0.04|load1=0.010;15.000;30.000;0; 
load5=0.050;10.000;25.000;0; load15=0.040;5.000;20.000;0; 
=====================================================================================

But testing the shell

=====================================================================================
[r...@pbx-millenium nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H 
localhost -c astpeer_7458030
NRPE: Unable to read output
=====================================================================================

The Documentation says
1-wrong nrpe.cfg => what could be the missconfig?
2-the program should have some output => but indeed it have some output (blue 
output)

So guys i don’t know what to do, any idea?

Thank you very much again
Best regards

Yelson









 





 
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/
------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Nagios-users mailing list
[email protected]
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

Reply via email to