AIX Memory Utilization -- Lpar
Posted: Fri Mar 03, 2017 1:47 pm
Hi Team,
I would need your help in getting the CPU utilization of lpar. as per the script, threshold for warning and critical will be different for server to server. So wanted to have this information in percentages. Is there a plugin that can help me get that information? Or attaching the script, could you please help me with this.
I would need your help in getting the CPU utilization of lpar. as per the script, threshold for warning and critical will be different for server to server. So wanted to have this information in percentages. Is there a plugin that can help me get that information? Or attaching the script, could you please help me with this.
Code: Select all
#!/bin/ksh93
#
# check_lpar_physc_cpu.sh
#
# This plugin checks LPAR Physical CPU usage
# Author: Bratislav STOJKOVIC
# E-mail:[email protected]
# Version: 0.1
# Last Modified: October 2013
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo 'Revision: 0.1'`
. $PROGPATH/utils.sh
print_usage() {
echo "Usage: $PROGNAME -w <warning_thr> -c <critical_thr>"
}
print_revision() {
echo $PROGNAME $REVISION
echo ""
echo "This plugin checks LPAR Physical CPU usage"
echo ""
exit 0
}
if [ $# -eq 1 ] && ([ "$1" == "-h" ] || [ "$1" == "--help" ]); then
print_usage
exit $STATE_UNKNOWN
elif [ $# -lt 4 ]; then
print_usage
exit $STATE_UNKNOWN
fi
while test -n "$1"; do
case "$1" in
--help)
print_usage
exit 0
;;
-h)
print_usage
exit 0
;;
-V)
print_revision $PROGNAME $REVISION
exit 0
;;
-w)
WARNING=$2
shift
;;
-c)
CRITICAL=$2
shift
;;
*)
echo "Unknown argument: $1"
print_usage
exit $STATE_UNKNOWN
;;
esac
shift
done
LPAR_PHYSC=``
/usr/bin/lparstat 1 1 | awk '{print $5}'| tail -1
if (( $LPAR_PHYSC > $CRITICAL )); then
echo "CRITICAL: $LPAR_PHYSC processor cores are busy.|Cores=$LPAR_PHYSC;$WARNING;$CRITICAL"
exit $STATE_CRITICAL
fi
if (( $LPAR_PHYSC > $WARNING )); then
echo "WARNING: $LPAR_PHYSC processor cores are busy.|Cores=$LPAR_PHYSC;$WARNING;$CRITICAL"
exit $LPAR_PHYSC
else
echo "OK: $LPAR_PHYSC processor cores are busy.|Cores=$LPAR_PHYSC;$WARNING;$CRITICAL"
exit $STATE_OK
fi