check_apaches: worker: check for invalid target

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

View file

@ -78,13 +78,20 @@ class CheckApaches(MonitoringPlugin):
returncode = self.value_wc_to_returncode(self.apache_busy, warn, crit)
output = '%d busy workers' % self.apache_busy
pd['value'] = self.apache_busy
pd = [pd]
elif target == 'idle':
returncode = self.value_wc_to_returncode(self.apache_idle, warn, crit)
output = '%d idle workers' % self.apache_idle
pd['value'] = self.apache_idle
pd['label'] = 'worker_idle'
pd = [pd]
else:
returncode = 3
output = 'Target "%s" unknown' % target
pd = None
return self.remember_check('worker', returncode, output, perfdata=[pd], target=target)
return self.remember_check('worker', returncode, output, perfdata=pd, target=target)
def get_server_status(self):