Module: check_mk
Branch: master
Commit: 61081c74754cc07bb485c5e370bfd09c22b45ae5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=61081c74754cc0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 10 14:21:17 2017 +0100
4227 New manual WATO configuration lock mechanism
It is now possible to manually lock the WATO configuration for modifications and set
the configuration to read only mode.
You can find the option to configure it below <i>Global Settings > Read only mode</i>.
On that page the WATO configuration can be set to read only mode for all users that are not
permitted to ignore the read only mode. All users that are permitted to set the read only mode
can disable it again when another permitted user enabled it before.
The read only mode can be set permanently or in a specific time window. You can set a message
which is then shown to all users while the read only mode is active.
Change-Id: I94fac7c7c23d49444016dc1ea506cbaa2a61433f
---
.werks/4227 | 20 ++++++
ChangeLog | 1 +
web/htdocs/images/icon_read_only.png | Bin 0 -> 3062 bytes
web/htdocs/wato.py | 125 +++++++++++++++++++++++++++++++++++
web/htdocs/watolib.py | 54 +++++++++++++++
web/htdocs/webapi.py | 3 +
web/plugins/config/wato.py | 1 +
7 files changed, 204 insertions(+)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=61081c7475…
Module: check_mk
Branch: master
Commit: 8fb1f020d6ff80c1a65c9474e6aef85572647f2c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fb1f020d6ff80…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Jan 10 11:39:58 2017 +0100
Fetched livestatus from downstream.
Change-Id: If8f45bed3e75c87bde9c1c6fd9f531c1db38bd69
---
livestatus/src/DownCommColumn.cc | 2 +-
livestatus/src/DowntimeOrComment.cc | 16 +++++-------
livestatus/src/DowntimeOrComment.h | 2 +-
livestatus/src/OffsetBoolColumn.cc | 33 +++++++++++++++++++++++++
livestatus/src/OffsetBoolColumn.h | 49 +++++++++++++++++++++++++++++++++++++
livestatus/src/TableComments.cc | 3 ++-
livestatus/src/TableDowntimes.cc | 3 ++-
7 files changed, 94 insertions(+), 14 deletions(-)
diff --git a/livestatus/src/DownCommColumn.cc b/livestatus/src/DownCommColumn.cc
index 36fe24c..2b6fd30 100644
--- a/livestatus/src/DownCommColumn.cc
+++ b/livestatus/src/DownCommColumn.cc
@@ -63,7 +63,7 @@ bool DownCommColumn::match(DowntimeOrComment *dt, void *data) {
// TableDownComm always enumerates dowtimes/comments for both hosts and
// services, regardless of what we are interested in. So we have to skip the
// ones which have the wrong kind.
- if (_is_service != (dt->_is_service != 0)) {
+ if (_is_service != dt->_is_service) {
return false;
}
diff --git a/livestatus/src/DowntimeOrComment.cc b/livestatus/src/DowntimeOrComment.cc
index 014c9c4..3dee1a7 100644
--- a/livestatus/src/DowntimeOrComment.cc
+++ b/livestatus/src/DowntimeOrComment.cc
@@ -27,19 +27,15 @@
DowntimeOrComment::DowntimeOrComment(nebstruct_downtime_struct *dt,
unsigned long id)
: _type(dt->downtime_type)
+ , _is_service(dt->service_description != nullptr)
+ , _host(find_host(dt->host_name))
+ , _service(_is_service
+ ? find_service(dt->host_name, dt->service_description)
+ : nullptr)
, _entry_time(dt->entry_time)
, _author_name(dt->author_name)
, _comment(dt->comment_data)
- , _id(id) {
- _host = find_host(dt->host_name);
- if (dt->service_description != nullptr) {
- _service = find_service(dt->host_name, dt->service_description);
- _is_service = 1;
- } else {
- _service = nullptr;
- _is_service = 0;
- }
-}
+ , _id(id) {}
DowntimeOrComment::~DowntimeOrComment() = default;
diff --git a/livestatus/src/DowntimeOrComment.h b/livestatus/src/DowntimeOrComment.h
index 3d9c44a..70bf6bb 100644
--- a/livestatus/src/DowntimeOrComment.h
+++ b/livestatus/src/DowntimeOrComment.h
@@ -82,13 +82,13 @@
class DowntimeOrComment {
public:
int _type;
+ bool _is_service;
host *_host;
service *_service;
time_t _entry_time;
std::string _author_name;
std::string _comment;
unsigned long _id;
- int _is_service;
DowntimeOrComment(nebstruct_downtime_struct *dt, unsigned long id);
virtual ~DowntimeOrComment();
diff --git a/livestatus/src/OffsetBoolColumn.cc b/livestatus/src/OffsetBoolColumn.cc
new file mode 100644
index 0000000..578f584
--- /dev/null
+++ b/livestatus/src/OffsetBoolColumn.cc
@@ -0,0 +1,33 @@
+// +------------------------------------------------------------------+
+// | ____ _ _ __ __ _ __ |
+// | / ___| |__ ___ ___| | __ | \/ | |/ / |
+// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+// | | |___| | | | __/ (__| < | | | | . \ |
+// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+// | |
+// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+// +------------------------------------------------------------------+
+//
+// This file is part of Check_MK.
+// The official homepage is at http://mathias-kettner.de/check_mk.
+//
+// check_mk is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation in version 2. check_mk is distributed
+// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU General Public License for more de-
+// tails. You should have received a copy of the GNU General Public
+// License along with GNU Make; see the file COPYING. If not, write
+// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+#include "OffsetBoolColumn.h"
+#include "Column.h"
+
+int32_t OffsetBoolColumn::getValue(void *row, contact * /* auth_user */) {
+ if (auto p = rowData<void>(row)) {
+ return *offset_cast<bool>(p, _offset) ? 1 : 0;
+ }
+ return 0;
+}
diff --git a/livestatus/src/OffsetBoolColumn.h b/livestatus/src/OffsetBoolColumn.h
new file mode 100644
index 0000000..929b923
--- /dev/null
+++ b/livestatus/src/OffsetBoolColumn.h
@@ -0,0 +1,49 @@
+// +------------------------------------------------------------------+
+// | ____ _ _ __ __ _ __ |
+// | / ___| |__ ___ ___| | __ | \/ | |/ / |
+// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+// | | |___| | | | __/ (__| < | | | | . \ |
+// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+// | |
+// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+// +------------------------------------------------------------------+
+//
+// This file is part of Check_MK.
+// The official homepage is at http://mathias-kettner.de/check_mk.
+//
+// check_mk is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation in version 2. check_mk is distributed
+// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU General Public License for more de-
+// tails. You should have received a copy of the GNU General Public
+// License along with GNU Make; see the file COPYING. If not, write
+// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+#ifndef OffsetBoolColumn_h
+#define OffsetBoolColumn_h
+
+#include "config.h" // IWYU pragma: keep
+#include <sys/types.h>
+#include <string>
+#include "OffsetIntColumn.h"
+
+#ifdef CMC
+#include "cmc.h"
+#else
+#include "nagios.h"
+#endif
+
+class OffsetBoolColumn : public OffsetIntColumn {
+public:
+ OffsetBoolColumn(const std::string& name, const std::string& description,
+ int offset, int indirect_offset, int extra_offset,
+ int extra_extra_offset)
+ : OffsetIntColumn(name, description, offset, indirect_offset,
+ extra_offset, extra_extra_offset) {}
+ int32_t getValue(void* row, contact* auth_user) override;
+};
+
+#endif // OffsetBoolColumn_h
diff --git a/livestatus/src/TableComments.cc b/livestatus/src/TableComments.cc
index fbee58d..c82a687 100644
--- a/livestatus/src/TableComments.cc
+++ b/livestatus/src/TableComments.cc
@@ -29,6 +29,7 @@
#include "DowntimeOrComment.h"
#include "DowntimesOrComments.h" // IWYU pragma: keep
#include "MonitoringCore.h"
+#include "OffsetBoolColumn.h"
#include "OffsetIntColumn.h"
#include "OffsetSStringColumn.h"
#include "OffsetTimeColumn.h"
@@ -61,7 +62,7 @@ TableComments::TableComments(const DowntimesOrComments &downtimes_holder,
addColumn(make_unique<OffsetIntColumn>(
"type", "The type of the comment: 1 is host, 2 is service",
DANGEROUS_OFFSETOF(Comment, _type), -1, -1, -1));
- addColumn(make_unique<OffsetIntColumn>(
+ addColumn(make_unique<OffsetBoolColumn>(
"is_service",
"0, if this entry is for a host, 1 if it is for a service",
DANGEROUS_OFFSETOF(Comment, _is_service), -1, -1, -1));
diff --git a/livestatus/src/TableDowntimes.cc b/livestatus/src/TableDowntimes.cc
index 9b2fd64..11628d3 100644
--- a/livestatus/src/TableDowntimes.cc
+++ b/livestatus/src/TableDowntimes.cc
@@ -29,6 +29,7 @@
#include "DowntimeOrComment.h"
#include "DowntimesOrComments.h" // IWYU pragma: keep
#include "MonitoringCore.h"
+#include "OffsetBoolColumn.h"
#include "OffsetIntColumn.h"
#include "OffsetSStringColumn.h"
#include "OffsetTimeColumn.h"
@@ -62,7 +63,7 @@ TableDowntimes::TableDowntimes(const DowntimesOrComments &downtimes_holder,
"type",
"The type of the downtime: 0 if it is active, 1 if it is pending",
DANGEROUS_OFFSETOF(Downtime, _type), -1, -1, -1));
- addColumn(make_unique<OffsetIntColumn>(
+ addColumn(make_unique<OffsetBoolColumn>(
"is_service",
"0, if this entry is for a host, 1 if it is for a service",
DANGEROUS_OFFSETOF(Downtime, _is_service), -1, -1, -1));
Module: check_mk
Branch: master
Commit: 4cbbddf8f2e259e2be7fba8474c9fa753ceedf65
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4cbbddf8f2e259…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 9 17:05:28 2017 +0100
Cleaned up twice initialized vars
Change-Id: Iab0b14bf7adac51e76421b1229476bcedbaee347
---
web/htdocs/availability.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index 67f51bc..06aa0ef 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -684,9 +684,6 @@ def compute_availability(what, av_rawdata, avoptions):
os_aggrs, os_states = get_outage_statistic_options(avoptions)
need_statistics = os_aggrs and os_states
grouping = avoptions["grouping"]
- timeline_rows = [] # Need this as a global variable if just one service is affected
- total_duration = 0
- considered_duration = 0
# Note: in case of timeline, we have data from exacly one host/service
for site_host, site_host_entry in reclassified_rawdata.iteritems():
@@ -1264,11 +1261,13 @@ def layout_availability_table(what, group_title, availability_table, avoptions):
for sid, css, sname, help in availability_columns[what]:
if not cell_active(sid, avoptions):
continue
+
number = summary.get(sid, 0)
if show_summary == "average" or avoptions["timeformat"].startswith("percentage"):
number /= len_availability_table
if avoptions["timeformat"].startswith("percentage"):
number *= entry["considered_duration"]
+
if not number:
css = "unused"
Module: check_mk
Branch: master
Commit: 2ad76288321e3eaf909a54e18375d49488a54284
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2ad76288321e3e…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Wed Jan 4 10:32:53 2017 +0100
4184 FIX hivemanager_devices: Fixed bug if device is up for more than 1 year
The checkplugin does not crash anymore if a device is up for more than 1 year.
Change-Id: I72143751b5d011a6ea4833e0b8d273e87fbe2490
---
.werks/4184 | 10 ++++++++++
ChangeLog | 1 +
checks/hivemanager_devices | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/.werks/4184 b/.werks/4184
new file mode 100644
index 0000000..9ae048e
--- /dev/null
+++ b/.werks/4184
@@ -0,0 +1,10 @@
+Title: hivemanager_devices: Fixed bug if device is up for more than 1 year
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i4
+Date: 1483522214
+Class: fix
+
+The checkplugin does not crash anymore if a device is up for more than 1 year.
+
diff --git a/ChangeLog b/ChangeLog
index 2a90dd8..073a4c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,7 @@
* 4182 FIX: mysql_slave: fixed crash if agent output is empty...
* 4176 FIX: postfix_mailq_status: fixed wrong status handling
* 4183 FIX: ibm_imm_fan: Fixed crash if fan speed is "unavailable"...
+ * 4184 FIX: hivemanager_devices: Fixed bug if device is up for more than 1 year...
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can now be configured via global settings....
diff --git a/checks/hivemanager_devices b/checks/hivemanager_devices
index 9a91de5..a440041 100644
--- a/checks/hivemanager_devices
+++ b/checks/hivemanager_devices
@@ -81,7 +81,7 @@ def check_hivemanager_devices(item, params, info):
uptime_secs = 0
if infos['upTime'] != 'down':
uptime_tokens = map(int, infos['upTime'].split()[-2::-2])
- token_multiplier = [1, 60, 3600, 86400]
+ token_multiplier = [1, 60, 3600, 86400, 31536000]
for idx, entry in enumerate(uptime_tokens):
uptime_secs += token_multiplier[idx] * entry
infotext = "Uptime: %s" % get_age_human_readable(uptime_secs)