Module: check_mk
Branch: master
Commit: 1593faa594a1cc6e3999abe0046b127b43d6ef5e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1593faa594a1cc…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Dec 7 16:57:07 2011 +0100
Added example for creating checks from BI aggregates
---
doc/treasures/check_bi_local.py | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/doc/treasures/check_bi_local.py b/doc/treasures/check_bi_local.py
new file mode 100755
index 0000000..2c86b72
--- /dev/null
+++ b/doc/treasures/check_bi_local.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+# Example for creating real Nagios checks from BI
+# aggregations. You need to create a view with
+# the name aggr_service with the two columns
+# Aggr State and Aggr Name.
+
+import os
+
+url =
'http://omdadmin:omd@localhost/bi/check_mk/view.py?view_name=aggr_webservice&output_format=python'
+
+data = eval(os.popen("curl --silent '%s'" % url).read())
+
+states = {
+ "OK" : 0,
+ "WARN" : 1,
+ "CRIT" : 2,
+ "UNKNOWN" : 3,
+}
+
+for state, name in data[1:]:
+ state_nr = states.get(state, -1)
+ descr = "BI_Aggr_" + name.replace(" ", "_")
+ if state_nr != -1:
+ print "%d %s - %s" % (state_nr, descr, state)
+