lists.checkmk.com
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
List overview
Download
Checkmk git commits
November 2010
----- 2024 -----
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
checkmk-commits@lists.checkmk.com
2 participants
180 discussions
Start a n
N
ew thread
Check_MK Git: check_mk: heartbeat_rscstatus: Catching empty output from agent correctly
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: a245df1865a797e648c20f72cb57461f6ed54e92 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a245df1865a797…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Wed Nov 3 08:48:15 2010 +0100 heartbeat_rscstatus: Catching empty output from agent correctly --- ChangeLog | 4 ++++ checks/heartbeat_rscstatus | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 567f5b3..4b2ef27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +1.1.8p1 + Checks & Agents: + * heartbeat_rscstatus: Catching empty output from agent correctly + 1.1.8: Core, Setup, etc.: * setup.sh: turn off Python debugging diff --git a/checks/heartbeat_rscstatus b/checks/heartbeat_rscstatus index 484a34d..03a127e 100644 --- a/checks/heartbeat_rscstatus +++ b/checks/heartbeat_rscstatus @@ -36,6 +36,9 @@ def inventory_heartbeat_rscstatus(checktype, info): return [ (None, '"%s"' % line[0]) for line in info if line[0] != '' ] def check_heartbeat_rscstatus(item, expectedState, info): + if len(info) == 0 or len(info[0]) == 0: + return (3, "UNKNOWN - Got no data from agent") + if info[0][0] == expectedState: return (0, "OK - Current state: %s" % (info[0][0])) else:
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: Updated internal doku
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 4977edf7e7648357b8fdd5180f8add01d3a71321 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4977edf7e76483…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Wed Nov 3 18:06:41 2010 +0100 Updated internal doku --- LIESMICH.zutun | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/LIESMICH.zutun b/LIESMICH.zutun index 395cd19..57f7413 100644 --- a/LIESMICH.zutun +++ b/LIESMICH.zutun @@ -1,7 +1,5 @@ --------------------------------------------------------------------------------- -BUGS beheben bis => 1.1.8 --------------------------------------------------------------------------------- -CHECK_MK: +Doku: Check_MK und OMD: Installieren von MKPs, local-Hierarchie + -------------------------------------------------------------------------------- BUGS beheben ab 1.1.9i1
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: MKP's under OMD also honor multisite extensions
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: e61d685f87f5019d5ae1fd7a7379b5fdff35800b URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e61d685f87f501…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Wed Nov 3 16:37:48 2010 +0100 MKP's under OMD also honor multisite extensions --- web/.f12 | 4 +--- web/htdocs/.f12 | 1 + web/htdocs/config.py | 7 +++++++ web/htdocs/index.py | 9 ++++++++- web/htdocs/sidebar.py | 6 ++++++ web/htdocs/views.py | 7 +++++++ web/plugins/views/perfometer.py | 6 ++++++ 7 files changed, 36 insertions(+), 4 deletions(-) diff --git a/web/.f12 b/web/.f12 index 70026e4..27c68e1 100644 --- a/web/.f12 +++ b/web/.f12 @@ -1,4 +1,2 @@ -sudo rsync -varx --delete --exclude=defaults.py htdocs plugins /usr/share/check_mk/web/ -sudo /etc/init.d/apache2 restart -#sudo /etc/init.d/apache2 reload +sudo cp -prv * /omd/versions/default/share/check_mk/web/ diff --git a/web/htdocs/.f12 b/web/htdocs/.f12 new file mode 100644 index 0000000..6c63611 --- /dev/null +++ b/web/htdocs/.f12 @@ -0,0 +1 @@ +sudo cp -v *.py /omd/versions/default/share/check_mk/web/htdocs diff --git a/web/htdocs/config.py b/web/htdocs/config.py index 89eb3cc..76057d7 100644 --- a/web/htdocs/config.py +++ b/web/htdocs/config.py @@ -38,6 +38,13 @@ except NameError: # Base directory of dynamic configuration config_dir = defaults.var_dir + "/web" +# Detect if we are running on OMD +try: + defaults.omd_site +except: + defaults.omd_site = None + defaults.omd_root = None + def load_config(): # reset settings which can be changed at runtime to # default values. Otherwise they stick to their changed diff --git a/web/htdocs/index.py b/web/htdocs/index.py index 15c56cd..27c781b 100644 --- a/web/htdocs/index.py +++ b/web/htdocs/index.py @@ -25,7 +25,7 @@ # Boston, MA 02110-1301 USA. from mod_python import apache,util -import os, livestatus +import os, sys, livestatus from lib import * import config, htmllib, defaults @@ -35,6 +35,13 @@ pagehandlers_dir = defaults.web_dir + "/plugins/pages" for fn in os.listdir(pagehandlers_dir): if fn.endswith(".py"): execfile(pagehandlers_dir + "/" + fn) +if defaults.omd_root: + sys.path.append(defaults.omd_root + "/local/share/check_mk/web/htdocs") + local_pagehandlers_dir = defaults.omd_root + "/local/share/check_mk/web/plugins/pages" + if os.path.exists(local_pagehandlers_dir): + for fn in os.listdir(local_pagehandlers_dir): + if fn.endswith(".py"): + execfile(local_pagehandlers_dir + "/" + fn) def read_get_vars(req): diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py index 8dec507..7a3b348 100644 --- a/web/htdocs/sidebar.py +++ b/web/htdocs/sidebar.py @@ -37,6 +37,12 @@ snapins_dir = defaults.web_dir + "/plugins/sidebar" for fn in os.listdir(snapins_dir): if fn.endswith(".py"): execfile(snapins_dir + "/" + fn) +if defaults.omd_root: + local_snapins_dir = defaults.omd_root + "/local/share/check_mk/web/plugins/sidebar" + if os.path.exists(local_snapins_dir): + for fn in os.listdir(local_snapins_dir): + if fn.endswith(".py"): + execfile(local_snapins_dir + "/" + fn) # Declare permissions: each snapin creates one permission config.declare_permission_section("sidesnap", "Sidebar snapins") diff --git a/web/htdocs/views.py b/web/htdocs/views.py index 37a7be0..c3f147b 100644 --- a/web/htdocs/views.py +++ b/web/htdocs/views.py @@ -172,6 +172,12 @@ plugins_path = defaults.web_dir + "/plugins/views" for fn in os.listdir(plugins_path): if fn.endswith(".py"): execfile(plugins_path + "/" + fn) +if defaults.omd_root: + local_plugins_path = defaults.omd_root + "/local/share/check_mk/web/plugins/views" + if os.path.exists(local_plugins_path): + for fn in os.listdir(local_plugins_path): + if fn.endswith(".py"): + execfile(local_plugins_path + "/" + fn) # Declare permissions for builtin views config.declare_permission_section("view", "Builtin views") @@ -816,6 +822,7 @@ def create_view(): def page_view(h): global html html = h + load_views() view_name = html.var("view_name") view = html.available_views.get(view_name) diff --git a/web/plugins/views/perfometer.py b/web/plugins/views/perfometer.py index 9bfd5f3..99564e7 100644 --- a/web/plugins/views/perfometer.py +++ b/web/plugins/views/perfometer.py @@ -65,6 +65,12 @@ perfometer_plugins_dir = defaults.web_dir + "/plugins/perfometer" for fn in os.listdir(perfometer_plugins_dir): if fn.endswith(".py"): execfile(perfometer_plugins_dir + "/" + fn) +if defaults.omd_root: + local_perfometer_plugins_dir = defaults.omd_root + "/local/share/check_mk/web/plugins/perfometer" + if os.path.exists(local_perfometer_plugins_dir): + for fn in os.listdir(local_perfometer_plugins_dir): + if fn.endswith(".py"): + execfile(local_perfometer_plugins_dir + "/" + fn) def paint_perfometer(row):
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: Allow to install MKP packages in OMD
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 27292bf35b1729817246172f112f6838f54ab86e URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=27292bf35b1729…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Wed Nov 3 15:23:10 2010 +0100 Allow to install MKP packages in OMD --- ChangeLog | 3 ++ modules/check_mk.py | 66 +++++++++++++++++++++++++++++++++++++++++-------- modules/packaging.py | 33 +++++++++++++++++------- 3 files changed, 81 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index d769641..d87eb62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ then after an error with one of those two agents checks from the other haven't been executed. This is fixed now. Inventory check is still not complete in that error condition. + * Packages (MKP): Allow to create and install packages within OMD! + Files are installed below ~/local/share/check_mk. No root permissions + are neccessary Checks & Agents: * megaraid_pdisks: Using the real enclosure number as check item now diff --git a/modules/check_mk.py b/modules/check_mk.py index b1cd68c..7d76c07 100755 --- a/modules/check_mk.py +++ b/modules/check_mk.py @@ -43,6 +43,28 @@ else: opt_debug = False opt_config_check = False +# are we running OMD? If yes, honor local/ hierarchy +omd_root = os.getenv("OMD_ROOT", None) +if omd_root: + local_share = omd_root + "/local/share/check_mk" + local_checks_dir = local_share + "/checks" + local_check_manpages_dir = local_share + "/checkman" + local_agents_dir = local_share + "/agents" + local_web_dir = local_share + "/web" + local_pnp_templates_dir = local_share + "/pnp-templates" + local_pnp_rraconf_dir = local_share + "/pnp-rraconf" + local_doc_dir = omd_root + "/local/share/doc/check_mk" +else: + local_checks_dir = None + local_check_manpages_dir = None + local_agents_dir = None + local_web_dir = None + local_pnp_templates_dir = None + local_pnp_rraconf_dir = None + local_doc_dir = None + + + # +----------------------------------------------------------------------+ # | ____ _ _ | # | | _ \ __ _| |_| |__ _ __ __ _ _ __ ___ ___ ___ | @@ -349,7 +371,10 @@ def precompile_filesystem_levels(host, item, params): # Do not read in the checks if check_mk is called as module if __name__ == "__main__": - for f in glob.glob(checks_dir + "/*"): + filelist = glob.glob(checks_dir + "/*") + if local_checks_dir: + filelist += glob.glob(local_checks_dir + "/*") + for f in filelist: if not f.endswith("~"): # ignore emacs-like backup files try: execfile(f) @@ -1809,6 +1834,8 @@ def reread_autochecks(): # +----------------------------------------------------------------------+ def find_check_plugin(checktype): + if local_checks_dir and os.path.exists(local_checks_dir + "/" + checktype): + return local_checks_dir + "/" + checktype filename = checks_dir + "/" + checktype if os.path.exists(filename): return filename @@ -2026,20 +2053,27 @@ def get_tty_size(): return (24, 80) +def all_manuals(): + entries = dict([(fn, check_manpages_dir + "/" + fn) for fn in os.listdir(check_manpages_dir)]) + if local_check_manpages_dir and os.path.exists(local_check_manpages_dir): + entries.update(dict([(fn, local_check_manpages_dir + "/" + fn) for fn in os.listdir(local_check_manpages_dir)])) + return entries + def list_all_manuals(): table = [] - for filename in os.listdir(check_manpages_dir): + for filename, path in all_manuals().items(): if filename.endswith("~"): continue + try: - for line in file(check_manpages_dir + "/" + filename): + for line in file(path): if line.startswith("title:"): table.append((filename, line.split(":", 1)[1].strip())) except: pass table.sort() - print_table(['Check type', 'Title'], [tty_blue, tty_cyan], table) + print_table(['Check type', 'Title'], [tty_bold, tty_normal], table) def show_check_manual(checkname): bg_color = 4 @@ -2054,11 +2088,9 @@ def show_check_manual(checkname): parameters_color = tty(6,4,1) examples_color = tty(6,4,1) - filename = check_manpages_dir + "/" + checkname - try: - f = file(filename) - except: - print "No manpage for %s. Sorry." % checkname + filename = all_manuals().get(checkname) + if not filename: + sys.stdout.write("No manpage for %s. Sorry." % checkname) return sections = {} @@ -2069,7 +2101,7 @@ def show_check_manual(checkname): empty_line_count = 0 try: - for line in f: + for line in file(filename): lineno += 1 if line.startswith(' ') and line.strip() != "": # continuation line empty_line_count = 0 @@ -2100,7 +2132,6 @@ def show_check_manual(checkname): current_variable, restofline = line.split(':', 1) current_section.append((current_variable, restofline.lstrip())) except Exception, e: - print current_section sys.stderr.write("Syntax error in %s line %d (%s).\n" % (filename, lineno, e)) sys.exit(1) @@ -2633,6 +2664,7 @@ def show_paths(): conf = 2 data = 3 pipe = 4 + local = 5 dir = 1 fil = 2 @@ -2671,6 +2703,17 @@ def show_paths(): ( livestatus_unix_socket, fil, pipe, "Socket of Check_MK's livestatus module"), ] + if omd_root: + paths += [ + ( local_checks_dir, dir, local, "Locally installed checks"), + ( local_check_manpages_dir, dir, local, "Locally installed check man pages"), + ( local_agents_dir, dir, local, "Locally installed agents and plugins"), + ( local_web_dir, dir, local, "Locally installed Multisite addons"), + ( local_pnp_templates_dir, dir, local, "Locally installed PNP templates"), + ( local_pnp_rraconf_dir, dir, local, "Locally installed PNP RRA configuration"), + ( local_doc_dir, dir, local, "Locally installed documentation"), + ] + def show_paths(title, t): if t != inst: print @@ -2686,6 +2729,7 @@ def show_paths(): ( "Configuration files edited by you", conf ), ( "Data created by Nagios/Check_MK at runtime", data ), ( "Sockets and pipes", pipe ), + ( "Locally installed addons", local ), ]: show_paths(title, t) diff --git a/modules/packaging.py b/modules/packaging.py index 371a5ff..b241deb 100644 --- a/modules/packaging.py +++ b/modules/packaging.py @@ -34,21 +34,25 @@ class PackageException(Exception): def __str__(self): return self.reason -pac_dir = var_dir + "/packages/" +if omd_root: + pac_dir = omd_root + "/var/check_mk/packages/" +else: + pac_dir = var_dir + "/packages/" try: os.makedirs(pac_dir) except: pass -package_parts = [ - ( "checks", "Checks", checks_dir ), - ( "checkman", "Checks' man pages", check_manpages_dir ), - ( "agents", "Agents", agents_dir ), - ( "web", "Multisite extensions", web_dir ), - ( "pnp-templates", "PNP4Nagios templates", pnp_templates_dir ), - ( "pnp-rraconf", "RRA configuration for PNP", pnp_rraconf_dir ), - ( "doc", "Documentation files", doc_dir ), -] +# in case of local directories (OMD) use those instead +package_parts = [ (part, title, ldir and ldir or dir) for part, title, dir, ldir in [ + ( "checks", "Checks", checks_dir, local_checks_dir), + ( "checkman", "Checks' man pages", check_manpages_dir, local_check_manpages_dir ), + ( "agents", "Agents", agents_dir, local_agents_dir ), + ( "web", "Multisite extensions", web_dir, local_web_dir ), + ( "pnp-templates", "PNP4Nagios templates", pnp_templates_dir, local_pnp_templates_dir ), + ( "pnp-rraconf", "RRA configuration for PNP", pnp_rraconf_dir, local_pnp_rraconf_dir ), + ( "doc", "Documentation files", doc_dir, local_doc_dir ), +]] def packaging_usage(): sys.stdout.write("""Usage: check_mk [-v] -P|--package COMMAND [ARGS] @@ -140,6 +144,8 @@ def show_package(name, show_info = False): package = read_package(name) if not package: raise PackageException("No such package %s." % name) + if show_info: + sys.stdout.write("Package file: %s%s\n" % (pac_dir, name)) except PackageException: raise except Exception, e: @@ -360,6 +366,10 @@ def package_install(args): verbose(" %s%s%s:\n" % (tty_bold, title, tty_normal)) for fn in filenames: verbose(" %s\n" % fn) + # make sure target directory exists + if not os.path.exists(dir): + verbose(" Creating directory %s\n" % dir) + os.makedirs(dir) tarsource = tar.extractfile(part + ".tar") subtar = "tar xf - -C %s %s" % (dir, " ".join(filenames)) tardest = os.popen(subtar, "w") @@ -388,6 +398,9 @@ def package_install(args): def files_in_dir(part, dir, prefix = ""): + if not os.path.exists(dir): + return [] + # Handle case where one part-dir lies below another taboo_dirs = [ d for p, t, d in package_parts if p != part ] if dir in taboo_dirs:
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: Updated check verify script
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 96f61036fce85656a631e24c9fd1e26bbfca77b5 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=96f61036fce856…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Fri Oct 29 13:18:02 2010 +0200 Updated check verify script --- validate_checks | 62 ++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 39 insertions(+), 23 deletions(-) diff --git a/validate_checks b/validate_checks index 1afe527..e0e46c0 100755 --- a/validate_checks +++ b/validate_checks @@ -76,7 +76,36 @@ SCORE_START = 10 C_OK = 1 C_FAILED = 2 C_INVALID = 3 -TESTS = { 'manpage': C_OK, 'pnp_tmpl': C_OK, 'pnp_rra': C_OK, 'snmp_scan': C_OK } +TESTS = { 'manpage': C_OK, 'snmp_scan': C_OK, 'pnp_tmpl': C_OK, 'pnp_rra': C_OK, 'snmp_scan': C_OK } +WEIGHT = { 'manpage': 2 } + +# +# Check definitions +# + +def is_valid_manpage(check): + return True + +def verify_manpage(check): + return os.path.exists('checkman/%s' % check) + +def is_valid_snmp_scan(check): + return is_snmp_check(check) + +def verify_snmp_scan(check): + return check in snmp_scan_functions + +def is_valid_pnp_tmpl(check): + return check_has_perfdata(check) + +def verify_pnp_tmpl(check): + return os.path.exists('pnp-templates/check_mk-%s.php' % check) + +def is_valid_pnp_rra(check): + return check_has_perfdata(check) + +def verify_pnp_rra(check): + return os.path.exists('pnp-rraconf/check_mk-%s.rra.php' % check) # # 1) Perform checks @@ -86,26 +115,13 @@ for check in get_all_checks(): score = SCORE_START check_results = TESTS.copy() - if not os.path.exists('checkman/%s' % check): - check_results['manpage'] = C_FAILED - score -= 1 - - if check_has_perfdata(check): - if not os.path.exists('pnp-templates/check_mk-%s.php' % check): - check_results['pnp_tmpl'] = C_FAILED - score -= 1 - if not os.path.exists('pnp-rraconf/check_mk-%s.rra.php' % check): - check_results['pnp_rra'] = C_FAILED - score -= 1 - else: - check_results['pnp_tmpl'] = C_INVALID - - if is_snmp_check(check): - if not check in snmp_scan_functions: - check_results['snmp_scan'] = C_FAILED - score -= 1 - else: - check_results['snmp_scan'] = C_INVALID + for test in TESTS.keys(): + if eval('is_valid_%s(\'%s\')' % (test, check)): + if not eval('verify_%s(\'%s\')' % (test, check)): + check_results[test] = C_FAILED + score -= WEIGHT.get(test, 1) + else: + check_results[test] = C_INVALID results[check] = (score, check_results) @@ -120,7 +136,7 @@ results = sorted(results.iteritems(), key=operator.itemgetter(1)) # sys.stdout.write('%-25s' % 'Check') for f in TESTS.keys(): - sys.stdout.write('%-10s' % f) + sys.stdout.write('%-15s' % (f+' (%d)' % WEIGHT.get(f, 1))) sys.stdout.write('%-8s' % 'Score') sys.stdout.write("\n") for check, (score, check_results) in results: @@ -144,7 +160,7 @@ for check, (score, check_results) in results: sub_color = tty_green label = ':-)' - sys.stdout.write('%s%-10s%s' % (sub_color, label, tty_normal)) + sys.stdout.write('%s%-15s%s' % (sub_color, label, tty_normal)) sys.stdout.write('%s%-8s%s' % (color, score, tty_normal)) sys.stdout.write("\n")
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: Created script for validating Check_MK checks
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 6f8b7b7ecddb975129eb9a522aa74eabbc253d13 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6f8b7b7ecddb97…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Fri Oct 29 12:56:09 2010 +0200 Created script for validating Check_MK checks --- validate_checks | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 150 insertions(+), 0 deletions(-) diff --git a/validate_checks b/validate_checks new file mode 100755 index 0000000..1afe527 --- /dev/null +++ b/validate_checks @@ -0,0 +1,150 @@ +#!/usr/bin/python + +import os, sys + +on_tty = sys.stdout.isatty() + +if on_tty: + tty_black = '\033[30m' + tty_red = '\033[31m' + tty_green = '\033[32m' + tty_yellow = '\033[33m' + tty_blue = '\033[34m' + tty_magenta = '\033[35m' + tty_cyan = '\033[36m' + tty_white = '\033[37m' + tty_bgred = '\033[41m' + tty_bggreen = '\033[42m' + tty_bgyellow = '\033[43m' + tty_bgblue = '\033[44m' + tty_bgmagenta = '\033[45m' + tty_bgcyan = '\033[46m' + tty_bgwhite = '\033[47m' + tty_bold = '\033[1m' + tty_underline = '\033[4m' + tty_normal = '\033[0m' + tty_ok = tty_green + tty_bold + 'OK' + tty_normal + tty_error = tty_red + tty_bold + 'ERROR' + tty_normal +else: + tty_black = '' + tty_red = '' + tty_green = '' + tty_yellow = '' + tty_blue = '' + tty_magenta = '' + tty_cyan = '' + tty_white = '' + tty_bgred = '' + tty_bggreen = '' + tty_bgyellow = '' + tty_bgblue = '' + tty_bgmagenta = '' + tty_bgcyan = '' + tty_bold = '' + tty_underline = '' + tty_normal = '' + tty_ok = 'OK' + tty_error = 'ERROR' + + + +__name__ = 'asd' +defaults_path = 'defaults' +autochecks = [] +execfile('check_mk') +__name__ = '__main__' + +def get_checks(): + return [ l for l in os.listdir('checks') if not l.startswith('.') ] + +def check_has_perfdata(check): + return check_info[check][2] == 1 + +def get_all_checks(): + k = check_info.keys() + k.sort() + return k + +def is_snmp_check(check): + return check in snmp_info or check in snmp_info_single + +# Load all checks +for check in get_checks(): + execfile('checks/%s' % check) + +SCORE_START = 10 +C_OK = 1 +C_FAILED = 2 +C_INVALID = 3 +TESTS = { 'manpage': C_OK, 'pnp_tmpl': C_OK, 'pnp_rra': C_OK, 'snmp_scan': C_OK } + +# +# 1) Perform checks +# +results = {} +for check in get_all_checks(): + score = SCORE_START + check_results = TESTS.copy() + + if not os.path.exists('checkman/%s' % check): + check_results['manpage'] = C_FAILED + score -= 1 + + if check_has_perfdata(check): + if not os.path.exists('pnp-templates/check_mk-%s.php' % check): + check_results['pnp_tmpl'] = C_FAILED + score -= 1 + if not os.path.exists('pnp-rraconf/check_mk-%s.rra.php' % check): + check_results['pnp_rra'] = C_FAILED + score -= 1 + else: + check_results['pnp_tmpl'] = C_INVALID + + if is_snmp_check(check): + if not check in snmp_scan_functions: + check_results['snmp_scan'] = C_FAILED + score -= 1 + else: + check_results['snmp_scan'] = C_INVALID + + results[check] = (score, check_results) + +# +# 2) Sort by score +# +import operator +results = sorted(results.iteritems(), key=operator.itemgetter(1)) + +# +# 3) Output the results +# +sys.stdout.write('%-25s' % 'Check') +for f in TESTS.keys(): + sys.stdout.write('%-10s' % f) +sys.stdout.write('%-8s' % 'Score') +sys.stdout.write("\n") +for check, (score, check_results) in results: + if score == SCORE_START: + color = tty_green + elif score == 9: + color = tty_yellow + else: + color = tty_red + + sys.stdout.write('%s%-25s%s' % (color, check, tty_normal)) + + for f in TESTS.keys(): + if check_results[f] == C_FAILED: + sub_color = tty_red + label = ':-(' + elif check_results[f] == C_INVALID: + sub_color = tty_normal + label = '' + else: + sub_color = tty_green + label = ':-)' + + sys.stdout.write('%s%-10s%s' % (sub_color, label, tty_normal)) + + sys.stdout.write('%s%-8s%s' % (color, score, tty_normal)) + sys.stdout.write("\n")
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: Merge branch 'master' of git@mathias-kettner.de: check_mk into 1.1.9
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 613ddb562dc0580c90f5fa22a1e8611e4feaffc0 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=613ddb562dc058…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Sun Oct 31 17:19:59 2010 +0100 Merge branch 'master' of git@mathias-kettner.de:check_mk into 1.1.9 ---
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: Merge branch '1.1.9'
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 894d1de1de22fe4ee6030359393e5fcb2dd2cc03 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=894d1de1de22fe…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Wed Nov 3 14:03:40 2010 +0100 Merge branch '1.1.9' ---
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: Merge branch '1.1.9'
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: ab099e52a93311920392bc3f0f60a66d8639fc03 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ab099e52a93311…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Wed Nov 3 14:03:12 2010 +0100 Merge branch '1.1.9' Conflicts: checks/cisco_fan ---
13 years, 8 months
1
0
0
0
Check_MK Git: check_mk: Merge branch '1.1.9' of git@mathias-kettner.de: check_mk into 1.1.9
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 49af743b164b5697c0aa1986546c19e7c0b9f17d URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=49af743b164b56…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Fri Oct 29 08:47:16 2010 +0200 Merge branch '1.1.9' of git@mathias-kettner.de:check_mk into 1.1.9 Conflicts: ChangeLog ---
13 years, 8 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Results per page:
10
25
50
100
200