Module: check_mk
Branch: master
Commit: 4cef91f45d67e71c13fbefa0e9332950d70f6d04
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4cef91f45d67e7…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Feb 5 13:03:11 2014 +0100
fixed broken inventory function
---
modules/check_mk.py | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 72b5abd..7e09c8a 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2645,7 +2645,6 @@ def quote_nagios_string(s):
# '----------------------------------------------------------------------'
def do_inventory(hostnames, checknames, only_new):
-
# For clusters add their nodes to the list
nodes = []
for h in hostnames:
@@ -2663,18 +2662,17 @@ def do_inventory(hostnames, checknames, only_new):
else:
sys.stdout.write("Inventorizing all hosts.\n")
- if inventory_checks:
- checknames = inventory_checks.split(",")
-
# remove existing checks, if option -I is used twice
if seen_I > 1:
- if inventory_checks == None:
- checknames = inventorable_checktypes("all")
+ if not checknames:
+ checks_to_remove = inventorable_checktypes("all")
+ else:
+ checks_to_remove = checknames
if len(hostnames) > 0:
# Entries in hostnames that are either prefixed with @
# or are no valid hostnames are considered to be tags.
for host in hostnames:
- remove_autochecks_of(host, checknames)
+ remove_autochecks_of(host, checks_to_remove)
# If all nodes of a cluster are contained in the list, then
# also remove the autochecks of that cluster. Beware: a host
# can be part more multiple clusters
@@ -2687,7 +2685,7 @@ def do_inventory(hostnames, checknames, only_new):
if len(missing) == 0:
if opt_verbose:
sys.stdout.write("All nodes of %s specified, dropping checks of %s, too.\n" % (clust, node))
- remove_autochecks_of(clust, checknames)
+ remove_autochecks_of(clust, checks_to_remove)
else:
sys.stdout.write("Warning: %s is part of cluster %s, but you didn't specify %s as well.\nChecks on %s will be kept.\n" %
@@ -2695,10 +2693,10 @@ def do_inventory(hostnames, checknames, only_new):
else:
for host in all_active_hosts() + all_active_clusters():
- remove_autochecks_of(host, checknames)
+ remove_autochecks_of(host, checks_to_remove)
reread_autochecks()
- if inventory_checks == None:
+ if checknames == None:
do_snmp_scan(hostnames)
checknames = inventorable_checktypes("tcp")
Module: check_mk
Branch: master
Commit: b79eee3701c9b119ce845a0bf00659ddded3cfa9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b79eee3701c9b1…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 4 15:16:45 2014 +0100
FIX Fix language jumping to German when saving user profiles
---
.werks/690 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 2 +-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/.werks/690 b/.werks/690
new file mode 100644
index 0000000..5bd5a60
--- /dev/null
+++ b/.werks/690
@@ -0,0 +1,9 @@
+Title: Fix language jumping to German when saving user profiles
+Level: 2
+Component: wato
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1391523357
+
+
diff --git a/ChangeLog b/ChangeLog
index 803b5ec..52f3e89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -252,6 +252,7 @@
* 0269 FIX: brocade_fcport: fixed problem on displaying check_parameters in WATO...
* 0271 FIX: Fixed sorting in duallist element (two lists with interchangable elements)...
* 0131 FIX: Error rates for network interfaces can now be set smaller then 0.1 when using Wato....
+ * 0690 FIX: Fix language jumping to German when saving user profiles
Notifications:
* 0362 sms: now searching PATH for sendsms and smssend commands...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index f1edb20..acf36c8 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -13126,7 +13126,7 @@ def HostnameTranslation(**kwargs):
def select_language(user_language):
languages = [ l for l in get_languages() if not config.hide_language(l[0]) ]
- inactive = user_language != ''
+ inactive = not not user_language
if languages:
forms.section(_("Language"),
Module: check_mk
Branch: master
Commit: d8aeca6898566d4a3d161e2288f51b23f766b021
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d8aeca6898566d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 4 14:42:07 2014 +0100
check_dns: allow to specify multiple expected answers
---
.werks/697 | 8 ++++++++
ChangeLog | 1 +
checks/check_dns | 7 ++++++-
web/plugins/wato/active_checks.py | 20 +++++++++++++-------
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/.werks/697 b/.werks/697
new file mode 100644
index 0000000..7a48eaf
--- /dev/null
+++ b/.werks/697
@@ -0,0 +1,8 @@
+Title: check_dns: allow to specify multiple expected answers
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1391521300
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 6345c5f..803b5ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -80,6 +80,7 @@
* 0698 emc_isilon.nodehealth: new check for EMC Isilon Storage systems: NodeHealth
* 0699 emc_isilon_iops: New check for Disk Operations per Second (IOPS) in EMC Isilon Storage
* 0132 New checks fjdarye101_disks fjdarye101_rluns: Fujitsu Storage Systems with 2013 Firmware
+ * 0697 check_dns: allow to specify multiple expected answers
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checks/check_dns b/checks/check_dns
index f655577..4ac542c 100644
--- a/checks/check_dns
+++ b/checks/check_dns
@@ -34,7 +34,12 @@ def check_dns_arguments(params):
args += " -s '$HOSTADDRESS$'"
if "expected_address" in settings:
- args += ' -a %s' % quote_shell_string(settings["expected_address"])
+ # Convert from old (str) to new (list of strings)
+ exp = settings["expected_address"]
+ if type(exp) in ( str, unicode ):
+ exp = [ exp ]
+ for entry in exp:
+ args += ' -a %s' % quote_shell_string(entry)
if settings.get("expected_authority"):
args += ' -A'
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 9f61da3..0cc357c 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -168,8 +168,10 @@ register_rule(group,
help = _("Check the resolution of a hostname into an IP address by a DNS server. "
"This check uses <tt>check_dns</tt> from the standard Nagios plugins."),
elements = [
- TextAscii(title = _("Hostname"), allow_empty = False,
- help = _('The name or address you want to query')),
+ TextAscii(
+ title = _("Queried Hostname or IP address"),
+ allow_empty = False,
+ help = _('The name or IPv4 address you want to query')),
Dictionary(
title = _("Optional parameters"),
elements = [
@@ -179,11 +181,15 @@ register_rule(group,
allow_empty = False,
help = _("Optional DNS server you want to use for the lookup"))),
( "expected_address",
- TextAscii(
- title = _("Expected Address"),
- allow_empty = False,
- help = _("Optional IP-Address you expect the DNS server to return. The host "
- "must end with a dot (.) " )),
+ Transform(
+ ListOfStrings(
+ title = _("Expected answer (IP address or hostname)"),
+ help = _("List all allowed expected answers here. If query for an "
+ "IP address then the answer will be host names, that end "
+ "with a dot."),
+ ),
+ forth = lambda old: type(old) in (str, unicode) and [old] or old,
+ ),
),
( "expected_authority",
FixedValue(
Module: check_mk
Branch: master
Commit: 113435629904a491a02ef0c4a26f418a41fadb67
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=113435629904a4…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 4 14:18:07 2014 +0100
Internal code cleanup for inventory function
---
modules/check_mk.py | 144 ++++++++++++++++++++++++++-------------------------
1 file changed, 73 insertions(+), 71 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 2d64184..6ea87b1 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2633,6 +2633,70 @@ def quote_nagios_string(s):
# | Automatic service detection |
# '----------------------------------------------------------------------'
+def do_inventory(hostnames, checknames, only_new):
+
+ # For clusters add their nodes to the list
+ nodes = []
+ for h in hostnames:
+ nodes = nodes_of(h)
+ if nodes:
+ hostnames += nodes
+
+ # Then remove clusters and make list unique
+ hostnames = list(set([ h for h in hostnames if not is_cluster(h) ]))
+ hostnames.sort()
+
+ if opt_verbose:
+ if len(hostnames) > 0:
+ sys.stdout.write("Inventorizing %s.\n" % ", ".join(hostnames))
+ else:
+ sys.stdout.write("Inventorizing all hosts.\n")
+
+ if inventory_checks:
+ checknames = inventory_checks.split(",")
+
+ # remove existing checks, if option -I is used twice
+ if seen_I > 1:
+ if inventory_checks == None:
+ checknames = inventorable_checktypes("all")
+ if len(hostnames) > 0:
+ # Entries in hostnames that are either prefixed with @
+ # or are no valid hostnames are considered to be tags.
+ for host in hostnames:
+ remove_autochecks_of(host, checknames)
+ # If all nodes of a cluster are contained in the list, then
+ # also remove the autochecks of that cluster. Beware: a host
+ # can be part more multiple clusters
+ for clust in clusters_of(host):
+ missing = [] # collect nodes missing on the command line
+ for node in nodes_of(clust):
+ if node not in hostnames:
+ missing.append(node)
+
+ if len(missing) == 0:
+ if opt_verbose:
+ sys.stdout.write("All nodes of %s specified, dropping checks of %s, too.\n" % (clust, node))
+ remove_autochecks_of(clust, checknames)
+
+ else:
+ sys.stdout.write("Warning: %s is part of cluster %s, but you didn't specify %s as well.\nChecks on %s will be kept.\n" %
+ (host, clust, ",".join(missing), clust))
+
+ else:
+ for host in all_active_hosts() + all_active_clusters():
+ remove_autochecks_of(host, checknames)
+ reread_autochecks()
+
+ if inventory_checks == None:
+ do_snmp_scan(hostnames)
+ checknames = inventorable_checktypes("tcp")
+
+ for checkname in checknames:
+ make_inventory(checkname, hostnames, False)
+
+ do_cleanup_autochecks()
+
+
def inventorable_checktypes(what): # snmp, tcp, all
checknames = [ k for k in check_info.keys()
@@ -5689,7 +5753,7 @@ if __name__ == "__main__":
done = False
seen_I = 0
- inventory_checks = None
+ check_types = None
# Scan modifying options first (makes use independent of option order)
for o,a in opts:
if o in [ '-v', '--verbose' ]:
@@ -5725,7 +5789,7 @@ if __name__ == "__main__":
elif o == '-I':
seen_I += 1
elif o == "--checks":
- inventory_checks = a
+ check_types = a.split(",")
elif o == "--cmc-file":
opt_cmc_relfilename = a
@@ -5859,70 +5923,11 @@ if __name__ == "__main__":
raise
sys.exit(3)
+ # handle -I / -II
if not done and seen_I > 0:
-
hostnames = parse_hostname_list(args)
- # For clusters add their nodes to the list
- nodes = []
- for h in hostnames:
- nodes = nodes_of(h)
- if nodes:
- hostnames += nodes
-
- # Then remove clusters and make list unique
- hostnames = list(set([ h for h in hostnames if not is_cluster(h) ]))
- hostnames.sort()
-
- if opt_verbose:
- if len(hostnames) > 0:
- sys.stdout.write("Inventorizing %s.\n" % ", ".join(hostnames))
- else:
- sys.stdout.write("Inventorizing all hosts.\n")
-
- if inventory_checks:
- checknames = inventory_checks.split(",")
-
- # remove existing checks, if option -I is used twice
- if seen_I > 1:
- if inventory_checks == None:
- checknames = inventorable_checktypes("all")
- if len(hostnames) > 0:
- # Entries in hostnames that are either prefixed with @
- # or are no valid hostnames are considered to be tags.
- for host in hostnames:
- remove_autochecks_of(host, checknames)
- # If all nodes of a cluster are contained in the list, then
- # also remove the autochecks of that cluster. Beware: a host
- # can be part more multiple clusters
- for clust in clusters_of(host):
- missing = [] # collect nodes missing on the command line
- for node in nodes_of(clust):
- if node not in hostnames:
- missing.append(node)
-
- if len(missing) == 0:
- if opt_verbose:
- sys.stdout.write("All nodes of %s specified, dropping checks of %s, too.\n" % (clust, node))
- remove_autochecks_of(clust, checknames)
-
- else:
- sys.stdout.write("Warning: %s is part of cluster %s, but you didn't specify %s as well.\nChecks on %s will be kept.\n" %
- (host, clust, ",".join(missing), clust))
-
- else:
- for host in all_active_hosts() + all_active_clusters():
- remove_autochecks_of(host, checknames)
- reread_autochecks()
-
- if inventory_checks == None:
- do_snmp_scan(hostnames)
- checknames = inventorable_checktypes("tcp")
-
- for checkname in checknames:
- make_inventory(checkname, hostnames, False)
-
- do_cleanup_autochecks()
-
+ do_inventory(hostnames, check_types, seen_I == 1)
+ done = True
if done:
output_profile()
@@ -5930,10 +5935,13 @@ if __name__ == "__main__":
elif (len(args) == 0 and not opt_keepalive) or len(args) > 2:
usage()
sys.exit(1)
+
+ # handle --keepalive
elif opt_keepalive:
do_check_keepalive()
- else:
+ # handle adhoc-check
+ else:
hostname = args[0]
if len(args) == 2:
ipaddress = args[1]
@@ -5947,11 +5955,5 @@ if __name__ == "__main__":
print "Cannot resolve hostname '%s'." % hostname
sys.exit(2)
- # honor --checks= also when checking (makes testing easier)
- if inventory_checks:
- check_types = inventory_checks.split(",")
- else:
- check_types = None
-
do_check(hostname, ipaddress, check_types)