Module: check_mk
Branch: master
Commit: 68999dfa1aa144059cf13e9f47045b05c5b357f7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=68999dfa1aa144…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Fri Apr 8 11:44:32 2016 +0200
3117 FIX windows agent: fixed installer may fail to re-start service on update
When updating the agent (i.e. through the auto updater) there was only a fairly short timeout for
the agent-service to stop.
If the agent failed to stop in time (i.e. because of a long-running plugin) the agent was still
installed but the service wasn't started afterwards.
This has now been fixed by enforcing an unlimited wait when the service is being shut down.
---
.werks/3117 | 14 ++++++++++++++
ChangeLog | 1 +
agents/windows/check_mk_agent.cc | 29 +++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
diff --git a/.werks/3117 b/.werks/3117
new file mode 100644
index 0000000..9d71fed
--- /dev/null
+++ b/.werks/3117
@@ -0,0 +1,14 @@
+Title: windows agent: fixed installer may fail to re-start service on update
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1460108180
+
+When updating the agent (i.e. through the auto updater) there was only a fairly short timeout for
+the agent-service to stop.
+If the agent failed to stop in time (i.e. because of a long-running plugin) the agent was still
+installed but the service wasn't started afterwards.
+This has now been fixed by enforcing an unlimited wait when the service is being shut down.
diff --git a/ChangeLog b/ChangeLog
index 087fa9c..118acca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -135,6 +135,7 @@
* 3368 FIX: Fixed regression since 1.2.8b9 which broke all SNMP checks with Nagios core
* 3370 FIX: check_mail: Fixed mail parsing bug when using POP3
* 3372 FIX: check_mailboxes: Improved error handling
+ * 3117 FIX: windows agent: fixed installer may fail to re-start service on update...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index 471491c..5e18b11 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -277,6 +277,13 @@ void debug_script_container(script_container *container) {
crash_log("buffer_work: \n<<<<\n%s\n>>>>", container->buffer_work);
}
+
+template <typename T>
+bool in_set(const T &val, const std::set<T> &test_set) {
+ return test_set.find(val) != test_set.end();
+}
+
+
// .----------------------------------------------------------------------.
// | ______ _ _ _ ______ |
// | / / / /___ _ _ ___| |_ ___ _ __ ___ | |_(_)_ __ ___ ___\ \ \ \ |
@@ -2708,6 +2715,28 @@ void UninstallService() {
if (service) {
SERVICE_STATUS serviceStatus;
if (QueryServiceStatus(service, &serviceStatus)) {
+ while (in_set(serviceStatus.dwCurrentState,
+ {SERVICE_RUNNING, SERVICE_STOP_PENDING})) {
+ if (serviceStatus.dwCurrentState == SERVICE_STOP_PENDING) {
+ printf(SERVICE_NAME " waiting for service to finish\n");
+ // wait for the wait-hint but no less than 1 second and
+ // no more than 10
+ DWORD waitTime = serviceStatus.dwWaitHint / 10;
+ waitTime =
+ std::max(1000UL, std::min(waitTime, 10000UL));
+ Sleep(waitTime);
+ if (!QueryServiceStatus(service, &serviceStatus)) {
+ break;
+ }
+ } else {
+ if (ControlService(service, SERVICE_CONTROL_STOP,
+ &serviceStatus) == 0) {
+ break;
+ }
+ printf(SERVICE_NAME " stopped\n");
+ }
+ }
+
if (serviceStatus.dwCurrentState == SERVICE_STOPPED) {
if (DeleteService(service))
printf(SERVICE_NAME " Removed Successfully\n");
Module: check_mk
Branch: master
Commit: 690128b3a5138d041bbb83313bfeb0d51f054695
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=690128b3a5138d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Apr 8 09:56:58 2016 +0200
3394 Availability: Annotations can now be used to reclassify the scheduled downtime status
The availability computation of hosts and services now allows to use the
existing {{Annotations}} in order to reclassify the annotated periods as
having been in scheduled downtime or even as not having been in scheduled
downtime. That way you can fix your figures in case one has forgotten to enter
a scheduled downtime in the past or in the case that scheduled downtimes
were just used in order to disable notifications (but the breakdown was in
fact real and not scheduled).
Availability of BI aggregations currently does not support annotations or any
reclassifications. Neither does it honor reclassifications in the underlying
host and service history.
---
.werks/3394 | 19 +++++++++++++++++++
ChangeLog | 1 +
web/htdocs/availability.py | 4 ++--
web/plugins/views/availability.py | 6 ------
4 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/.werks/3394 b/.werks/3394
new file mode 100644
index 0000000..537b617
--- /dev/null
+++ b/.werks/3394
@@ -0,0 +1,19 @@
+Title: Availability: Annotations can now be used to reclassify the scheduled downtime status
+Level: 2
+Component: reporting
+Compatible: compat
+Version: 1.2.9i1
+Date: 1460101981
+Class: feature
+
+The availability computation of hosts and services now allows to use the
+existing {{Annotations}} in order to reclassify the annotated periods as
+having been in scheduled downtime or even as not having been in scheduled
+downtime. That way you can fix your figures in case one has forgotten to enter
+a scheduled downtime in the past or in the case that scheduled downtimes
+were just used in order to disable notifications (but the breakdown was in
+fact real and not scheduled).
+
+Availability of BI aggregations currently does not support annotations or any
+reclassifications. Neither does it honor reclassifications in the underlying
+host and service history.
diff --git a/ChangeLog b/ChangeLog
index a485aa0..821623d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -257,6 +257,7 @@
Reporting & Availability:
* 3267 New availability option for reclassifying host state "unreachable"...
* 3102 added option to availability to include host alias in reports...
+ * 3394 Availability: Annotations can now be used to reclassify the scheduled downtime status...
* 3249 FIX: Fix missing filter for non-OK services when report is called via context button
* 3268 FIX: Availability options were invalid after resetting them...
* 3269 FIX: Fix rendering of floating point values < 1 in graphs (e.g. CPU load)
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index d05b2c5..43115df 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -762,8 +762,8 @@ def compute_availability(what, av_rawdata, avoptions):
return filtered_table
-# TODO: Wir müssen auch den Fall behandeln, dass ein Host reklassifiert wird.
-# dann müssen die Services das Feld in_host_downtime ebenfalls nachziehen!
+# Note: Reclassifications of host/service periods do currently *not* have
+# any impact on BI aggregations.
def reclassify_by_annotations(what, av_rawdata):
annotations = load_annotations()
if not annotations:
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 47a238b..7f57dc7 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -24,12 +24,6 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# ZUTUN / TODO:
-#
-# - Test mit Hosts und BI-Aggregaten
-# - Host-Annotations nicht mehrfach zeigen!
-
-
import availability, table
from valuespec import *