Home Directory Plugins Hardware UPS APC check_apc_pdu_load.sh

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_apc_pdu_load.sh

Rating
1 vote
Favoured:
0
Current Version
1.0.0.1
Last Release Date
2012-10-24
Compatible With
  • Nagios 2.x
  • Nagios 3.x
License
GPL
Hits
59893
Files:
FileDescription
check_apc_pdu_load.shBash script.
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
check_apc_pdu_load.sh
Nagios Plugin to check PDU APC Load

Usage: check_apc_pdu_load.sh [-H hostname] [-c communauty] [-w warning] [-c critical]
-H Hostname "
-C (default public) communauty
-w (optional) warning threshold "
-c (optional) critical threshold "

Use base PDU 10Amps default value critical is 10amps and default value for Warrning is 8 Amps.

Good use,
After some research, there is no script performing of a load test on system power switch (PDU).

This script references the charge status of an APC PDU. Please feedback....

Usage: check_apc_pdu_load.sh [-H hostname] [-c communauty] [-w warning] [-c critical]
-H Hostname "
-C (default public) communauty
-w (optional) warning threshold "
-c (optional) critical threshold "


Good use,
Reviews (1)
#!/bin/bash
#
# Program : check_apc_pdu_load
# :
# Author : Deraoui Sa?d
# 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=100
fi

if [ "$CRITICALNUMBER" = "" ]; then
CRITICALNUMBER=80
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=$STATE_OK
ULOAD=`echo "scale=2; ${LOAD}/10" | bc`
WARNINGNUMBER=`echo "scale=2; ${WARNINGNUMBER}/10" | bc`
CRITICALNUMBER=`echo "scale=2; ${CRITICALNUMBER}/10" | bc`
MSG="OK: ${ULOAD} Amps of load|amp=${ULOAD};${WARNINGNUMBER};${CRITICALNUMBER}"
elif [ $LOAD -lt $CRITICALNUMBER ]; then
exitstatus=$STATE_WARNING
ULOAD=`echo "scale=2; ${LOAD}/10" | bc`
WARNINGNUMBER=`echo "scale=2; ${WARNINGNUMBER}/10" | bc`
CRITICALNUMBER=`echo "scale=2; ${CRITICALNUMBER}/10" | bc`
MSG="WARNING: ${ULOAD} Amps of load PDU, please check.|amp=${ULOAD};${WARNINGNUMBER};${CRITICALNUMBER}"
elif [ $LOAD -ge $CRITICALNUMBER ]; then
exitstatus=$STATE_CRITICAL
ULOAD=`echo "scale=2; ${LOAD}/10" | bc`
WARNINGNUMBER=`echo "scale=2; ${WARNINGNUMBER}/10" | bc`
CRITICALNUMBER=`echo "scale=2; ${CRITICALNUMBER}/10" | bc`
MSG="CRITICAL: ${ULOAD} Amps of load PDU. |amp=${ULOAD};${WARNINGNUMBER};${CRITICALNUMBER}"

else

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

echo $MSG
exit $exitstatus