AIX Memory Utilization -- Lpar

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

AIX Memory Utilization -- Lpar

Post by raamardhani7 »

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.

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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: AIX Memory Utilization -- Lpar

Post by mcapra »

Can you share what this script outputs currently? I'm not super familiar with kornshell, but it should be some simple math that needs to be done on $LPAR_PHYSC before it gets added as performance data.
Former Nagios employee
https://www.mcapra.com/
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: AIX Memory Utilization -- Lpar

Post by raamardhani7 »

mcapra wrote:Can you share what this script outputs currently? I'm not super familiar with kornshell, but it should be some simple math that needs to be done on $LPAR_PHYSC before it gets added as performance data.

Hi Team,

Updated the details.

Code: Select all

 ./check_lpar_cpu -w 80 -c 90
OK: 0.03 processor cores are busy.|Cores=0.03;80;90

Code: Select all

./check_lpar_cpu -w 0.2 -c 03
OK: 0.02 processor cores are busy.|Cores=0.02;0.2;03

Code: Select all

/usr/bin/lparstat 1 1 | awk '{print $5}'| tail -1
0.02

Code: Select all

./check_lpar_cpu -w 0.001 -c 0.2
WARNING: 0.02 processor cores are busy.|Cores=0.02;0.001;0.2

Code: Select all

/usr/bin/lparstat 1 1 | awk '{print $5}'

smt=4

physc
-----
0.01
Please advise.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: AIX Memory Utilization -- Lpar

Post by mcapra »

Around lines 52, 56, and 70, you could probably multiply these respective variables by 100:

Code: Select all

52      WARNING=$2
56      CRITICAL=$2
70      #new line to multiply $LPAR_PHYSC
Or, if you wanted your thresholds to be whole-number percentages, you could just modify line 70. If you're interested in having us modify this plugin for you, please contact our sales department regarding custom development.
Former Nagios employee
https://www.mcapra.com/
Locked