Module: check_mk
Branch: master
Commit: e89b6bea3492dc62e5bb4f4f291816b11c4805c2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e89b6bea3492dc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sun Nov 27 13:22:53 2016 +0100
4074 FIX check_ftp: Fixed possible wrong service description caused by unintended use of global variable
---
.werks/4074 | 10 ++++++++++
ChangeLog | 1 +
checks/check_ftp | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/.werks/4074 b/.werks/4074
new file mode 100644
index 0000000..6ad62b4
--- /dev/null
+++ b/.werks/4074
@@ -0,0 +1,10 @@
+Title: check_ftp: Fixed possible wrong service description caused by unintended use of global variable
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i3
+Date: 1480249368
+
+
diff --git a/ChangeLog b/ChangeLog
index c0620ea..938124a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,7 @@
* 4092 FIX: if.include: fixed wrong calculated number of interfaces which are up in case of interface groups
* 4093 FIX: oracle_tablespaces: Werk 3907 broke the space calculation...
* 3942 FIX: rstcli: fixed previously failing check, changed check output to provide more information...
+ * 4074 FIX: check_ftp: Fixed possible wrong service description caused by unintended use of global variable
Multisite:
* 4070 Added a painter for the service check period
diff --git a/checks/check_ftp b/checks/check_ftp
index b3c0e34..1a7739b 100644
--- a/checks/check_ftp
+++ b/checks/check_ftp
@@ -73,7 +73,7 @@ def check_ftp_arguments(params):
def check_ftp_get_item(params):
if type(params) == tuple:
- return "FTP " + args[0]
+ return "FTP " + params[0]
else:
if "port" in params and params["port"] != 21:
return "FTP Port " + str(params["port"])
Module: check_mk
Branch: master
Commit: 869d9e28aca8f152c64434d50c5a548e1296d492
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=869d9e28aca8f1…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Nov 25 16:41:45 2016 +0100
3993 Some minor performance improvements during config generation
Rules with host tags as well as explicit set host names now being processed faster.
However, those kinds of rules are quite rare...
---
.werks/3993 | 10 ++++++++++
ChangeLog | 1 +
modules/check_mk.py | 26 ++++++++++++++++++--------
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/.werks/3993 b/.werks/3993
new file mode 100644
index 0000000..60d0d0d
--- /dev/null
+++ b/.werks/3993
@@ -0,0 +1,10 @@
+Title: Some minor performance improvements during config generation
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i3
+Date: 1480088343
+Class: feature
+
+Rules with host tags as well as explicit set host names now being processed faster.
+However, those kinds of rules are quite rare...
diff --git a/ChangeLog b/ChangeLog
index fe41b15..b93da3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
* 4096 avaya_chassis_card, avaya_chassis_ps, avaya_chassis_temp: New checks for Avaya devices...
* 4094 apc_rackpdu_power: now detects all phases or banks connected to this pdu
NOTE: Please refer to the migration notes!
+ * 3993 Some minor performance improvements during config generation...
* 3987 FIX: Check_MK Agent Access: Windows agent reported incorrect only from value
* 3952 FIX: diskstat: fixed bug if multipath devices having an alias...
* 3939 FIX: f5_bigip_conns: readded performance data and graphs...
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 173df00..d2bc850 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -893,16 +893,26 @@ def all_matching_hosts(tags, hostlist, with_foreign_hosts):
else:
valid_hosts = all_active_hosts()
- # Speed up matching process by filter out single matches
+ # Contains matched hosts
matching = set([])
- if not tags and not [x for x in hostlist if x[0] in ["@", "!", "~"]]:
- for hostname in hostlist:
- if hostname in valid_hosts:
- matching.add(hostname)
- elif not tags and len(hostlist) == 1 and "@all" in hostlist:
- matching.update(set(valid_hosts))
+
+ # Check if the rule has only specific hosts set
+ only_specific_hosts = not bool([x for x in hostlist if x[0] in ["@", "!", "~"]])
+
+ # If no tags are specified and there are only specific hosts we already have the matches
+ if not tags and only_specific_hosts:
+ matching = valid_hosts.intersection(hostlist)
+ # If no tags are specified and the hostlist only include @all (all hosts)
+ elif not tags and hostlist == [ "@all" ]:
+ matching = valid_hosts
else:
- for hostname in valid_hosts:
+ # If the rule has only exact host restrictions, we can thin out the list of hosts to check
+ if only_specific_hosts:
+ hosts_to_check = valid_hosts.intersection(set(hostlist))
+ else:
+ hosts_to_check = valid_hosts
+
+ for hostname in hosts_to_check:
# When no tag matching is requested, do not filter by tags. Accept all hosts
# and filter only by hostlist
if in_extraconf_hostlist(hostlist, hostname) and \