<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY LINK="#0000ff" BGCOLOR="#ffffff">
in nagios execute it like this:<BR>
<BR>
<FONT COLOR="#ff0000">perl</FONT> /usr/local/nagios/libexec/check_apc_pdu.pl<BR>
^<BR>
|---- 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. <BR>
<BR>
On Wed, 2011-04-06 at 15:35 +0100, Peter Roddan wrote:
<BLOCKQUOTE TYPE=CITE>
    Hi Mike,<BR>
    <BR>
     <BR>
    <BR>
    Thanks very much for your help.<BR>
    <BR>
    I’ve changed the below, and I now get the following as the Nagios Status Information.<BR>
    <BR>
     <BR>
    <BR>
    /usr/local/nagios/libexec/check_apc_pdu.pl: line 24: use: command not found<BR>
    /usr/local/nagios/libexec/check_apc_pdu.pl: line 25: use: command not found<BR>
    /usr/local/nagios/libexec/check_apc_pdu.pl: line 26: use: command not found<BR>
    /usr/local/nagios/libexec/check_apc_pdu.pl: line 27: syntax error near unexpected token `('<BR>
    /usr/local/nagios/libexec/check_apc_pdu.pl: line 27: `use utils qw($TIMEOUT %ERRORS &print_revision &support);'<BR>
    <BR>
     <BR>
    <BR>
    So I guess there’s a problem with the script after all.<BR>
    <BR>
    Strange, as it works when I run it from the command line as the nagios user.<BR>
    <BR>
     <BR>
    <BR>
    Back to the drawing board with that one I suppose!<BR>
    <BR>
     <BR>
    <BR>
    Thanks,<BR>
    <BR>
     <BR>
    <BR>
    Peter.<BR>
    <BR>
     <BR>
    <BR>
     <BR>
    <BR>
     <BR>
    <BR>
     <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <B>Peter Roddan</B><BR>
    Senior Systems Analyst <BR>
    <BR>
    <B>SBS Worldwide Ltd - Dartford </B><BR>
    DDI No: +44 (0)1322 424741<BR>
    Email :<A HREF="mailto:Peter.Roddan@sbsworldwide.com">Peter.Roddan@sbsworldwide.com</A><BR>
    Website :<A HREF="http://sbsworldwide.com">sbsworldwide.com</A><BR>
    <BR>
    <IMG SRC="cid:image001.jpg@01CBF470.444E0770" WIDTH="334" HEIGHT="108" ALIGN="bottom" ALT="Description: http://www.sbsworldwide.com/_images/signatures/sig_logo.jpg" BORDER="0"><BR>
    <BR>
    P  Think before you print!<BR>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
     <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <B>From:</B> Mike Lindsey [mailto:mike-nagios@5dninja.net] <BR>
    <B>Sent:</B> 05 April 2011 20:23<BR>
    <B>To:</B> Nagios Users List<BR>
    <B>Cc:</B> Peter Roddan<BR>
    <B>Subject:</B> Re: [Nagios-users] Check_APC_PDU Command Definition<BR>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
     <BR>
    <BR>
    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.<BR>
    <BR>
    But it's easy to figure out what's going on.  Simply change your command_line to:<BR>
        command_line    $USER1$/check_apc_pdu.pl -H $HOSTADDRESS$ -C public 2>&1<BR>
    <BR>
    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.<BR>
    <BR>
    Sun, Mar 27, 2011 at 2:45 PM, Peter Roddan <<A HREF="mailto:Peter.Roddan@sbsworldwide.com">Peter.Roddan@sbsworldwide.com</A>> wrote: <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    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 : <BR>
    <BR>
    “OK: All Outlets ok. | load=25”<BR>
    <BR>
    I have put the following command definition in :<BR>
    <BR>
    # 'check_apc_pdu' command definition<BR>
    <BR>
    define command{<BR>
    <BR>
    command_name              check_apc_pdu<BR>
    <BR>
    command_line $USER1$/<A HREF="http://check_apc_pdu.pl">check_apc_pdu.pl</A> -H $HOSTADDRESS$ -C public<BR>
    <BR>
    }<BR>
    <BR>
     <BR>
    <BR>
    And defined the following service <BR>
    <BR>
     <BR>
    <BR>
    define service{<BR>
    <BR>
                    use                                         generic-service                ; Inherit values from a template<BR>
    <BR>
                    hostgroup_name                             apc         ; The name of the host the service is associated with<BR>
    <BR>
                    service_description        check_apc                           ; The service description<BR>
    <BR>
                    check_command                              check_apc_pdu                 ; The command used to monitor the service<BR>
    <BR>
                    normal_check_interval 5                              ; Check the service every 5 minutes under normal conditions<BR>
    <BR>
                    retry_check_interval      1                              ; Re-check the service every minute until its final/hard state is determined<BR>
    <BR>
                    }<BR>
    <BR>
     <BR>
    <BR>
     <BR>
    <BR>
    However, my APC PDUs report an error for this service, with  a status information of “(Null)”<BR>
    <BR>
    I’d be grateful for anyone who could point me in the right direction of where I’m going wrong.<BR>
    <BR>
     <BR>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
    <BR>
<PRE>
-- 
Mike Lindsey
</PRE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
    ________________________________________________________________________<BR>
    THE DRIVING FORCE BEHIND FREIGHT MANAGEMENT<BR>
    ________________________________________________________________________<BR>
    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@sbsworldwide.com<BR>
    <BR>
    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.<BR>
    <BR>
    All business is conducted strictly subject to SBS standard contract terms and conditions which are as follows:-<BR>
    <BR>
    1) Business transacted by SBS Worldwide Ltd (UK): British International Freight Association (BIFA) Standard Trading Conditions, latest edition<BR>
    <BR>
    2) Business transacted by SBS Worldwide Inc (USA): National Customs Brokers And Forwarders Association of America (NCBFAA) Terms & Conditions of Service, latest edition<BR>
    <BR>
    Copies will be supplied on request or can be viewed on our website as follows:-<BR>
    <BR>
    http://www.sbsworldwide.com/legals<BR>
    <BR>
    All quotes , rates and surcharges are subject to market fluctuation.<BR>
    <BR>
    SBS Worldwide Ltd registered in England No: 1739816<BR>
    <BR>
    Registered Office: SBS Cargo Centre, Anchor Boulevard, Crossways, Dartford, Kent DA2 6SB, England<BR>
    <BR>
    ________________________________________________________________________
<PRE>
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
<A HREF="http://p.sf.net/sfu/verizon-sfdev">http://p.sf.net/sfu/verizon-sfdev</A>
_______________________________________________ Nagios-users mailing list <A HREF="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</A> <A HREF="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</A> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>