[Xymon] Memory utilization reporting for HP-UX 11.31 ia64
innate.ideas
innate.ideas at gmail.com
Wed Mar 9 03:48:02 CET 2011
Here is an updated script we use to report memory utilization on HP-UX
11.31 ia64. The obnoxious part is that it requires a sudoer entry for
the Xymon user to run /usr/bin/adb.
#!/usr/bin/ksh
#
# This has been modified to compensate for ia64 reporting inaccuracy
from swapinfo. It does in the case of ia64 require a
# sudo entry to allow the user to execute a /usr/bin/adb command.
#
# 10 DEC 2010 Daniel Grahek
# This script properly calculates memory values on HP-UX systems where
memory
# page size has been increased. Tested on HP-UX 11iv3 Itanium with 8k,
16k, and 64k
# memory page sizes.
#
# This has been modified to compensate for ia64 reporting error from
swapinfo. It does in the case of ia64 require a
# sudo entry to allow the Xymon user to execute a /usr/bin/adb command.
# sudoers entry something this should work: BB ALL=NOPASSWD:
/usr/bin/adb
#
#This script replaces the binary hpux-meminfo in client/bin directory.
#version 1.2
# Distributed under GPL v2 license.
#
HARDWARE=`uname -m`
if [ "$HARDWARE" = "ia64" ]
then
FREEPAGES=`echo "freemem /2d" | /usr/local/bin/sudo /usr/bin/adb
/stand/vmunix /dev/kmem 2>/dev/null |tail -1 |awk {
'print $2'}`
PAGESIZE=`/usr/sbin/kctune base_pagesize |tail -1 |awk {'print $3'}`
FREEMEM=`/usr/bin/expr $FREEPAGES \* $PAGESIZE`
FREEREPORT=`/usr/bin/expr $FREEMEM / 1024`
TOTAL=`/usr/sbin/swapinfo |grep ^memory |awk {'print $2'}`
TOTALREPORT=`echo $TOTAL / 1024 |/usr/bin/bc`
else
FREE=`/usr/sbin/swapinfo |grep ^memory |awk {'print $4'}`
FREEREPORT=`echo $FREE / 1024 |/usr/bin/bc`
TOTAL=`/usr/sbin/swapinfo |grep ^memory |awk {'print $2'}`
TOTALREPORT=`echo $TOTAL / 1024 |/usr/bin/bc`
fi
echo Total:$TOTALREPORT
echo Free:$FREEREPORT
More information about the Xymon
mailing list