Module: check_mk
Branch: master
Commit: 1689da10fefe030eb743a9e1ff50f05c847f6599
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1689da10fefe03…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Apr 9 13:04:22 2014 +0200
FIX windows_updates: now handles situations with forced reboot and no limits correctly
---
.werks/604 | 9 +++++++++
ChangeLog | 3 ++-
checks/windows_updates | 15 +++++++++++----
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/.werks/604 b/.werks/604
new file mode 100644
index 0000000..6a130a7
--- /dev/null
+++ b/.werks/604
@@ -0,0 +1,9 @@
+Title: windows_updates: now handles situations with forced reboot and no limits
correctly
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i3
+Date: 1397041383
+
+
diff --git a/ChangeLog b/ChangeLog
index d064fba..2033f9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,10 +22,11 @@
* 0786 FIX: zfsget: fixed compatibility with older Solaris agents...
* 0809 FIX: brocade_fcport: Fixed recently introduced problem with port speed
detection
* 0787 FIX: df: fixed problems on some filesystem checks when legacy check parameters
where used...
- * 0603 FIX: cmciii checks: more general scan function plus perf-o-meters for humidity
and temperature checks
* 0803 FIX: agent_ibmsvc: raw data for System Info Check and License Check now in
correct format...
* 0788 FIX: oracle_tablespaces: now able to bear None values as warn/crit levels...
* 0789 FIX: oracle_tablespaces: fixed bug when using dynamic filesystem levels...
+ * 0603 FIX: cmciii checks: more general scan function plus perf-o-meters for humidity
and temperature checks
+ * 0604 FIX: windows_updates: now handles situations with forced reboot and no limits
correctly
Multisite:
* 0779 Hostgroups (Summary): Empty hostgroups are no longer shown (can be re-enabled
by filter)
diff --git a/checks/windows_updates b/checks/windows_updates
index 031d0da..1a6c153 100644
--- a/checks/windows_updates
+++ b/checks/windows_updates
@@ -98,15 +98,22 @@ def check_windows_updates(_unused, params, info):
hour, minute, second = map(int, time.split(":"))
force_date = datetime.datetime( year, month, day, hour, minute, second)
now = datetime.datetime.now()
- diff_warn = datetime.timedelta(seconds=force_warn)
- diff_crit = datetime.timedelta(seconds=force_crit)
nix = datetime.timedelta(seconds=0)
+ # check if force_date is in the future
if force_date - now > nix:
+ if force_crit:
+ diff_crit = datetime.timedelta(seconds=force_crit)
+ else:
+ diff_crit = None
+ if force_warn:
+ diff_warn = datetime.timedelta(seconds=force_warn)
+ else:
+ diff_warn = None
sym = ""
- if diff_crit > force_date - now:
+ if diff_crit and diff_crit > force_date - now:
status = 2
sym = "(!!)"
- elif diff_warn > force_date - now:
+ elif diff_warn and diff_warn > force_date - now:
if status < 1:
status = 1
sym = "(!)"