Module: check_mk
Branch: master
Commit: d0372febfd2fc665046df7887354f91fe1d625ad
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d0372febfd2fc6…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Nov 18 16:02:45 2014 +0100
You can add these icons with the new livedump option
<tt>--include-host-icon</tt>
C+:
livedump --config --include-host-icon
C-:
---
.werks/1440 | 14 ++++++++++++++
ChangeLog | 1 +
doc/treasures/livedump/livedump | 40 +++++++++++++++++++--------------------
3 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/.werks/1440 b/.werks/1440
new file mode 100644
index 0000000..734d196
--- /dev/null
+++ b/.werks/1440
@@ -0,0 +1,14 @@
+Title: livedump: now able to add hosts icon_image on config generation
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1416322807
+Class: feature
+
+You can add these icons with the new livedump option
<tt>--include-host-icon</tt>
+
+C+:
+livedump --config --include-host-icon
+C-:
+
diff --git a/ChangeLog b/ChangeLog
index f80562c..c5e6ecc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
* 1445 quantum_libsmall_door, quantum_libsmall_status: Two new checks for monitoring
small Quantum tape libraries
* 1448 domino_info: check is extended to also show and monitor the
lnNotesServerState
* 1509 if, if64: New option for make inventory based on port alias...
+ * 1440 livedump: now able to add hosts icon_image on config generation...
* 1478 FIX: kernel.util, statgrab_cpu: fix computation of utilization...
* 1480 FIX: brocade_vdx_status: disable check on some devices that do not support
it...
* 1485 FIX: dell_om_disks, dell_om_esmlog, dell_om_mem, dell_om_processors,
dell_om_sensors: detect more devices...
diff --git a/doc/treasures/livedump/livedump b/doc/treasures/livedump/livedump
index 443b9a6..f89c72f 100755
--- a/doc/treasures/livedump/livedump
+++ b/doc/treasures/livedump/livedump
@@ -107,39 +107,32 @@ def livedump_config():
# Dump host config
query = \
"GET hosts\n" \
- "Columns: name alias address groups check_command " \
+ "Columns: name alias address groups check_command icon_image " \
"max_check_attempts contacts contact_groups\n" + \
opt_host_headers + \
opt_host_only_headers
for row in g_connection.query_table_assoc(query):
prepare_row(row)
row["groupstring"] = ",".join(row["groups"])
- if opt_groups:
- sys.stdout.write(
+ sys.stdout.write(
"define host {\n"
" use livedump-host\n"
" host_name %(name)s\n"
" alias %(alias)s\n"
" address %(address)s\n"
- " host_groups %(groupstring)s\n"
- " contact_groups %(contact_groups)s\n"
+ " host_groups %(groupstring)s\n"
" check_command %(check_command)s\n"
- " max_check_attempts %(max_check_attempts)d\n"
- "}\n\n"
- % row)
+ " max_check_attempts %(max_check_attempts)d\n" % row)
+ if opt_groups:
+ sys.stdout.write(" contacts %(contactsstring)s\n" %
row)
else:
- sys.stdout.write(
- "define host {\n"
- " use livedump-host\n"
- " host_name %(name)s\n"
- " alias %(alias)s\n"
- " address %(address)s\n"
- " host_groups %(groupstring)s\n"
- " contacts %(contactsstring)s\n"
- " check_command %(check_command)s\n"
- " max_check_attempts %(max_check_attempts)d\n"
- "}\n\n"
- % row)
+ sys.stdout.write(" contact_groups %(contact_groups)s\n" %
row)
+
+ if opt_host_icon:
+ if row.get("icon_image"):
+ sys.stdout.write(" icon_image %(icon_image)s\n" %
row)
+
+ sys.stdout.write("}\n\n")
# Dump service config
query = \
@@ -269,6 +262,8 @@ def usage():
with templates (-C -T).
-v, --verbose output debug information an stderr
+ -G, --include-groups use contact groups instead of contacts on dumping config
+ --include-host-icon add host icon_image to config
--debug do not catch Python exceptions
""")
@@ -292,7 +287,7 @@ short_options = 'hVvc:H:S:O:TCMGi:s:'
long_options = [ "help", "version", "verbose",
"debug", "socket=",
"host-header=", "host-only-header=",
"service-header=",
"dump-templates", "config", "state",
"mark-mode",
- "include-groups", "interval" ]
+ "include-groups", "interval",
"include-host-icon" ]
opt_verbose = False
opt_debug = False
@@ -303,6 +298,7 @@ opt_host_only_headers = ""
opt_service_headers = ""
opt_dump_templates = False
opt_groups = False
+opt_host_icon = False
opt_check_interval = None
try:
@@ -340,6 +336,8 @@ for o,a in opts:
opt_mark_mode = True
elif o in [ '-G', '--include-groups' ]:
opt_groups = True
+ elif o in [ '--include-host-icon' ]:
+ opt_host_icon = True
elif o in [ '-i', '--interval' ]:
opt_check_interval = int(a)