#!/bin/bash # vmwaretools agent script by dennis@kruyt.org # # This will add support for vmware's mem/cpu resource allocations for the virtual machine to observium. # # Install: # make sure you have vmware tools running on the virtual machine. # copy script/agent-local/vmwaretools to /usr/lib/observium_agent/local on the virtual machine # VMWARETOOLBOX=/usr/bin/vmware-toolbox-cmd if [ -f $VMWARETOOLBOX ]; then echo "<<>>" echo -n "vmtotalmem:" expr `free -k | grep ^Mem | awk '{print $2}'` / 1000 echo -n "vmswap:" $VMWARETOOLBOX stat swap | cut -d" " -f1 echo -n "vmballoon:" $VMWARETOOLBOX stat balloon | cut -d" " -f1 echo -n "vmmemres:" $VMWARETOOLBOX stat memres | cut -d" " -f1 echo -n "vmmemlimit:" memlimit=` $VMWARETOOLBOX stat memlimit | cut -d" " -f1` if [ $memlimit = 4294967295 ]; then memlimit=U fi echo $memlimit echo -n "vmspeed:" expr `$VMWARETOOLBOX stat speed | cut -d" " -f1` \* 1000000 echo -n "vmcpulimit:" cpulimit=` $VMWARETOOLBOX stat cpulimit | cut -d" " -f1` if [ $cpulimit = 4294967295 ]; then cpulimit=U else cpulimit=`expr $cpulimit \* 1000000` fi echo $cpulimit echo -n "vmcpures:" expr `$VMWARETOOLBOX stat cpures | cut -d" " -f1` \* 1000000 fi