Module: check_mk
Branch: master
Commit: 05c893fb8af920da6d5a73047d82e2e88b5cbdd4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=05c893fb8af920…
Author: Florian Heigl <fh(a)mathias-kettner.de>
Date: Fri Sep 14 17:27:43 2012 +0200
agents/plugins/mk_jolokia
mk_jolokia now gets server status for tomcat apps
---
checks/jolokia_metrics | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/checks/jolokia_metrics b/checks/jolokia_metrics
index b419fb2..3237750 100644
--- a/checks/jolokia_metrics
+++ b/checks/jolokia_metrics
@@ -107,7 +107,7 @@ def inventory_jolokia_metrics_apps(info, what):
needed_key = [ "StandbyThreadCount" ]
levels = None
else:
- needed_key = [ "Running" ]
+ needed_key = [ "Running", "stateName" ]
levels = None
for inst, vals in parsed.iteritems():
for app, appstate in vals.get('apps', {}).items():
@@ -209,12 +209,24 @@ def check_jolokia_metrics_uptime(item, _unused, info):
def check_jolokia_metrics_app_state(item, _unused, info):
app = jolokia_metrics_app(info, item.split())
- if not app or not 'Running' in app:
+ app_state=3
+ # FIXME: this could be nicer.
+ if app and "Running" in app:
+ if app['Running'] == '1':
+ app_state = 0
+ else:
+ app_state = 2
+ # wenn in app statename steht
+ elif app and "stateName" in app:
+ if app['stateName'] == 'STARTED':
+ app_state = 0
+ else:
+ app_state = 2
+ if app_state == 3:
return (3, "UNKNOWN - data not found in agent output")
-
- if app['Running'] == '1':
+ elif app_state == 0:
return (0, 'OK - application is running')
- else:
+ elif app_state == 2:
return (2, 'CRIT - application is not running (Running: %s)')