File: //usr/lib/python2.7/site-packages/lap/dfi.py
import sys
import yaml
import commands
import socket
socket.setdefaulttimeout(5)
def __run__(params):
thresholds = yaml.load(params.get('thresholds'))
path = params.get('path')
status,output = commands.getstatusoutput("df -ih %s | egrep -v Filesystem" % path)
output=output.split()
inodes = output[4].replace("%", "")
if int(inodes) >= thresholds['critical']:
return [2, "CRITICAL - Used: %s on %s" % (output[4], output[5])]
if int(inodes) >= thresholds['warning']:
return [1, "WARNING - Used: %s on %s" % (output[4], output[5])]
else:
return [0, "OK - Used: %s on %s" % (output[4], output[5])]