check_apaches: Add slots check

This commit is contained in:
Sven Velt 2021-09-22 12:28:42 +02:00
parent 5bdf0dd8d2
commit 598eeab975

View file

@ -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 + '"!')