Module: check_mk
Branch: master
Commit: 908ace29c5fb1fb5557d697eff2cae3005d015f6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=908ace29c5fb1f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 4 14:43:57 2016 +0100
Fixed needless try to reimport all plugins when user is not using a custom localization
---
web/htdocs/index.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index 61f7769..7e8abc7 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -109,8 +109,11 @@ def handler(req, fields = None, is_profiling = False):
# has been initialized
i18n.localize(html.var("lang", config.get_language()))
- # All plugins might have to be reloaded due to a language change
- modules.load_all_plugins()
+ # All plugins might have to be reloaded due to a language change. Only trigger
+ # a second plugin loading when the user is really using a custom localized GUI.
+ # Otherwise the load_all_plugins() at the beginning of the request is sufficient.
+ if current_language != None:
+ modules.load_all_plugins()
# User allowed to login at all?
if not config.may("general.use"):
Module: check_mk
Branch: master
Commit: bc604396695164b2bc4b759098d3aaf46a5fc6cd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bc604396695164…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 4 14:42:11 2016 +0100
Fixed circular module dependency between views/bi causing modules to be imported multiple times
---
web/htdocs/bi.py | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 019f7b9..b4c5200 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -24,7 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-import config, re, pprint, time, views
+import config, re, pprint, time
import sites
from lib import *
@@ -1913,9 +1913,6 @@ def singlehost_table(columns, add_headers, only_sites, limit, filters, joinbynam
hostrows = get_status_info_filtered(filter_code, only_sites, limit, host_columns, config.bi_precompile_on_demand, bygroup)
log("* Got %d host rows" % len(hostrows))
- # if limit:
- # views.check_limit(hostrows, limit)
-
# Apply aggregation group filter. This is important for performance. We
# must not compute any aggregations from other aggregation groups and filter
# them later out again.
Module: check_mk
Branch: master
Commit: 190d9109e9b8c55d013fcf38e87dfbba06a20765
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=190d9109e9b8c5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 4 12:00:34 2016 +0100
Introduced support for the unified vertical axis scaled unit
---
web/htdocs/lib.py | 38 +++++++++++++++++++++++++++++---------
web/plugins/metrics/check_mk.py | 24 ++++++++++++++++++++----
2 files changed, 49 insertions(+), 13 deletions(-)
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 3725f19..b99acab 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -529,11 +529,36 @@ def frexp10(x):
# Note if the type of v is integer, then the precision cut
# down to the precision of the actual number
def physical_precision(v, precision, unit_symbol):
- if v == 0:
- return "%%.%df %%s" % (precision - 1) % (v, unit_symbol)
- elif v < 0:
+ if v < 0:
return "-" + physical_precision(-v, precision, unit_symbol)
+ scale_symbol, places_after_comma, scale_factor = calculate_physical_precision(v, precision)
+
+ scaled_value = float(v) / scale_factor
+ return (u"%%.%df %%s%%s" % places_after_comma) % (scaled_value, scale_symbol, unit_symbol)
+
+
+def physical_precision_list(values, precision, unit_symbol):
+ if not values:
+ reference = 0
+ else:
+ reference = min([ abs(v) for v in values ])
+
+ scale_symbol, places_after_comma, scale_factor = calculate_physical_precision(reference, precision)
+
+ units = []
+ scaled_values = []
+ for value in values:
+ scaled_value = float(value) / scale_factor
+ scaled_values.append(("%%.%df" % places_after_comma) % scaled_value)
+
+ return "%s%s" % (scale_symbol, unit_symbol), scaled_values
+
+
+def calculate_physical_precision(v, precision):
+ if v == 0:
+ return "", precision - 1, 1
+
# Splitup in mantissa (digits) an exponent to the power of 10
# -> a: (2.23399998, -2) b: (4.5, 6) c: (1.3756, 2)
mantissa, exponent = frexp10(float(v))
@@ -541,10 +566,6 @@ def physical_precision(v, precision, unit_symbol):
if type(v) == int:
precision = min(precision, exponent + 1)
- # Round the mantissa to the required number of digits
- # -> a: 2.23 b: 4.5 c: 1.38
- mant_rounded = round(mantissa, precision-1) * 10**exponent
-
# Choose a power where no artifical zero (due to rounding) needs to be
# placed left of the decimal point.
scale_symbols = {
@@ -575,9 +596,8 @@ def physical_precision(v, precision, unit_symbol):
places_before_comma = exponent + 1
places_after_comma = precision - places_before_comma
- value = mantissa * 10**exponent
+ return scale_symbols[scale], places_after_comma, 1000**abs(scale)
- return u"%%.%df %%s%%s" % places_after_comma % (value, scale_symbols[scale], unit_symbol)
def nic_speed_human_readable(bits_per_second):
if bits_per_second == 10000000:
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index cf60440..f9aae56 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -42,6 +42,22 @@
# +----------------------------------------------------------------------+
# | Definition of units of measurement. |
# '----------------------------------------------------------------------'
+# Optional attributes of units:
+#
+# stepping: FIXME: Describe this
+#
+# graph_unit: Compute a common unit for the whole graph. This is an optional
+# feature to solve the problem that some unit names are too long
+# to be shown on the left of the screen together with the values.
+# For fixing this the "graph unit" is available which is displayed
+# on the top left of the graph and is used for the whole graph. So
+# once a "graph unit" is computed, it does not need to be shown
+# beside each label.
+# This has to be set to a function which recevies a list of values,
+# then computes the optimal unit for the given values and then
+# returns a two element tuple. The first element is the "graph unit"
+# and the second is a list containing all of the values rendered with
+# the graph unit.
# TODO: Move fundamental units like "" to main file.
@@ -67,7 +83,6 @@ unit_info["%"] = {
"render" : lambda v: percent_human_redable(v, 3),
}
-
unit_info["s"] = {
"title" : _("sec"),
"description" : _("Timespan or Duration in seconds"),
@@ -106,9 +121,10 @@ unit_info["bytes/s"] = {
}
unit_info["bits/s"] = {
- "title" : _("Bits per second"),
- "symbol" : _("bits/s"),
- "render" : lambda v: physical_precision(v, 3, _("bit/s")),
+ "title" : _("Bits per second"),
+ "symbol" : _("bits/s"),
+ "render" : lambda v: physical_precision(v, 3, _("bit/s")),
+ "graph_unit" : lambda v: physical_precision_list(v, 3, _("bit/s")),
}
# Output in bytes/days, value is in bytes/s
Module: check_mk
Branch: master
Commit: 1801656f875ae6e6de8eb6547cae292255bfbfd9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1801656f875ae6…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Mar 4 09:12:12 2016 +0100
3257 dell_idrac_virtdisks: new check which monitors the virtual disks of a Dell IDrac Device
---
.werks/3257 | 9 +++++
ChangeLog | 1 +
checkman/dell_idrac_virtdisks | 22 +++++++++++
checks/dell_idrac_virtdisks | 86 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 118 insertions(+)
diff --git a/.werks/3257 b/.werks/3257
new file mode 100644
index 0000000..0515549
--- /dev/null
+++ b/.werks/3257
@@ -0,0 +1,9 @@
+Title: dell_idrac_virtdisks: new check which monitors the virtual disks of a Dell IDrac Device
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1457079074
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index d85ebfc..2bdc503 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@
* 3191 cisco_redundancy: new check which monitors the status of the redundant unit of Cisco devices supporting the CISCO-RF-MIB
* 3083 mk_jolokia: The plugin can now be configured with a service url to treat the jolokia server as a jmx proxy
* 3085 fortigate_signatures: new check to monitor av and ips signatures on fortigate firewalls...
+ * 3257 dell_idrac_virtdisks: new check which monitors the virtual disks of a Dell IDrac Device
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/checkman/dell_idrac_virtdisks b/checkman/dell_idrac_virtdisks
new file mode 100644
index 0000000..dc39144
--- /dev/null
+++ b/checkman/dell_idrac_virtdisks
@@ -0,0 +1,22 @@
+title: Dell iDrac: Virtual Disks
+agents: snmp
+catalog: hw/server/dell
+license: GPL
+distribution: check_mk
+description:
+ This checks monitors the disk and component status of a Dell iDrac and
+ gives information about the number of physical disks which can be lost
+ before the$ virtual disk loses its redundancy.
+
+ The check goes CRIT if the disk fails or is degraded or if the component
+ reports critical or non-recoverable.
+ The check changes to WARN if the disk state is unknown or if the component
+ is unknown or non-critical.
+ Otherwise the check is OK.
+
+item:
+ The virtual disk name.
+
+inventory:
+ One check is created for each virtual disk.
+
diff --git a/checks/dell_idrac_virtdisks b/checks/dell_idrac_virtdisks
new file mode 100644
index 0000000..39f76f6
--- /dev/null
+++ b/checks/dell_idrac_virtdisks
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.2.1 System --> IDRAC-MIB::virtualDiskName.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.2.2 Oracle --> IDRAC-MIB::virtualDiskName.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.2.3 Backup --> IDRAC-MIB::virtualDiskName.3
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4.1 2 --> IDRAC-MIB::virtualDiskState.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4.2 2 --> IDRAC-MIB::virtualDiskState.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4.3 2 --> IDRAC-MIB::virtualDiskState.3
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.20.1 3 --> IDRAC-MIB::virtualDiskComponentStatus.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.20.2 3 --> IDRAC-MIB::virtualDiskComponentStatus.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.20.3 3 --> IDRAC-MIB::virtualDiskComponentStatus.3
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.34.1 1 --> IDRAC-MIB::virtualDiskRemainingRedundancy.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.34.2 1 --> IDRAC-MIB::virtualDiskRemainingRedundancy.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.34.3 1 --> IDRAC-MIB::virtualDiskRemainingRedundancy.3
+
+
+def inventory_dell_idrac_virtdisks(info):
+ return [ (line[0], None) for line in info ]
+
+
+def check_dell_idrac_virtdisks(item, _no_params, info):
+ map_states = {
+ "disk" : {
+ "1" : (1, "unknown"),
+ "2" : (0, "online"),
+ "3" : (2, "failed"),
+ "4" : (2, "degraded"),
+ },
+ "component" : {
+ "1" : (0, "other"),
+ "2" : (1, "unknown"),
+ "3" : (0, "OK"),
+ "4" : (1, "non-critical"),
+ "5" : (2, "critical"),
+ "6" : (2, "non-recoverable"),
+ },
+ }
+ for name, disk_state, component_state, redundancy in info:
+ if item == name:
+ for what, what_key in [
+ (disk_state, "Disk"),
+ (component_state, "Component")]:
+ state, state_readable = map_states[what_key.lower()][what]
+ yield state, "%s status: %s" % (what_key, state_readable)
+
+ yield 0, "Remaining redundancy: %s physical disk(s)" % redundancy
+
+
+check_info["dell_idrac_virtdisks"] = {
+ "check_function" : check_dell_idrac_virtdisks,
+ "inventory_function" : inventory_dell_idrac_virtdisks,
+ "service_description" : "Virtual Disk %s",
+ "snmp_scan_function" : lambda oid: oid('.1.3.6.1.2.1.1.2.0') == ".1.3.6.1.4.1.674.10892.5",
+ "snmp_info" : (".1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1", [
+ "2", # virtualDiskName
+ "4", # virtualDiskState
+ "20", # virtualComponentStatus
+ "34", # virtualDiskRemainingRedundancy
+ ]),
+}
+
Module: check_mk
Branch: master
Commit: 77504e39d856c558a98a01c55ef4f7f9090a215c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=77504e39d856c5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 3 15:55:36 2016 +0100
BI host fetching livestatus query is now using liveproxyd cache
---
web/htdocs/bi.py | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 29c7f02..019f7b9 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -121,11 +121,6 @@ def load_services(cache, only_hosts):
g_services = {}
g_services_by_hostname = {}
- # TODO: At the moment the data is always refetched. This could really
- # be optimized. Maybe create a cache which fetches data for the given
- # list of hosts, puts it to a cache and then only fetch the additionally
- # needed information which are not cached yet in future requests
-
# Create optional host filter
filter_txt = 'Filter: custom_variable_names < _REALNAME\n' # drop summary hosts
if only_hosts:
@@ -138,9 +133,12 @@ def load_services(cache, only_hosts):
sites.live().set_prepend_site(True)
sites.live().set_auth_domain('bi')
- data = sites.live().query("GET hosts\n"
- +filter_txt+
- "Columns: name custom_variable_names custom_variable_values services childs parents\n")
+ data = sites.live().query(
+ "GET hosts\n"
+ +filter_txt+
+ "Columns: name custom_variable_names custom_variable_values services childs parents\n"
+ "Cache: reload\n"
+ )
sites.live().set_prepend_site(False)
sites.live().set_auth_domain('read')
Module: check_mk
Branch: master
Commit: 8ace6b3c9943405008ad9d0a3083079390dc50bd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8ace6b3c994340…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Mar 3 15:03:58 2016 +0100
3086 FIX fixed incorrect host list when one wato folder was a substring of another
When a view is filtered by a wato folder, that search was a pure prefix match, so if a view was
opened for the folder "abc" it would also contain all hosts from the folder "abcde".
This affected (probably among other things) the "Virtual Host Tree" and the "Tree of Folders"
snapins.
---
.werks/3086 | 13 +++++++++++++
ChangeLog | 1 +
web/plugins/visuals/wato.py | 2 ++
3 files changed, 16 insertions(+)
diff --git a/.werks/3086 b/.werks/3086
new file mode 100644
index 0000000..852397f
--- /dev/null
+++ b/.werks/3086
@@ -0,0 +1,13 @@
+Title: fixed incorrect host list when one wato folder was a substring of another
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1457013618
+
+When a view is filtered by a wato folder, that search was a pure prefix match, so if a view was
+opened for the folder "abc" it would also contain all hosts from the folder "abcde".
+This affected (probably among other things) the "Virtual Host Tree" and the "Tree of Folders"
+snapins.
diff --git a/ChangeLog b/ChangeLog
index 559aadc..d85ebfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -84,6 +84,7 @@
* 3246 FIX: Fix link for editing a BI aggregation after coming back from the details of another aggregation...
* 3000 FIX: Host check command: "Use a custom check plugin" was not working with CMC...
* 3231 FIX: Not showing network scan properties in host search form anymore
+ * 3086 FIX: fixed incorrect host list when one wato folder was a substring of another...
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/plugins/visuals/wato.py b/web/plugins/visuals/wato.py
index 9c37ed5..646eae4 100644
--- a/web/plugins/visuals/wato.py
+++ b/web/plugins/visuals/wato.py
@@ -81,6 +81,8 @@ class FilterWatoFile(Filter):
path_regex = "^/wato/%s" % current.replace("\n", "") # prevent insertions attack
if current.endswith("/"): # Hosts directly in this folder
path_regex += "hosts.mk"
+ else:
+ path_regex += "/"
if "*" in current: # used by virtual host tree snapin
path_regex = path_regex.replace(".", "\\.").replace("*", ".*")
op = "~~"