diff --git a/check_apaches.py b/check_apaches.py index 46d4adf..011aea2 100755 --- a/check_apaches.py +++ b/check_apaches.py @@ -71,6 +71,18 @@ class CheckApaches(MonitoringPlugin): pass + def check_slots(self, target='open', warn='', crit=''): + pd = {'label':'slots_open', 'unit':'', 'warn':warn, 'crit': crit, 'min':0} + + if target == 'open': + returncode = self.value_wc_to_returncode(self.apache_states['.'], warn, crit) + output = '%d open slots' % self.apache_states['.'] + pd['value'] = self.apache_states['.'] + pd['label'] = 'slots_open' + + return self.remember_check('slots', returncode, output, perfdata=[pd], target=target) + + def check_worker(self, target='busy', warn='', crit=''): pd = {'label':'worker_busy', 'unit':'', 'warn':warn, 'crit': crit, 'min':0} @@ -176,7 +188,9 @@ def main(): for quad in checks: (check, target, warn, crit) = tuple(quad) - if check == 'worker': + if check == 'slots': + result = plugin.check_slots(target, warn, crit) + elif check == 'worker': result = plugin.check_worker(target, warn, crit) else: result = plugin.remember_check(check, plugin.RETURNCODE['UNKNOWN'], 'Unknown check "' + check + '"!')