Module: check_mk
Branch: master
Commit: 517f32033d26a137a97c711fcad43fb43aa0850a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=517f32033d26a1…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Oct 16 14:29:12 2014 +0200
Nicer output of cmk -L, show manpage titles now
---
modules/check_mk.py | 32 +++++++++-----------------------
1 file changed, 9 insertions(+), 23 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 1fd6522..b58a897 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -468,15 +468,13 @@ if __name__ == "__main__":
# +----------------------------------------------------------------------+
def output_check_info():
- print "Available check types:"
- print
- print " plugin perf- in- "
- print "Name type data vent. service
description"
- print
"-------------------------------------------------------------------------"
+ all_check_manuals = all_manuals()
+ read_manpage_catalog()
checks_sorted = check_info.items() + active_check_info.items()
checks_sorted.sort()
for check_type, check in checks_sorted:
+ man_filename = all_check_manuals.get(check_type)
try:
if 'command_line' in check:
what = 'active'
@@ -488,27 +486,15 @@ def output_check_info():
what = 'tcp'
ty_color = tty_yellow
- if check.get("has_perfdata", False):
- p = tty_green + tty_bold + "yes" + tty_normal
- else:
- p = "no"
-
- if what == 'active':
- i = '-'
- elif check["inventory_function"] == None:
- i = "no"
- else:
- i = tty_blue + tty_bold + "yes" + tty_normal
-
- if what == 'active':
- descr = '-'
+ if man_filename:
+ title = file(man_filename).readlines()[0].split(":",
1)[1].strip()
else:
- descr = check["service_description"]
+ title = "(no man page present)"
- print (tty_bold + "%-32s" + tty_normal
+ print (tty_bold + "%-44s" + tty_normal
+ ty_color + " %-6s " + tty_normal
- + " %-3s %-3s %s") % \
- (check_type, what, p, i, descr)
+ + "%s") % \
+ (check_type, what, title)
except Exception, e:
sys.stderr.write("ERROR in check_type %s: %s\n" % (check_type, e))