Apr 10 2009

Monitor AS400 Resources with MRTG

Published by dave at 4:14 pm under AS400,Monitoring


It is recommended to monitor AS400 CPU load with OID .1.3.6.1.4.1.2.6.4.5.1.0 that returns a value based on 10,000. It needs then to be divided by 100 to get a percentage.
The 2nd disadvantage is that the result is slightly wrong, the integer part only being returned.
OID HOST-RESOURCES-MIB::hrProcessorLoad.2 from an IBM i5 520 gives the correct value in percentage.

For instance:

mrtg@server:~> snmpwalk -c $COMMUNITY -v1 $I5IP .1.3.6.1.4.1.2.6.4.5.1.0; \
snmpwalk -c $COMMUNITY -v1 $I5IP .1.3.6.1.2.1.25.3.3.1.2.2
SNMPv2-SMI::enterprises.2.6.4.5.1.0 = Gauge32: 2380
HOST-RESOURCES-MIB::hrProcessorLoad.2 = INTEGER: 24

 
MRTG configuration is:

# Standard method displays twice the same value
# Target[AS400.cpu]:.1.3.6.1.2.1.25.3.3.1.2.2&.1.3.6.1.2.1.25.3.3.1.2.2:COMMUNITY@IP
# Or via a script as described here
Target[AS400.cpu]:`/home/mrtg/get-as400-cpu.sh IP COMMUNITY 1`
RouterUptime[AS400.cpu]: COMMUNITY@IP
MaxBytes[AS400.cpu]: 100
Title[AS400.cpu]: AS400 CPU Load
PageTop[AS400.cpu]: <H1>AS400 CPU Load</H1>
Unscaled[AS400.cpu]: ymwd
ShortLegend[AS400.cpu]: %
YLegend[AS400.cpu]: CPU Utilization
Legend1[AS400.cpu]: Active CPU Load
LegendI[AS400.cpu]: CPU
Options[AS400.cpu]: growright,nopercent,gauge
Colours[AS400.cpu]: RED#e13c13,RED#e13c13,RED#e13c13,RED#e13c13

# Same for memory usage
Target[AS400.mem]:`/home/mrtg/get-as400-memory.sh IP COMMUNITY 1`
RouterUptime[AS400.mem]: COMMUNITY@IP
MaxBytes[AS400.mem]: 12129927168
Title[AS400.mem]: AS400 Memory Usage
PageTop[AS400.mem]: <H1>AS400 Memory Usage</H1>
Unscaled[AS400.mem]: ymwd
YLegend[AS400.mem]: Memory Usage
Legend1[AS400.mem]: Memory Usage
LegendI[AS400.mem]: Memory
Options[AS400.mem]: growright,nopercent,gauge
Colours[AS400.mem]: ORANGE#F88017,ORANGE#F88017,ORANGE#F88017,ORANGE#F88017

 
MaxBytes, max amount of memory, can be retrieved with snmpwalk (in KB):
expr `snmpwalk -v1 -c $COMMUNITY $IP hrMemorySize.0 | awk ‘{ print $(NF-1) }’` \* 1024

MRTG Memory Usage
 
Here’s the script to compute memory usage from SNMP values (from Cacti forum):

#!/bin/sh
IP=$1
COMMUNITY=$2
SNMP_VERSION=$3
# RAM used
NB_ELEMENTS=`snmpwalk -v $SNMP_VERSION -c $COMMUNITY $IP hrStorageIndex \
| awk '{ print $NF }' | tail -n 1`

RAM_USED=0

for i in `seq 1 $NB_ELEMENTS`; do
  TYPE_ELEMENT=`snmpget -v $SNMP_VERSION -c $COMMUNITY $IP hrStorageDescr.$i \
  | awk '{ print $NF }'`
  if [ "$TYPE_ELEMENT" != "RAM" ]; then
    continue
  fi

  BLOCK_SIZE=`snmpget -v $SNMP_VERSION -c $COMMUNITY $IP hrStorageAllocationUnits.$i \
  | awk '{ print $(NF-1) }'`
  NB_BLOCKS_USED=`snmpget -v $SNMP_VERSION -c $COMMUNITY $IP hrStorageUsed.$i \
  | awk '{ print $NF }'`
  RAM_USED=`expr $NB_BLOCKS_USED \* $BLOCK_SIZE`
  TOTAL_RAM_USED=`expr $TOTAL_RAM_USED + $RAM_USED`
done

TOTAL_RAM_USED=`expr $TOTAL_RAM_USED`

echo $TOTAL_RAM_USED
echo $TOTAL_RAM_USED

 


2 responses so far

2 Responses to “Monitor AS400 Resources with MRTG”

  1. JamesMAon 05 Jul 2011 at 3:41 am

    I’ve just stubled upon this site as400-news.com, could I just borrow the technical
    data from the web site or do I need special permission?. I’m writing a project for school.

    James

  2. daveon 06 Jul 2011 at 4:46 pm

    No problem, some piece of information was found on the net as well

Comments RSS

Leave a Reply

Security Code: