Module: check_mk
Branch: master
Commit: 4fbc6c21eccd14caa9bd0cc13619227d7904c9e6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4fbc6c21eccd14…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Nov 8 15:46:21 2010 +0100
j4p_performance: Added experimental agent plugin
---
ChangeLog | 2 ++
agents/plugins/j4p_performance | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 815e857..ae06146 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,8 @@
* heartbeat_rscstatus: Catching empty output from agent correctly
* win_dhcp_pools agent plugin: Filtering additional error message on
systems without dhcp server
+ * j4p_performance: Added experimental agent plugin fetching data via
+ jmx4perl agent (does not need jmx4perl on Nagios)
Multisite:
* The custom open/close states of custom links are now stored for each
diff --git a/agents/plugins/j4p_performance b/agents/plugins/j4p_performance
new file mode 100755
index 0000000..2af3363
--- /dev/null
+++ b/agents/plugins/j4p_performance
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import urllib, sys, os
+
+server = "localhost"
+port = 8080
+vars = [
+ ( "java.lang:type=Memory/NonHeapMemoryUsage/used",
"NoneHeapMemoryUsage" ),
+ ( "java.lang:type=Memory/HeapMemoryUsage/used",
"HeapMemoryUsage" ),
+ ( "java.lang:type=Threading/ThreadCount", "ThreadCount"
),
+ ( "java.lang:type=Threading/DaemonhreadCount",
"DeamonThreadCount" ),
+ ( "java.lang:type=Threading/PeakThreadCount",
"PeakThreadCount" ),
+ ( "java.lang:type=Threading/TotalStartedThreadCount",
"TotalStartedThreadCount" ),
+ ( "java.lang:type=Runtime/Uptime", "Uptime" ),
+
+]
+
+conffile = os.getenv("MK_CONFDIR", "/etc/check_mk") +
"/j4p.conf"
+
+if os.path.exists(conffile):
+ execfile(conffile)
+
+def fetch_var(server, port, path):
+ url = "http://%s:%d/j4p/read/%s" % (server, port, path)
+ json = urllib.urlopen(url).read()
+ return eval(json)["value"]
+
+
+first = True
+for path, title in vars:
+ try:
+ value = fetch_var(server, port, path)
+ if first:
+ first = False
+ sys.stdout.write("<<<j4p_performance>>>\n")
+ sys.stdout.write("%-30s %s\n" % (title, value))
+ except IOError:
+ sys.exit(1)
+ except:
+ pass