1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Update in: 28 October 2020


:

#!/bin/bash

# Cor van Wandelen

# percentage memory used on VMware host

if [ $# -eq 0 ] || [ $# -eq 1 ]
then
echo “Syntax: <ip address> <snmp community>”
exit -1
fi

USED=`snmpwalk -v2c -c $2 $1 1.3.6.1.2.1.25.5.1.1.2 | cut -d ‘ ‘ -f4 | paste -sd+ | bc`
TOTAL=`snmpwalk -v2c -c $2 $1 1.3.6.1.2.1.25.2.2.0 | cut -d ‘ ‘ -f4`

echo “scale=2 ; ($USED / $TOTAL) * 100” | bc

(Visited 23 times, 1 visits today)