Skip to content

Instantly share code, notes, and snippets.

@remore
Created June 19, 2013 08:00
Show Gist options
  • Save remore/5812480 to your computer and use it in GitHub Desktop.
Save remore/5812480 to your computer and use it in GitHub Desktop.
usage: check_disk_usage.sh <SERVER-NAME>
#!/bin/bash
# usage:
# check_disk_usage.sh <SERVER-NAME>
function check_disk_usage(){
local TOTAL=`snmpget -On -c public -v 1 "${1}" UCD-SNMP-MIB::dskTotal.1 | awk '{print $4}'`
local AVAIL=`snmpget -On -c public -v 1 "${1}" UCD-SNMP-MIB::dskAvail.1 | awk '{print $4}'`
local USED=`snmpget -On -c public -v 1 "${1}" UCD-SNMP-MIB::dskUsed.1 | awk '{print $4}'`
local PERCENT=`snmpget -On -c public -v 1 "${1}" UCD-SNMP-MIB::dskPercent.1 | awk '{print $4}'`
echo HDD of ${1} is ${PERCENT}% used - Total:${TOTAL}, Avail:${AVAIL}, Used:${USED}
}
check_disk_usage $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment