File: //proc/self/root/lib/python2.7/site-packages/lap/sharedweb_qty_clients.py
import glob
def __run__(params):
try:
maxqty = params.get("maxqty")
except Exception, e:
return [2, "CRITICAL - Error getting params: %s" % repr(e)]
try:
clients = glob.glob('/etc/locaweb/hospedagem/*.conf')
if len(clients) < maxqty:
return [0, "OK - %s Active clients" % len(clients), "customers=%s" % len(clients)]
else:
return [2, "CRITICAL - %s Active clients" % len(clients), "customers=%s" % len(clients)]
except Exception, e:
return [2, "CRITICAL - Error: %s" % repr(e)]