Module: check_mk
Branch: master
Commit: 6a6282abf89a75821fe091dbdebc72448016bef1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a6282abf89a75…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Nov 6 13:28:12 2013 +0100
Allow grouping by host, host group or service group
Within the availability reporting there is now a new option <i>Grouping</i>
for grouping by host, host group or service group. When grouping is enabled
then one separate table will be rendered for each host or group that is part
of the selected objects. For objects that are not part of any group (well, this
cannot happen if you group by host) one additional table is being rendered.
The host and service groups are sorted according to their internal ID, but
their aliasses are being displayed. That way you can defined your custom
order of the groups in the report - by wisely choosing the internal IDs.
<b>Note</b>: objects that are part of more than one group will appear in
more than one table.
---
.werks/55 | 5 +++++
web/plugins/views/availability.py | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/.werks/55 b/.werks/55
index 0cf0dc6..07c2545 100644
--- a/.werks/55
+++ b/.werks/55
@@ -11,5 +11,10 @@ then one separate table will be rendered for each host or group that is part
of the selected objects. For objects that are not part of any group (well, this
cannot happen if you group by host) one additional table is being rendered.
+The host and service groups are sorted according to their internal ID, but
+their aliasses are being displayed. That way you can defined your custom
+order of the groups in the report - by wisely choosing the internal IDs.
+
<b>Note</b>: objects that are part of more than one group will appear in
more than one table.
+
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 79b0e9f..c83cb23 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -990,7 +990,7 @@ def render_availability_table(availability, from_time, until_time, range_title,
else:
title = group_titles.get(group_id, group_id)
titled_groups.append((title, group_id)) ## ACHTUNG
- titled_groups.sort()
+ titled_groups.sort(cmp = lambda a,b: cmp(a[1], b[1]))
# 3. Loop over all groups and render them
for title, group_id in titled_groups:
Module: check_mk
Branch: master
Commit: 44bbaed48928655701c5a15913f57aee1602fa5e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=44bbaed4892865…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Nov 6 13:22:09 2013 +0100
Allow grouping by host, host group or service group
Within the availability reporting there is now a new option <i>Grouping</i>
for grouping by host, host group or service group. When grouping is enabled
then one separate table will be rendered for each host or group that is part
of the selected objects. For objects that are not part of any group (well, this
cannot happen if you group by host) one additional table is being rendered.
<b>Note</b>: objects that are part of more than one group will appear in
more than one table.
---
.werks/55 | 15 ++++
ChangeLog | 1 +
web/plugins/views/availability.py | 150 ++++++++++++++++++++++++++++++-------
3 files changed, 137 insertions(+), 29 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=44bbaed489…
Module: check_mk
Branch: master
Commit: 0b7c477f95085fdc54888ca43538643e93ff58b4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0b7c477f95085f…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Nov 6 11:15:52 2013 +0100
Fixed cisco_wlc: Behavier in case of missing device
---
checks/cisco_wlc | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/checks/cisco_wlc b/checks/cisco_wlc
index 77208a3..f370532 100644
--- a/checks/cisco_wlc
+++ b/checks/cisco_wlc
@@ -51,13 +51,13 @@ def check_cisco_wlc(item, params, info):
# Special treatment if this device is missing
if params:
- for name, mac, state, model in data:
- for ap_name, ap_state in params.get("ap_name", []):
- if name.startswith(ap_name):
- return ap_state, "Accesspoint not found (State set to %s by rule)" % nagios_state_names[ap_state]
- for ap_model, ap_state in params.get("ap_model", []):
- if mode.startswith(ap_model):
- return ap_state, "Accesspoint not found (State set to %s by rule)" % nagios_state_names[ap_state]
+ for ap_name, ap_state in params.get("ap_name", []):
+ if item.startswith(ap_name):
+ return ap_state, "Accesspoint 1 not found (State set to %s by rule)" % nagios_state_names[ap_state]
+ # If the device is missin, with cannot know the model
+ #for ap_model, ap_state in params.get("ap_model", []):
+ # if mode.startswith(ap_model):
+ # return ap_state, "Accesspoint 2 not found (State set to %s by rule)" % nagios_state_names[ap_state]
return 2, "Accesspoint not found"
Module: check_mk
Branch: master
Commit: acf3a001da12940e29c9f86ae0ce61d1e3764670
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=acf3a001da1294…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Tue Nov 5 18:17:39 2013 +0100
brocade_mlx: check manpages
---
checkman/brocade_mlx.module_cpu | 52 ++++++++++++++++++++++++++++++++++++++
checkman/brocade_mlx.module_mem | 4 +--
checkman/brocade_mlx.temperature | 43 +++++++++++++++++++++++++++++++
checks/brocade_mlx | 2 +-
4 files changed, 98 insertions(+), 3 deletions(-)
diff --git a/checkman/brocade_mlx.module_cpu b/checkman/brocade_mlx.module_cpu
new file mode 100644
index 0000000..5a29277
--- /dev/null
+++ b/checkman/brocade_mlx.module_cpu
@@ -0,0 +1,52 @@
+title: Brocade NetIron MLX devices: NI-MLX Module CPU Utilization
+agents: snmp
+catalog: hw/network/brocade
+license: GPL
+distribution: check_mk
+description:
+ Checks the Module CPU Utilization of a NI-MLX module in Brocade
+ NetIron MLX switching / routing devices.
+
+ {WARN} or {CRIT} is returned, if the usage in the last 60 sec was above
+ given thresholds. {OK} is returned otherwise.
+
+ Please note: Even if the check reports and graphs the CPU Utilization in
+ the last 1/5/60/300 sec, the thresholds are only checked against the value
+ of the last 60 sec. The other values are informational only.
+
+item:
+ If a module description is delivered by SNMP, the item is build from the
+ module ID plus the description. Otherwise it is just the ID.
+
+examples:
+ # set default levels to 70 and 80 percent:
+ brocade_mlx_cpu_default_levels = (70.0, 80.0)
+
+ # Check Module with ID 33 on a box called my-mlx-device with default levels
+ checks += [
+ ("my-mlx-device", "brocade_mlx.module_cpu", '33 NI-MLX-32_MR Management Module', brocade_mlx_cpu_default_levels),
+ ]
+
+ # or use individual levels for warn and crit
+ checks += [
+ ("my-mlx-device", "brocade_mlx.module_cpu", '33 NI-MLX-32_MR Management Module', (75.0, 85.0)),
+ ]
+
+perfdata:
+ four value are returned, cpu_util1, cpu_util5, cpu_util60 and cpu_util300:
+ The CPU Utilization (in percent) in the last 1/5/60/300 sec.
+ cpu_util60 together with warn and crit levels.
+
+inventory:
+ Finds one item per NI-MLX module.
+ Empty modules are omitted.
+
+[parameters]
+warn(float): {WARN} state is triggered, if the CPU utilization in percent is higher
+ than this.
+crit(float): {CRIT} state is triggered, if the CPU utilization in percent is higher
+ than this.
+
+[configuration]
+brocade_mlx_cpu_default_levels(float, float): The standard levels for {WARN} and
+ {CRIT}. Defaults are (80.0, 90.0)
diff --git a/checkman/brocade_mlx.module_mem b/checkman/brocade_mlx.module_mem
index 4faa737..df88967 100644
--- a/checkman/brocade_mlx.module_mem
+++ b/checkman/brocade_mlx.module_mem
@@ -37,9 +37,9 @@ inventory:
Empty modules are omitted.
[parameters]
-warn(int): {WARN} state is triggered, if the memory usage in percent is higher
+warn(float): {WARN} state is triggered, if the memory usage in percent is higher
than this.
-crit(int): {CRIT} state is triggered, if the memory usage in percent is higher
+crit(float): {CRIT} state is triggered, if the memory usage in percent is higher
than this.
[configuration]
diff --git a/checkman/brocade_mlx.temperature b/checkman/brocade_mlx.temperature
new file mode 100644
index 0000000..0502d6d
--- /dev/null
+++ b/checkman/brocade_mlx.temperature
@@ -0,0 +1,43 @@
+title: Brocade NetIron MLX devices: Temperature Sensors
+agents: snmp
+catalog: hw/network/brocade
+license: GPL
+distribution: check_mk
+description:
+ Checks the temperature sensors in Brocade NetIron MLX switching / routing
+ devices.
+
+ {WARN} or {CRIT} is returned, if the temperature is above given thresholds.
+ {OK} is returned otherwise.
+
+item:
+ The description of the temperature sensor as provided by SNMP.
+
+examples:
+ # set default levels to 70°C and 80°C:
+ brocade_mlx_temperature_default_levels = (70, 80)
+
+ # Check a sensor with description Switch Fabric module 0, sensor 1 temperature
+ # on a box called my-mlx-device with default levels
+ checks += [
+ ("my-mlx-device", "brocade_mlx.temperature", 'Switch Fabric module 0, sensor 1 temperature', brocade_mlx_temperature_default_levels)
+ ]
+
+ # or use individual levels for warn and crit
+ checks += [
+ ("my-mlx-device", "brocade_mlx.temperature", 'Switch Fabric module 0, sensor 1 temperature', (80, 100)
+ ]
+
+perfdata:
+ one value is returned: The temperature in °C, together with warn and crit levels
+
+inventory:
+ Finds one item per temperature sensor
+
+[parameters]
+warn(int): {WARN} state is triggered, if the temperature is higher than this.
+crit(int): {CRIT} state is triggered, if the temperature is higher than this.
+
+[configuration]
+brocade_mlx_temperature_default_levels(int, int): The standard levels for {WARN}
+ and {CRIT}. Defaults are (100, 120)
diff --git a/checks/brocade_mlx b/checks/brocade_mlx
index f8bec7a..782a247 100644
--- a/checks/brocade_mlx
+++ b/checks/brocade_mlx
@@ -170,7 +170,7 @@ def check_brocade_mlx_module_mem(item, params, info):
status = 2
errorstring = " (!!)"
- return status, "%s Bytes used (%0.1f%%%s) of total %s Bytes" % \
+ return status, "%s used (%0.1f%%%s) of total %s" % \
(get_bytes_human_readable(mem_used), mem_used_percent, \
errorstring, get_bytes_human_readable(mem_total)), \
perfdata
Module: check_mk
Branch: master
Commit: 160d0d94595d516a860ae7efaf5f8fae24c3c51f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=160d0d94595d51…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Nov 5 17:32:54 2013 +0100
New labelling options for availability table
In the availability reporting options there is now a new box called
<i>Labelling Options</i> with three new check boxes:
<ul>
<li><i>Do not display the host name</i>: This simply removes the column with the host name.
This is useful when you know that your report is about services of a single host anyway.</li>
<li><i>Use alternative display name for services</i>: When you have configured alternative
display names for (some of) your services then you can have this names being used instead
of the normal ones.</li>
<li><i>Do not display icons for history and timeline</i>: this simply removes the left-most
column with the icons. This is useful when you want to export the resulting table into
some report (by simply copying or screenshoting the HTML output).</li>
</ul>
---
.werks/54 | 21 ++++++++++++++
ChangeLog | 1 +
web/plugins/views/availability.py | 58 ++++++++++++++++++++++++++-----------
3 files changed, 63 insertions(+), 17 deletions(-)
diff --git a/.werks/54 b/.werks/54
new file mode 100644
index 0000000..7298192
--- /dev/null
+++ b/.werks/54
@@ -0,0 +1,21 @@
+Title: New labelling options for availability table
+Level: 2
+Component: reporting
+Version: 1.2.3i7
+Date: 1383668860
+Class: feature
+
+In the availability reporting options there is now a new box called
+<i>Labelling Options</i> with three new check boxes:
+
+<ul>
+<li><i>Do not display the host name</i>: This simply removes the column with the host name.
+This is useful when you know that your report is about services of a single host anyway.</li>
+<li><i>Use alternative display name for services</i>: When you have configured alternative
+display names for (some of) your services then you can have this names being used instead
+of the normal ones.</li>
+<li><i>Do not display icons for history and timeline</i>: this simply removes the left-most
+column with the icons. This is useful when you want to export the resulting table into
+some report (by simply copying or screenshoting the HTML output).</li>
+</ul>
+
diff --git a/ChangeLog b/ChangeLog
index 0920db1..eb78c38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
Reporting & Availability:
* 0051: Option for showing timeline directly in availability table...
* 0052: Visual colorization of availability according to levels...
+ * 0054: New labelling options for availability table...
Livestatus:
* 0023 FIX: table statehist: code cleanup / minor performance improvements...
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index b637a9e..1f7c933 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -67,7 +67,7 @@ def render_availability(view, datasource, filterheaders, display_options,
html.write(avoptions_html)
if not html.has_user_errors():
- rows = get_availability_data(datasource, filterheaders, range, only_sites, limit, timeline, timeline or avoptions["show_timeline"])
+ rows = get_availability_data(datasource, filterheaders, range, only_sites, limit, timeline, timeline or avoptions["show_timeline"], avoptions)
what = "service" in datasource["infos"] and "service" or "host"
do_render_availability(rows, what, avoptions, timeline, "")
@@ -112,6 +112,19 @@ avoption_entries = [
)
),
+ # Labelling and Texts
+ ( "labelling",
+ "double",
+ ListChoice(
+ title = _("Labelling Options"),
+ choices = [
+ ( "omit_host", _("Do not display the host name")),
+ ( "use_display_name", _("Use alternative display name for services")),
+ ( "omit_buttons", _("Do not display icons for history and timeline")),
+ ]
+ )
+ ),
+
# How to deal with downtimes
( "downtimes",
"double",
@@ -359,8 +372,6 @@ def render_availability_options():
"host_down" : "host_down",
},
"outage_statistics" : ([],[]),
- "av_levels" : None,
- "av_mode" : False,
"short_intervals" : 0,
"dont_merge" : False,
"show_timeline" : False,
@@ -371,6 +382,9 @@ def render_availability_options():
# original version. This code can be dropped in a couple of years.
avoptions.setdefault("notification_period", "honor")
avoptions.setdefault("outage_statistics", ([], []))
+ avoptions.setdefault("av_levels", None)
+ avoptions.setdefault("av_mode", False)
+ avoptions.setdefault("labelling", [])
is_open = False
html.begin_form("avoptions")
@@ -493,7 +507,7 @@ def compute_range(rangespec):
from_broken[0] -= 1
return (time.mktime(from_broken), until_time), titles[1]
-def get_availability_data(datasource, filterheaders, range, only_sites, limit, single_object, include_output):
+def get_availability_data(datasource, filterheaders, range, only_sites, limit, single_object, include_output, avoptions):
has_service = "service" in datasource["infos"]
av_filter = "Filter: time >= %d\nFilter: time <= %d\n" % range
if single_object:
@@ -518,6 +532,8 @@ def get_availability_data(datasource, filterheaders, range, only_sites, limit, s
"in_host_downtime", "in_notification_period", "is_flapping", ]
if include_output:
columns.append("log_output")
+ if "use_display_name" in avoptions["labelling"]:
+ columns.append("current_service_display_name")
add_columns = datasource.get("add_columns", [])
rows = do_query_data(query, columns, add_columns, None, filterheaders, only_sites, limit = None)
@@ -589,6 +605,7 @@ def do_render_availability(rows, what, avoptions, timeline, timewarpcode):
timeline_rows = []
considered_duration = 0
for span in service_entry:
+ display_name = span.get("current_service_display_name", service)
state = span["state"]
if state == -1:
s = "unmonitored"
@@ -650,7 +667,7 @@ def do_render_availability(rows, what, avoptions, timeline, timewarpcode):
if not show_timeline:
timeline_rows = None
- availability.append([site_host[0], site_host[1], service, states, considered_duration, statistics, timeline_rows])
+ availability.append([site_host[0], site_host[1], service, display_name, states, considered_duration, statistics, timeline_rows])
# Prepare number format function
range, range_title = avoptions["range"]
@@ -914,6 +931,7 @@ def render_availability_table(availability, from_time, until_time, range_title,
state_groups = [ sg["warn"], sg["unknown"], sg["host_down"] ]
show_timeline = avoptions["show_timeline"]
+ labelling = avoptions["labelling"]
if avoptions["av_levels"]: # and avoptions["timeformat"].startswith("percentage"):
av_levels = avoptions["av_levels"]
else:
@@ -943,20 +961,21 @@ def render_availability_table(availability, from_time, until_time, range_title,
summary_counts = {}
table.begin("av_items", _("Availability") + " " + range_title, css="availability",
searchable = False, limit = None)
- for site, host, service, states, considered_duration, statistics, timeline_rows in availability:
+ for site, host, service, display_name, states, considered_duration, statistics, timeline_rows in availability:
table.row()
if what != "bi":
- table.cell("", css="buttons")
- history_url = history_url_of(site, host, service, from_time, until_time)
- html.icon_button(history_url, _("Event History"), "history")
-
timeline_url = html.makeuri([
("timeline", "yes"),
("timeline_site", site),
("timeline_host", host),
("timeline_service", service)])
- html.icon_button(timeline_url, _("Timeline"), "timeline")
+
+ if not "omit_buttons" in labelling:
+ table.cell("", css="buttons")
+ history_url = history_url_of(site, host, service, from_time, until_time)
+ html.icon_button(history_url, _("Event History"), "history")
+ html.icon_button(timeline_url, _("Timeline"), "timeline")
else:
timeline_url = html.makeuri([("timeline", "1")])
@@ -966,10 +985,15 @@ def render_availability_table(availability, from_time, until_time, range_title,
table.cell(_("Aggregate"), '<a href="%s">%s</a>' % (bi_url, service))
availability_columns = bi_availability_columns
else:
- table.cell(_("Host"), '<a href="%s">%s</a>' % (host_url, host))
+ if not "omit_host" in labelling:
+ table.cell(_("Host"), '<a href="%s">%s</a>' % (host_url, host))
if what == "service":
service_url = "view.py?" + html.urlencode_vars([("view_name", "service"), ("site", site), ("host", host), ("service", service)])
- table.cell(_("Service"), '<a href="%s">%s</a>' % (service_url, service))
+ if "use_display_name" in labelling:
+ service_name = display_name
+ else:
+ service_name = service
+ table.cell(_("Service"), '<a href="%s">%s</a>' % (service_url, service_name))
availability_columns = service_availability_columns
else:
availability_columns = host_availability_columns
@@ -1026,8 +1050,10 @@ def render_availability_table(availability, from_time, until_time, range_title,
if show_summary:
table.row(css="summary")
- table.cell("")
- table.cell("", _("Summary"))
+ if not "omit_buttons" in labelling:
+ table.cell("")
+ if not "omit_host" in labelling:
+ table.cell("", _("Summary"))
if what == "service":
table.cell("", "")
@@ -1074,8 +1100,6 @@ def render_availability_table(availability, from_time, until_time, range_title,
html.write('<div class="state state2">%s</div><div class=level>< %.3f%%</div>' % (_("CRIT"), crit))
html.write('</div>')
- # html.debug("HIRNKI")
-
def check_av_levels(number, av_levels, considered_duration):
perc = 100 * float(number) / float(considered_duration)