Need a sanity check with pdu plug-in

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Rob.H
Posts: 5
Joined: Tue Mar 31, 2015 3:09 pm

Need a sanity check with pdu plug-in

Post by Rob.H »

Hoping to get another pair of eyes on this as I am a struggling to figure this one out. I recently added an APC PDU load script from https://exchange.nagios.org/directory/P ... s#rev-1648 to my Nagios Xi installation and am having trouble getting it to work. After several failed command and service configuration tests, I decided to look at the script's code to see where the potential hang up could be. Here is the script's code.

Code: Select all

#!/bin/bash
#
#    Program : check_apc_pdu_load
#            :
#     Author : Deraoui Saïd <[email protected]>
#    Purpose : Nagios plugin to return Information from APC PDU Load status
#            :
# Parameters : --help
#            : --version
#            :
#    Returns : Standard Nagios status_* codes as defined in utils.sh
#            :
#    Licence : GPL
#
#      Notes : See --help for details
#============:==============================================================

PROGNAME=`basename $0`
PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 1.0.0.1 $' | sed -e 's/[^0-9.]//g'`


. $PROGPATH/utils.sh

print_usage() {
        echo "Usage: $PROGNAME [-H hostname] [-c communauty] [-w warning] [-c critical]"
	echo "		-H	Hostname"
        echo "		-C	Communauty"
        echo "		-w	(optional) warning threshold"
        echo "		-c	(optional) critical threshold"
	echo ""
	echo ""
        echo "Usage: $PROGNAME --help"
        echo "Usage: $PROGNAME --version"
}

print_help() {
        print_revision $PROGNAME $REVISION
        echo ""
        echo "Nagios Plugin to check PDU APC Load"
        echo ""
        print_usage
        echo ""
        echo "PDU APC Load Status Check. © Deraoui Said 2012"
        echo ""
        exit 0
#        support
}

# If we have arguments, process them.
#
exitstatus=$STATE_WARNING #default
while test -n "$1"; do
        case "$1" in
                --help)
                        print_help
                        exit $STATE_OK
                        ;;
                -h)
                        print_help
                        exit $STATE_OK
                        ;;
                --version)
                        print_revision $PROGNAME $REVISION
                        exit $STATE_OK
                        ;;
                -V)
                        print_revision $PROGNAME $REVISION
                        exit $STATE_OK
                        ;;

                -H)
                    REMOTEHOST=$2;
                    shift;
                    ;;
                -C) COMMUNAUTY=$2;
                    shift;
                    ;;
                -c)
                    CRITICALNUMBER=$2
                    shift;
                    ;;
                -w)
                    WARNINGNUMBER=$2;
                    shift;
                ;;

                *)
                        echo "Unknown argument: $1"
                        print_usage
                        exit $STATE_UNKNOWN
                        ;;
        esac
        shift
done

if [ "${REMOTEHOST}" = "" ]; then
	echo "UNKNOWN: Please check hostname"
	exit $STATUS_UNKNOW
fi
if [ "${COMMUNAUTY}" = "" ]; then
	COMMUNAUTY=public
fi

if [ "$WARNINGNUMBER" = "" ]; then
	WARNINGNUMBER=10
fi

if [ "$CRITICALNUMBER" = "" ]; then
	CRITICALNUMBER=8
fi

LOAD=`snmpwalk -v2c -c ${COMMUNAUTY} ${REMOTEHOST} SNMPv2-SMI::enterprises.318.1.1.12.2.3.1.1.2.1 | awk '/Gauge32:/ {print $4}'`

if [ "$LOAD" = "" ]; then
		echo "UNKNOWN: Unable to get load from PDU"
		exit $STATUS_UNKNOWN
	fi

	if [ $LOAD -lt $WARNINGNUMBER ]; then
		exitstatus=$STATU_OK
		ULOAD=`echo "scale=2; ${LOAD}/10" | bc`
		MSG="OK: ${ULOAD} Amps of load"
	elif [ $LOAD -lt $CRITICALNUMBER ]; then
		exitstatus=$STATU_WARNING
		ULOAD=`echo "scale=2; ${LOAD}/10" | bc`
		MSG="WARNING: ${ULOAD} Amps of load PDU, please check."
	elif [ $LOAD -ge $CRITICALNUMBER ]; then
		exitstatus=$STATU_CRITICAL
		ULOAD=`echo "scale=2; ${LOAD}/10" | bc`
		MSG="CRITICAL: ${ULOAD} Amps of load PDU."

else

        echo="CRITICAL: Unknown command"
        print_help
        exitstatus=$STATE_CRITICAL
fi

echo $MSG
exit $exitstatus

Having read through this, I am under the impression that this plugin only supports SNMPv2c calls to the target devices. Am I correct in this assessment? It certainly would explain why I am unable to pull a response from my PDUs as they only support SNMPv1 and v3. Thanks in advance for your help.

- Rob
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Need a sanity check with pdu plug-in

Post by jdalrymple »

You can change the version of snmp used just by changing the -v argument from 2c to 1.

You could test your device by just doing an snmpwalk -v2c -c <community> <apc_pdu_IP> from the command line. I just tested one of my APC UPSes with -v2c and it worked fine.

Either way, post the output of that snpwalk command (or at least the head) so we can troubleshoot.
Rob.H
Posts: 5
Joined: Tue Mar 31, 2015 3:09 pm

Re: Need a sanity check with pdu plug-in

Post by Rob.H »

Thank you for the feedback. To my surprise, running an snmpwalk from both the console and Nagios XI GUI against one of my PDUs worked just fine using v2c (see snippet below). This despite the total lack of any v2c options on the PDU management portal.

Code: Select all

[root@localhost ~]# snmpwalk -v2c -c <community> <deviceIP>
SNMPv2-MIB::sysDescr.0 = STRING: APC Web/SNMP Management Card (MB:v3.8.6 PF:v3.5.8 PN:apc_hw02_aos_358.bin AF1:v3.5.7 AN1:apc_hw02_rpdu_357.bin MN:AP7991 HR:B2 SN: ZA0909005093 MD:02/27/2009) 
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.318.1.3.4.5
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (6754010) 18:45:40.10
Armed with this new found insight, I decided to test the check_apc_ups plugin directly at the console as well. After a few attempts, I found that running ./check_apc_pdu.pl -H <hostname> -C <community_string> would successfully return "OK: All Outlets ok. |load=15". However, configuring the command and associated service within Nagios wasn't nearly as fruitful.

When running a test via the Test Command option in the Service Configuration window, the returned output is blank. Additionally, when the service check is configured and run against a host, the Service Status returns

Code: Select all

"(No output on stdout) stderr: Can't locate utils.pm in @INC (@INC contains: nagios/plugins /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/nagios/li"
I'm assuming I've done something wrong in the setup of my command and/or service so again, any feedback you can provide is very much appreciated.

Here are the details of the command and service definitions. Note: The hostname and community string have been removed for obvious reasons. I can assure you the hostname and community string are spelled correctly.

Command

define command {
command_name check_apc_pdu
command_line $USER1$/check_apc_pdu.pl -H $HOSTADDRESS$ $ARG1$
}

Service

###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.3.3
# Date: 2015-07-30 14:39:09
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
host_name <hostname>
service_description APC PDU Check
hostgroup_name apc-pdus
check_command check_apc_pdu!-C <community_string>!!!!!!!
max_check_attempts 10
check_interval 5
retry_interval 1
check_period 24x7
notification_period 24x7
notifications_enabled 0
register 1
}

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Need a sanity check with pdu plug-in

Post by Box293 »

Your command and service definitions look good.
Rob.H wrote: I decided to test the check_apc_ups plugin directly at the console as well. After a few attempts, I found that running ./check_apc_pdu.pl -H <hostname> -C <community_string> would successfully return "OK: All Outlets ok. |load=15".
Can you re-run that test as the nagios user please.

Code: Select all

su nagios
./check_apc_pdu.pl -H <hostname> -C <community_string>
Using the Test Check Command button runs as the user apache, which is different to the user nagios which the monitoring engine runs as. This is what I have asked you to re-test as nagios, because you were previously probably running as root.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Rob.H
Posts: 5
Joined: Tue Mar 31, 2015 3:09 pm

Re: Need a sanity check with pdu plug-in

Post by Rob.H »

You are correct, I did run the console command as root.

Running the same command as user nagios yielded the same successful result as the root user. When I attempted to sudo into the apache user from root, I received an error stating "This account is currently not available." I should point out that the script was imported via the Nagios XI GUI import tool. As such, the script permissions were assigned to apache/apache. And just in case it is relevant, my Nagios XI instance was built using the OVF template download available at the main website.

Thanks for all of your help.

- Rob
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Need a sanity check with pdu plug-in

Post by jdalrymple »

Is it possible that you have a script mismatch somewhere?

This indicates a perl script:
Rob.H wrote:

Code: Select all

define command {
command_name check_apc_pdu
command_line $USER1$/check_apc_pdu.pl -H $HOSTADDRESS$ $ARG1$
}
As does this:
Rob.H wrote:"(No output on stdout) stderr: Can't locate utils.pm in @INC (@INC contains: nagios/plugins /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/nagios/li"
But you showed us a bash script:
Rob.H wrote:

Code: Select all

#!/bin/bash
#
#    Program : check_apc_pdu_load
#            :
#     Author : Deraoui Saïd <[email protected]>
#    Purpose : Nagios plugin to return Information from APC PDU Load status
#            :
# Parameters : --help
#            : --version
#            :
#    Returns : Standard Nagios status_* codes as defined in utils.sh
#            :
#    Licence : GPL
#
#      Notes : See --help for details
#============:==============================================================

PROGNAME=`basename $0`
PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 1.0.0.1 $' | sed -e 's/[^0-9.]//g'`
...
Rob.H
Posts: 5
Joined: Tue Mar 31, 2015 3:09 pm

Re: Need a sanity check with pdu plug-in

Post by Rob.H »

My apologies. Somehow I managed to provide the code for a script I'm not using. :oops:

Here is the correct script's code.

Code: Select all

#! /usr/bin/perl -w
#
# check_apc_pdu.pl - nagios plugin
#
#
# Copyright (C) 2007 Marius Rieder <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#

use POSIX;
use strict;
use lib "nagios/plugins" ;
use utils qw($TIMEOUT %ERRORS &print_revision &support);

use Net::SNMP;
use Getopt::Long;
Getopt::Long::Configure('bundling');

my $PROGNAME = "check_apc_pdu";
my $VERSION  = "v1.0";

sub print_help ();
sub usage ();
sub process_arguments ();
sub snmp_connect();

my $status;
my %loadState = ('1'=>'phaseLoadNormal',
                 '2'=>'phaseLoadLow',
		 '3'=>'phaseLoadNearOverload',
		 '4'=>'phaseLoadOverload');

my $timeout ;
my $state = "UNKNOWN";
my $answer = "";
my $snmpkey=0;
my $snmpoid=0;
my $key = 0;
my $community = "public";
my $maxmsgsize = 1472 ; # Net::SNMP default is 1472
my ($seclevel, $authproto, $secname, $authpass, $privpass, $auth, $priv, $context);
my $port = 161;
my @snmpoids;
my $rPDUOutletStatusOutletName = '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.2';
my $rPDUOutletStatusOutletState = '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.4';
my $rPDULoadStatus = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1';
my $rPDUPowerSupplyDevice = '.1.3.6.1.4.1.318.1.1.12.4.1';
my $hostname;
my $session;
my $error;
my $response;
my %outletStatus;
my %outletMask;
my $snmp_version = 1;
my $opt_h ;
my $opt_V ;
my $opt_o ;
my $opt_a ;

# Just in case of problems, let's not hang Nagios
$SIG{'ALRM'} = sub {
     print ("ERROR: No snmp response from $hostname (alarm timeout)\n");
     exit $ERRORS{"UNKNOWN"};
};

#Option checking
$status = process_arguments();

if ($status != 0)
{
	print_help() ;
	exit $ERRORS{'OK'};
}

alarm($timeout);

# Opening SNMP Session
snmp_connect();

push(@snmpoids,$rPDUOutletStatusOutletName);
push(@snmpoids,$rPDUOutletStatusOutletState);
push(@snmpoids,$rPDULoadStatus);
push(@snmpoids,$rPDUPowerSupplyDevice);

foreach $snmpoid (@snmpoids) {
   if ( $snmp_version =~ /3/ ) {
      if (!defined($response = $session->get_table($snmpoid, -contextname => $context))) {
	 $answer=$session->error;
	 $session->close;
	 $state = 'CRITICAL';
	 print ("$state: $answer for $snmpoid\n");
	 exit $ERRORS{$state};
      }
   } else {
      if (!defined($response = $session->get_table($snmpoid))) {
	 $answer=$session->error;
         $session->close;
         $state = 'CRITICAL';
         print ("$state: $answer for $snmpoid\n");
         exit $ERRORS{$state};
      }
   }

   foreach $snmpkey (keys %{$response}) {
      $snmpkey =~ /^$snmpoid\.(\d+).*$/;
      $key = $1;
      $outletStatus{$key}{$snmpoid} = $response->{$snmpkey};
   }
}

$session->close;
alarm(0);

$state = 'OK';

if ($outletStatus{1}{$rPDUPowerSupplyDevice} eq 2) {
   $state = 'CRITICAL';
   $answer = ' Supply1 Failed!';
} elsif ($outletStatus{2}{$rPDUPowerSupplyDevice} eq 2) {
   $state = 'CRITICAL';
   $answer = ' Supply2 Failed!';
}

if ($outletStatus{3}{$rPDULoadStatus} eq 3) {
   $state = 'WARNING';
   $answer = 'Near Overload '.$outletStatus{2}{$rPDULoadStatus}.'A';
} elsif ($outletStatus{3}{$rPDULoadStatus} eq 4) {
   $state = 'CRITICAL';
   $answer = 'Overload! '.$outletStatus{2}{$rPDULoadStatus}.'A';
}

foreach $key (sort keys %outletStatus) {
   if (!%outletMask) {
      if (!$outletStatus{$key}{$rPDUOutletStatusOutletState}) {
	 $answer .= " ".$outletStatus{$key}{$rPDUOutletStatusOutletName}.'is off!';
	 $state = 'CRITICAL';
      }
   } elsif (exists $outletMask{$key})  {
      if ( $outletMask{$key} ne $outletStatus{$key}{$rPDUOutletStatusOutletState} ) {
	 $answer .= " ".$outletStatus{$key}{$rPDUOutletStatusOutletName};
	 $answer .= $outletStatus{$key}{$rPDUOutletStatusOutletState} ? ' is on!' : ' is off!';
	 $state = 'CRITICAL';
      }
      delete $outletMask{$key};
   } elsif (exists $outletMask{$outletStatus{$key}{$rPDUOutletStatusOutletName}})  {
      if ( $outletMask{$outletStatus{$key}{$rPDUOutletStatusOutletName}} ne $outletStatus{$key}{$rPDUOutletStatusOutletState} ) {
         $answer .= " ".$outletStatus{$key}{$rPDUOutletStatusOutletName};
         $answer .= $outletStatus{$key}{$rPDUOutletStatusOutletState} ? ' is on!' : ' is off!';
         $state = 'CRITICAL';
      }
      delete $outletMask{$outletStatus{$key}{$rPDUOutletStatusOutletName}};
   }
}

foreach $key (sort keys %outletMask) {
   $answer .= " Outlet $key not found.";
   $state = $state == 'CRITICAL' ? 'CRITICAL' : 'WARNING';
}

if (!$answer) {
   $answer = ' All Outlets ok.';
}

my $perfdata = sprintf("load=%d", $outletStatus{2}{$rPDULoadStatus});

print ("$state:$answer |$perfdata\n");
exit $ERRORS{$state};

sub usage (){
        printf "\nMissing arguments!\n";
        printf "\n";
        printf "check_apc_pdu -H <HOSTNAME> [-C <READCOMMUNITY>] [-p <PORT>]\n";
        printf "Copyright (C) 2007 Marius Rieder <marius.rieder\@inf.ethz.ch>\n";
        printf "\n\n";
        support();
        exit $ERRORS{"UNKNOWN"};
}

sub print_help (){
	printf "check_apc_pdu plugin for Nagios monitors operational \n";
	printf "status and load of a apc pdu\n";
	printf "\nUsage:\n";
	printf "   -H (--hostname)   Hostname to query - (required)\n";
	printf "   -C (--community)  SNMP read community (defaults to public,\n";
	printf "   -v (--snmp_version)  1 for SNMP v1 (default)\n";
	printf "                        3 for SNMPv3 (requires -U option)\n";
	printf "   -p (--port)       SNMP port (default 161)\n";
	printf "   -o (--on)         Outlets (name or number) must be on\n";
	printf "   -O (--off)        Outlets (name or number) must be off\n";
	printf "   -t (--timeout)    seconds before the plugin times out (default=$TIMEOUT)\n";
	printf "   -L (--seclevel)   choice of \"noAuthNoPriv\", \"authNoPriv\", or	\"authPriv\"\n";
	printf "   -U (--secname)    username for SNMPv3 context\n";
	printf "   -c (--context)    SNMPv3 context name (default is empty string)\n";
	printf "   -A (--authpass)   authentication password (cleartext ascii)\n";
	printf "   -a (--authproto)  Authentication protocol ( MD5 or SHA1)\n";
	printf "   -X (--privpass)   privacy password (cleartext ascii)\n";
	printf "   -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n";
	printf "   -V (--version)    Plugin version\n";
	printf "   -h (--help)       usage help \n\n";
	print_revision($PROGNAME, $VERSION);
}

sub process_arguments() {
	$status = GetOptions(
	"V"   => \$opt_V, "version"    => \$opt_V,
	"h"   => \$opt_h, "help"       => \$opt_h,
	"p=i" => \$port,  "port=i"     => \$port,
	"H=s" => \$hostname, "hostname=s" => \$hostname,
	"o=s"   => \$opt_o, "on=s"         => \$opt_o,
	"O=s"   => \$opt_a, "off=s"        => \$opt_a,
	"v=i" => \$snmp_version, "snmp_version=i"  => \$snmp_version,
	"C=s" => \$community,"community=s" => \$community,
	"L=s" => \$seclevel, "seclevel=s" => \$seclevel,
	"a=s" => \$authproto, "authproto=s" => \$authproto,
	"U=s" => \$secname,   "secname=s"   => \$secname,
	"A=s" => \$authpass,  "authpass=s"  => \$authpass,
	"X=s" => \$privpass,  "privpass=s"  => \$privpass,
	"c=s" => \$context,   "context=s"   => \$context,
	"M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
	"t=i" => \$timeout,    "timeout=i" => \$timeout,
	);

	if ($status == 0){
		print_help() ;
		exit $ERRORS{'OK'};
	}

	if ($opt_V) {
		print_revision($PROGNAME, $VERSION);
		exit $ERRORS{'OK'};
	}

	if ($opt_h) {
		print_help();
		exit $ERRORS{'OK'};
	}

	unless (defined $timeout) {
	   $timeout = $TIMEOUT;
	}

	if ($snmp_version =~ /3/ ) {
	   # Must define a security level even though default is noAuthNoPriv
	   # v3 requires a security username

	   if (defined $seclevel  && defined $secname) {
	      # Must define a security level even though defualt is noAuthNoPriv
	      unless ($seclevel eq 'authNoPriv' ) {
		 print ":$seclevel:\n";
		 usage();
		 exit $ERRORS{"UNKNOWN"};
	      }

	      # Authentication wanted
	      if ($seclevel eq ('authNoPriv' || 'authPriv') ) {

		 unless ($authproto eq ('MD5' || 'SHA1') ) {
		    usage();
		    exit $ERRORS{"UNKNOWN"};
		 }

		 if ( !defined $authpass) {
		    usage();
		    exit $ERRORS{"UNKNOWN"};
		 }
	      }

	      # Privacy (DES encryption) wanted
	      if ($seclevel eq  'authPriv' ) {

		 if (! defined $privpass) {
		    usage();
		    exit $ERRORS{"UNKNOWN"};
		 }
	      }

	      unless ( defined $context) {
		 $context = "";
	      }
	   } else {
	      usage();
	      exit $ERRORS{"UNKNOWN"};
	   }
	} #end snmpv3

	unless ( defined $community ) {
	   $community = 'public';
	}

	if ($opt_o) {
	   map { $outletMask{$_}=1 } split(/\,/, $opt_o);
	}

	if ($opt_a) {
	   map { $outletMask{$_}=0 } split(/\,/, $opt_a);
	}

	unless (defined $timeout) {
		$timeout = $TIMEOUT;
	}

	if (! utils::is_hostname($hostname)){
		usage();
		exit $ERRORS{"UNKNOWN"};
	}
}

sub snmp_connect() {
   if ( $snmp_version =~ /3/ ) {
      if ($seclevel eq 'noAuthNoPriv') {
         ($session, $error) = Net::SNMP->session(
               -hostname  => $hostname,
               -port      => $port,
               -version  => $snmp_version,
               -username => $secname,
            );
      }elsif ( $seclevel eq 'authNoPriv' ) {
         ($session, $error) = Net::SNMP->session(
               -hostname  => $hostname,
               -port      => $port,
               -version  => $snmp_version,
               -username => $secname,
               -authprotocol => $authproto,
               -authpassword => $authpass
            );
      }elsif ($seclevel eq 'authPriv' ) {
         ($session, $error) = Net::SNMP->session(
               -hostname  => $hostname,
               -port      => $port,
               -version  => $snmp_version,
               -username => $secname,
               -authprotocol => $authproto,
               -authpassword => $authpass,
               -privpassword => $privpass
            );
      }
   } else {
      ($session, $error) = Net::SNMP->session(
            -hostname   => $hostname,
            -community  => $community,
            -port       => $port,
            -version    => $snmp_version,
         );
   }

   if (!defined($session)) {
      $state='UNKNOWN';
      $answer=$error;
      print ("$state: $answer");
      exit $ERRORS{$state};
   }
}
Rob.H
Posts: 5
Joined: Tue Mar 31, 2015 3:09 pm

Re: Need a sanity check with pdu plug-in

Post by Rob.H »

Hey everyone. I managed to figure out the cause the problem with a little help from Google. Despite the script being loaded into the default location for NagiosXI scritps, the check_apc_pdu.pl script still needed to be modified with the actual path. Changing this line...

Code: Select all

use lib "nagios/plugins" ;
...to this...

Code: Select all

use lib "/usr/local/nagios/libexec" ;
...allowed the script to run properly within Nagios. This change explicitly points out where the script is stored on the server. In my case, I am using the default location.

Big thanks to everyone who chimed in on this post and to the author of the blog post below for helping me get over the final hurdle. :D

https://viewsby.wordpress.com/2014/02/2 ... pm-in-inc/
Locked