Module: check_mk
Branch: master
Commit: 6860c0e819d8f59d641a21302eec0ed0306c819e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6860c0e819d8f5…
Author: Florian Heigl <fh(a)mathias-kettner.de>
Date: Fri Aug 24 11:54:15 2012 +0200
Inventory helper script
---
doc/treasures/inventory_helper.sh | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/doc/treasures/inventory_helper.sh b/doc/treasures/inventory_helper.sh
new file mode 100644
index 0000000..844bff3
--- /dev/null
+++ b/doc/treasures/inventory_helper.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+
+
+# A script to get systems where the inventory check has fired
+# then output those including the services they'll add
+# then reinventorize them
+# then reschedule the inventory check to clean up
+
+
+reinventory()
+{
+
+check_mk --automation inventory new $HOST
+
+echo "COMMAND [`date +%s`] SCHEDULE_FORCED_SVC_CHECK;$HOST;Check_MK inventory;`date
+%s`" | lq
+
+}
+
+INVENTORY_INFO=`echo "GET services
+Columns: host_name long_plugin_output
+Filter: description = Check_MK inventory
+Filter: plugin_output !~~ no unchecked" | lq`
+
+if [ $INVENTORY_INFO != "" ]; then
+ HOSTS=`echo "$INVENTORY_INFO" | cut -f1 -d\;`
+ echo "$INVENTORY_INFO"
+ for HOST in "$HOSTS" ; do
+ reinventory
+ done
+fi
+
+