Module: check_mk
Branch: master
Commit: 60c843c1f82382f27276d73fa3746a666c2b1ed8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=60c843c1f82382…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Apr 17 16:58:28 2014 +0200
First step towards new agent bakery
---
modules/check_mk.py | 32 ++++++++++++++++++++++------
web/htdocs/wato.py | 4 ++--
web/plugins/wato/builtin_modules.py | 2 +-
web/plugins/wato/check_mk_configuration.py | 2 +-
4 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 0439188..b5bd412 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -345,6 +345,9 @@ check_periods = []
snmp_check_interval = []
inv_exports = {} # Rulesets for inventory export hooks
+# Rulesets for agent bakery
+agent_config = {}
+
# global variables used to cache temporary values (not needed in check_mk_base)
ip_to_hostname_cache = None
@@ -369,7 +372,7 @@ special_agent_info = {}
# Now include the other modules. They contain everything that is needed
# at check time (and many of what is also needed at administration time).
try:
- modules = [ 'check_mk_base', 'snmp', 'notify',
'prediction', 'cmc', 'inline_snmp' ]
+ modules = [ 'check_mk_base', 'snmp', 'notify',
'prediction', 'cmc', 'inline_snmp', ]
for module in modules:
filename = modules_dir + "/" + module + ".py"
if os.path.exists(filename):
@@ -4690,6 +4693,7 @@ def usage():
cmk --create-rrd [--keepalive|SPEC] create round robin database
cmk -i, --inventory [HOST1 HOST2...] Do a HW/SW-Inventory of some ar all hosts
cmk --inventory-as-check HOST Do HW/SW-Inventory, behave like check plugin
+ cmk -A, --bake-agents [H1 H2 ..] Bake agents for hosts (no in all versions)
cmk -V, --version print version
cmk -h, --help print this help
@@ -4797,16 +4801,16 @@ NOTES:
hosts's parents. It creates the file conf.d/parents.mk which
defines gateway hosts and parent declarations.
- The core can call check_mk without options and the hostname and its IP
- address as arguments. Much faster is using precompiled host checks,
- though.
+ -A, --bake-agents creates RPM/DEB/MSI packages with host-specific
+ monitoring agents. Note: this feature is only contained in the
+ subscription version of Check_MK.
""" % (check_mk_configfile,
precompiled_hostchecks_dir,
snmpwalks_dir,
snmpwalks_dir,
- local_mibs_dir and ("\n You can add further mibs to %s" %
local_mibs_dir) or "",
+ local_mibs_dir and ("\n You can add further MIBs to %s" %
local_mibs_dir) or "",
)
@@ -5819,11 +5823,11 @@ def output_profile():
# Do option parsing and execute main function -
# if check_mk is not called as module
if __name__ == "__main__":
- short_options = 'SHVLCURODMmd:Ic:nhvpXPNBil'
+ short_options = 'ASHVLCURODMmd:Ic:nhvpXPNBil'
long_options = [ "help", "version", "verbose",
"compile", "debug",
"list-checks", "list-hosts",
"list-tag", "no-tcp", "cache",
"flush", "package", "localize",
"donate", "snmpwalk", "oid=", "extraoid=",
- "snmptranslate",
+ "snmptranslate", "bake-agents",
"usewalk", "scan-parents", "procs=",
"automation=", "notify",
"snmpget=", "profile", "keepalive",
"keepalive-fd=", "create-rrd",
"no-cache", "update", "restart",
"reload", "dump", "fake-dns=",
@@ -6027,6 +6031,20 @@ if __name__ == "__main__":
execfile(modules_dir + "/rrd.py")
do_create_rrd(args)
done = True
+ elif o in [ '-A', '--bake-agents' ]:
+ try:
+ execfile(modules_dir + "/agent_bakery.py")
+ except:
+ if opt_debug:
+ raise
+ sys.stderr.write("Agent baking is not implemented in your
version of Check_MK. Sorry.\n")
+ sys.exit(1)
+ if args:
+ hostnames = parse_hostname_list(args, with_clusters = False)
+ else:
+ hostnames = None
+ do_bake_agents(hostnames)
+ done = True
except MKGeneralException, e:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 4d231c9..81370ad 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -16760,16 +16760,16 @@ modes = {
loaded_with_language = False
def load_plugins():
- global extra_buttons
global loaded_with_language
if loaded_with_language == current_language:
return
# Reset global vars
- global extra_buttons, configured_host_tags, host_attributes
+ global extra_buttons, configured_host_tags, host_attributes, modules
extra_buttons = []
configured_host_tags = None
host_attributes = []
+ modules = []
load_notification_table()
diff --git a/web/plugins/wato/builtin_modules.py b/web/plugins/wato/builtin_modules.py
index f1481f9..c680c20 100644
--- a/web/plugins/wato/builtin_modules.py
+++ b/web/plugins/wato/builtin_modules.py
@@ -28,7 +28,7 @@
# defined in a plugin because they contain i18n strings.
# fields: mode, title, icon, permission, help
-modules = [
+modules += [
( "folder", _("Hosts"), "folder",
"hosts",
_("Manage monitored hosts and services and the hosts' folder
structure.")),
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 6e5818e..63cafb0 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -499,7 +499,7 @@ register_configvar(group,
domain = "multisite")
#.
-# .--User Mgmt-----------------------------------------------------------.
+# .--User Management-----------------------------------------------------.
# | _ _ __ __ _ |
# | | | | |___ ___ _ __ | \/ | __ _ _ __ ___ | |_ |
# | | | | / __|/ _ \ '__| | |\/| |/ _` | '_ ` _ \| __| |