File: //proc/self/root/lib/python2.7/site-packages/lap/exim_queue.py
import commands
import yaml
def __run__(params):
msg_thresholds = yaml.load(params.get('thresholds'))
output = commands.getstatusoutput('sudo /usr/sbin/exim -bpc')
msgs_in_queue = output[1]
perfdata = 'queue=%s' % msgs_in_queue
if int(msgs_in_queue) > int(msg_thresholds['critical']):
return [2, "CRITICAL - %s messages in queue" % msgs_in_queue, perfdata]
if int(msgs_in_queue) > int(msg_thresholds['warning']):
return [1, "WARNING - %s messages in queue" % msgs_in_queue, perfdata]
else:
return [0, "OK - %s messages in queue" % msgs_in_queue, perfdata]