Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
local
/
sysadm
/
bin
/
Upload File :
New :
File
Dir
//usr/local/sysadm/bin/realmem.sh
#!/bin/bash ############################################################################## # $Id: realmem.sh 8 2006-11-17 13:49:05 awells $ # DOES # Determines the amount of actual used ( total - cache ) physical memory # PURPOSE # To be used as a custom OID for snmp tracking of actual memory usage # SEE ALSO # /etc/snmp/snmpd.conf line 276 ############################################################################## let total=`free | tail -3 | head -1 | awk '{ print $2 }'` let used=`free | tail -3 | head -1 | awk '{ print $3 }'` let cache=`free | tail -3 | head -1 | awk '{ print $7 }'` let real=$used-$cache let free=$total-$real let percent=$real/$total # uncomment this line to do the complete calculation #echo $real # uncomment this line to return a percent instead of the actual number #echo $percent # uncomment this line to let nagios do the calculation #echo $cache # uncomment this line to tell nagios the amount of "real" free mem echo $free exit 55