#!/bin/python
inventory_process = []
inventory_process_version = []
def inventory_linux_ulimit (checkname, info):
inventory = []
if checkname == "linux_ulimit":
#print "linux ulimit inv"
#print info
for line in info:
ln1 = line[0]
ln2 = line[1]
ln1 = int(ln1)
ln2 = int(ln2)
#print "%d %d" % (ln1, ln2)
value = "%d / %d" % (ln1, ln2)
inventory.append ( ("Ulimit", (ln1,ln2)))
return inventory
#the actual check
def check_linux_ulimit (item, params, info):
perfdata = []
perfdata = (float((params[0])/float(params[1]))*100.0)
#value = ("Cur=%d ; Max=%d" % (params[0], params[1]))
value = [("ulimit_cur",params[0],params[1]),]
#print value
if perfdata > 90.0:
return (2, "Critical@90%: %d of %d used. %.1f%%" % (params[0],params[1],perfdata), value)
if perfdata > 85.0:
return (1, "Warning@85: %d of %d used. %.1f%%" % (params[0], params[1],perfdata),value)
return (0, "OK - %d of %d used. %.1f%% " % (params[0], params[1],perfdata), value)
# checking function, service description, perf data, invenotry function
check_info['linux_ulimit'] = (check_linux_ulimit, "Linux",1 ,inventory_linux_ulimit)
No comments:
Post a Comment