Module: check_mk
Branch: master
Commit: 2a635714f39f9a4f027438117b5f018bfe3d5208
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2a635714f39f9a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Oct 17 14:32:01 2012 +0200
doc/treasures: added script for printing RRD statistics
---
ChangeLog | 1 +
doc/treasures/get_rrd_cache_stats | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6daced3..710c8ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
Core:
* Improved validation of inventory data reported by checks
* Added -d option to precompiled checks to enable debug mode
+ * doc/treasures: added script for printing RRD statistics
Event Console:
* Moved source of Event Console into Check_MK project
diff --git a/doc/treasures/get_rrd_cache_stats b/doc/treasures/get_rrd_cache_stats
new file mode 100755
index 0000000..b03e2ef
--- /dev/null
+++ b/doc/treasures/get_rrd_cache_stats
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+#
+# Run this script within a (started) OMD site in order to
+# retrieve cache statistics of the RRD cache.
+
+import socket,os,sys
+
+try:
+ omdhome = os.environ['OMD_ROOT']
+
+ s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ s.connect(omdhome + "/tmp/run/rrdcached.sock")
+ s.send('STATS\n')
+ data = s.recv(1024)
+ s.close()
+
+ lines = data.splitlines()[1:]
+ stats = {}
+ for line in lines:
+ key, value = line.split(" ", 1)
+ stats[key[:len(key)-1]] = int(value)
+
+ for key, value in stats.items():
+ print "%-15s :%15d" %(key, value)
+
+except:
+ sys.stderr.write("Unable to retrieve statistics.\n")
+ sys.exit(1)