Wednesday, February 23, 2011

Monitoring Disk Usage on AS400 V6R1 using SNMPv1

#!/bin/sh

IP=$1
COMMUNITY="public"
SNMP_VERSION="1"

DISK_SIZE=`snmpwalk -v $SNMP_VERSION -c $COMMUNITY $IP .1.3.6.1.2.1.25.2.3.1.5.1 | awk '{ print $NF }' | tail -n 1`

DISK_USED=`snmpwalk -v $SNMP_VERSION -c $COMMUNITY $IP .1.3.6.1.2.1.25.2.3.1.6.1 | awk '{ print $NF }' | tail -n 1`

if [ $DISK_SIZE -lt 0 ]
then
        DISK_SIZE=$((DISK_SIZE+2**32))
fi

echo `expr $DISK_USED \* 10000 / $DISK_SIZE`

No comments:

Post a Comment