Check_APC_PDU Command Definition

Patrik Båt pb at osix.eu
Thu Apr 7 08:23:24 CEST 2011


in nagios execute it like this:

perl /usr/local/nagios/libexec/check_apc_pdu.pl
^
|---- notice the perl, otherwise it will probably run the embedded perl
in nagios. and look in the script if there is a #!/path/to/perl at the
first line. 

On Wed, 2011-04-06 at 15:35 +0100, Peter Roddan wrote:
> Hi Mike,
> 
>  
> 
> Thanks very much for your help.
> 
> I’ve changed the below, and I now get the following as the Nagios
> Status Information.
> 
>  
> 
> /usr/local/nagios/libexec/check_apc_pdu.pl: line 24: use: command not
> found
> /usr/local/nagios/libexec/check_apc_pdu.pl: line 25: use: command not
> found
> /usr/local/nagios/libexec/check_apc_pdu.pl: line 26: use: command not
> found
> /usr/local/nagios/libexec/check_apc_pdu.pl: line 27: syntax error near
> unexpected token `('
> /usr/local/nagios/libexec/check_apc_pdu.pl: line 27: `use utils
> qw($TIMEOUT %ERRORS &print_revision &support);'
> 
>  
> 
> So I guess there’s a problem with the script after all.
> 
> Strange, as it works when I run it from the command line as the nagios
> user.
> 
>  
> 
> Back to the drawing board with that one I suppose!
> 
>  
> 
> Thanks,
> 
>  
> 
> Peter.
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> Peter Roddan
> Senior Systems Analyst 
> 
> SBS Worldwide Ltd - Dartford 
> DDI No: +44 (0)1322 424741
> Email :Peter.Roddan at sbsworldwide.com
> Website :sbsworldwide.com
> 
> Description:
> http://www.sbsworldwide.com/_images/signatures/sig_logo.jpg
> 
> P  Think before you print!
> 
> 
> 
>  
> 
> 
> From: Mike Lindsey [mailto:mike-nagios at 5dninja.net] 
> Sent: 05 April 2011 20:23
> To: Nagios Users List
> Cc: Peter Roddan
> Subject: Re: [Nagios-users] Check_APC_PDU Command Definition
> 
> 
> 
>  
> 
> Often, when you're getting an error and the only result you see is
> (null), what is happening is that your check script is printing to
> stderr.  It might be that you have perl in your path, but the perl
> script's #! line doesn't declare the full path to perl, or there's an
> access error of some sort.
> 
> But it's easy to figure out what's going on.  Simply change your
> command_line to:
>     command_line    $USER1$/check_apc_pdu.pl -H $HOSTADDRESS$ -C
> public 2>&1
> 
> That will redirect standard error to standard out.  Next time Nagios
> runs the script it will capture the full output of the script and you
> should see right in your Nagios ui, what the issue is.
> 
> Sun, Mar 27, 2011 at 2:45 PM, Peter Roddan
> <Peter.Roddan at sbsworldwide.com> wrote: 
> 
> 
> If I log onto the nagios server as the nagios user, and run the
> command from the libexec folder (check_apc_pdu –H <address> -C public)
> I get the response : 
> 
> “OK: All Outlets ok. | load=25”
> 
> I have put the following command definition in :
> 
> # 'check_apc_pdu' command definition
> 
> define command{
> 
> command_name              check_apc_pdu
> 
> command_line $USER1$/check_apc_pdu.pl -H $HOSTADDRESS$ -C public
> 
> }
> 
>  
> 
> And defined the following service 
> 
>  
> 
> define service{
> 
>                 use
> generic-service                ; Inherit values from a template
> 
>                 hostgroup_name
> apc         ; The name of the host the service is associated with
> 
>                 service_description
> check_apc                           ; The service description
> 
>                 check_command
> check_apc_pdu                 ; The command used to monitor the
> service
> 
>                 normal_check_interval 5                              ;
> Check the service every 5 minutes under normal conditions
> 
>                 retry_check_interval
> 1                              ; Re-check the service every minute
> until its final/hard state is determined
> 
>                 }
> 
>  
> 
>  
> 
> However, my APC PDUs report an error for this service, with  a status
> information of “(Null)”
> 
> I’d be grateful for anyone who could point me in the right direction
> of where I’m going wrong.
> 
>  
> 
> 
> 
> 
> 
> 
> -- 
> Mike Lindsey
> 
> 
> ________________________________________________________________________
> THE DRIVING FORCE BEHIND FREIGHT MANAGEMENT
> ________________________________________________________________________
> This email and any files transmitted with it are confidential and may
> be privileged or otherwise protected from disclosure. The email is
> intended solely for the use of the individual or entity to whom it is
> addressed and, if you are not the intended recipient, you must not
> copy this message or attachment or disclose the contents to any other
> person. If you have received this email in error please notify
> hostmaster at sbsworldwide.com
> 
> This e-mail has been scanned for all viruses by Messagelabs but no
> responsibility will be accepted by SBS Worldwide Group if the
> recipient’s computer system is corrupted by information transmitted
> from this computer system nor for any delays or problems arising out
> of or caused by any corruption.
> 
> All business is conducted strictly subject to SBS standard contract
> terms and conditions which are as follows:-
> 
> 1) Business transacted by SBS Worldwide Ltd (UK): British
> International Freight Association (BIFA) Standard Trading Conditions,
> latest edition
> 
> 2) Business transacted by SBS Worldwide Inc (USA): National Customs
> Brokers And Forwarders Association of America (NCBFAA) Terms &
> Conditions of Service, latest edition
> 
> Copies will be supplied on request or can be viewed on our website as
> follows:-
> 
> http://www.sbsworldwide.com/legals
> 
> All quotes , rates and surcharges are subject to market fluctuation.
> 
> SBS Worldwide Ltd registered in England No: 1739816
> 
> Registered Office: SBS Cargo Centre, Anchor Boulevard, Crossways,
> Dartford, Kent DA2 6SB, England
> 
> ________________________________________________________________________
> 
> ------------------------------------------------------------------------------
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> _______________________________________________ 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/20110407/00ff2f04/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 48202 bytes
Desc: image001.jpg
URL: <https://www.monitoring-lists.org/archive/users/attachments/20110407/00ff2f04/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <https://www.monitoring-lists.org/archive/users/attachments/20110407/00ff2f04/attachment.sig>
-------------- next part --------------
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
-------------- 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