Module: check_mk
Branch: master
Commit: 34ed095b405139486d5708a3a8ab7bb2524f2e74
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=34ed095b405139…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Aug 11 18:32:04 2014 +0200
#1096 New WATO webservices: manage hosts via webinterface
It is now possible to manage hosts via web requests<br>
This includes the following operations
<ul>
<li>Add host</li>
<li>Edit host</li>
<li>Delete host</li>
<li>Get host attributes</li>
<li>Host service discovery</li>
<li>Activate changes</li>
</ul>
These operations also work in a distributed environment. You can find more information
regarding these web request in the <tt>Roles & Permissions</tt> page under a roles settings.
There is a new permission topic <tt>Web API</tt> where you can configure the permission
of all available API requests. The help texts for these permissions provide some useful examples.
In the near future, there will be a "Howto Web-API" article in our online documentation, too.
---
.werks/1096 | 26 ++
ChangeLog | 2 +
mkeventd/web/plugins/wato/mkeventd.py | 4 +-
web/htdocs/dashboard.py | 2 +-
web/htdocs/index.py | 2 +-
web/htdocs/lib.py | 37 ++
web/htdocs/views.py | 4 +-
web/htdocs/wato.py | 713 +++++++++++++++++++++-----------
web/htdocs/webapi.py | 153 +++++++
web/plugins/pages/shipped.py | 3 +
web/plugins/sidebar/wato.py | 4 +-
web/plugins/views/wato.py | 4 +-
web/plugins/wato/builtin_attributes.py | 2 +-
web/plugins/wato/userdb.py | 2 +-
web/plugins/webapi/webapi.py | 174 ++++++++
15 files changed, 868 insertions(+), 264 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=34ed095b40…
Module: check_mk
Branch: master
Commit: b56efea572260985bfe2d7926d83ba220765286c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b56efea5722609…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Aug 11 17:55:54 2014 +0200
#1174 rms200_temp: New Temperature check for RMS200 Devices
---
.werks/1174 | 9 +++++
ChangeLog | 1 +
checkman/rms200_temp | 17 +++++++++
checks/rms200_temp | 61 ++++++++++++++++++++++++++++++++
pnp-templates/check_mk-rms200_temp.php | 1 +
web/plugins/perfometer/check_mk.py | 1 +
6 files changed, 90 insertions(+)
diff --git a/.werks/1174 b/.werks/1174
new file mode 100644
index 0000000..1acb76f
--- /dev/null
+++ b/.werks/1174
@@ -0,0 +1,9 @@
+Title: rms200_temp: New Temperature check for RMS200 Devices
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1407772519
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 62aabde..5f04028 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
* 1172 New check sap.value_groups...
* 1173 cisco_secure: Check creates now a summary instead one service by port...
NOTE: Please refer to the migration notes!
+ * 1174 rms200_temp: New Temperature check for RMS200 Devices
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checkman/rms200_temp b/checkman/rms200_temp
new file mode 100644
index 0000000..9f5a82f
--- /dev/null
+++ b/checkman/rms200_temp
@@ -0,0 +1,17 @@
+title: RMS200 Unit: Temperatures
+agents: snmp
+catalog: hw/environment/infratec-plus
+license: GPL
+distribution: check_mk
+description:
+ This plugin polls the temperature of all connected sensors.
+ It is possible to define levels for warning and critical temperature. The plugin return
+ {CRIT} or {WARN} if the current temperatue is higher then one of the levels.
+
+
+inventory:
+ The inventory will create one service per device.
+
+[parameters]
+warn(int): Warning level for the temperature.
+crit(int): Critical level for the temperature.
diff --git a/checks/rms200_temp b/checks/rms200_temp
new file mode 100644
index 0000000..a0749c0
--- /dev/null
+++ b/checks/rms200_temp
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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-
+# ails. 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.
+
+rms200_temp_default_levels = ( 25, 28 )
+
+def inventory_rms200_temp(info):
+ return [ (x[0], "rms200_temp_default_levels" ) for x in info if x[2] != '0']
+
+def check_rms200_temp(item, params, info):
+ for line in info:
+ if line[0] == item:
+ warn, crit = params
+ temp = saveint(line[2])/100
+ name = line[1]
+ state = 0
+ if temp >= crit:
+ state = 2
+ elif temp >= warn:
+ state = 1
+ message = "Current Temperature: %d °C (%s)" % (temp, name)
+ perf = [ ('temp', temp, warn, crit ) ]
+ return state, message, perf
+ return 3, "No information found about the device"
+
+check_info["rms200_temp"] = {
+ "check_function" : check_rms200_temp,
+ "inventory_function" : inventory_rms200_temp,
+ "service_description" : "Temperature %s ",
+ "has_perfdata" : True,
+ "group" : "room_temperature",
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.1909.13",
+ "snmp_info" : ( ".1.3.6.1.4.1.1909.13.1.1.1", [
+ 1, # ID,
+ 2, # Name,
+ 3, # Temp
+ ] ),
+}
+
diff --git a/pnp-templates/check_mk-rms200_temp.php b/pnp-templates/check_mk-rms200_temp.php
new file mode 120000
index 0000000..b9c8459
--- /dev/null
+++ b/pnp-templates/check_mk-rms200_temp.php
@@ -0,0 +1 @@
+check_mk-stulz_temp.php
\ No newline at end of file
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 2f108c0..72b1981 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -342,6 +342,7 @@ perfometers["check_mk-qlogic_sanbox.temp"] = perfometer_temperature
perfometers["check_mk-bintec_sensors.temp"] = perfometer_temperature
perfometers["check_mk-knuerr_rms_temp"] = perfometer_temperature
perfometers["check_mk-arris_cmts_temp"] = perfometer_temperature
+perfometers["check_mk-rms200_temp"] = perfometer_temperature
def perfometer_temperature_multi(row, check_command, perf_data):
display_value = -1
Module: check_mk
Branch: master
Commit: 3e799bd24fcc4e3989fc199b6824bc1d170faaaf
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e799bd24fcc4e…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Aug 11 17:35:46 2014 +0200
#1173 cisco_secure: Check creates now a summary instead one service by port
With this new behavier it's much easyer to handle fussy enviroments whith many portstate changes.
A re-service detection for the switch's with port security is necessary after Update.
---
.werks/1173 | 12 ++++++++++++
ChangeLog | 2 ++
checkman/cisco_secure | 7 +++----
checks/cisco_secure | 28 ++++++++++++----------------
4 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/.werks/1173 b/.werks/1173
new file mode 100644
index 0000000..3a2f618
--- /dev/null
+++ b/.werks/1173
@@ -0,0 +1,12 @@
+Title: cisco_secure: Check creates now a summary instead one service by port
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.5i6
+Date: 1407771069
+Class: feature
+
+With this new behavier it's much easyer to handle fussy enviroments whith many portstate changes.
+
+A re-service detection for the switch's with port security is necessary after Update.
+
diff --git a/ChangeLog b/ChangeLog
index 4f12d8f..62aabde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,8 @@
* 0200 arris_cmts_cpu,arris_cmts_temp: New Checks for Arris CMTS Devices ( Temperature and CPU Utilization)
* 0202 cisco_temp_sensor: It is now possible to configure this check in WATO....
* 1172 New check sap.value_groups...
+ * 1173 cisco_secure: Check creates now a summary instead one service by port...
+ NOTE: Please refer to the migration notes!
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checkman/cisco_secure b/checkman/cisco_secure
index 41a508f..c084d47 100644
--- a/checkman/cisco_secure
+++ b/checkman/cisco_secure
@@ -6,12 +6,11 @@ distribution: check_mk
description:
This check monitors the port Security feature of cisco_switches. It returns a {CRITICAL} state for
each port which is locked due a security isse. If is port security configured but cant be enabled
- the check returns {WARNING}. If a port goes down, the check ignores that and only shows a information in the
- check output.
+ the check returns {WARNING}.
item:
- The description of the Port
+ None
inventory:
- One check for each port with enabled port security which is also up will be created
+ One summary check will be created
diff --git a/checks/cisco_secure b/checks/cisco_secure
index aa7e030..e82d7ec 100644
--- a/checks/cisco_secure
+++ b/checks/cisco_secure
@@ -35,12 +35,12 @@ def cisco_secure_convert(info):
def inventory_cisco_secure(info):
info = cisco_secure_convert(info)
- inventory = []
+ # search for at least one port with security
for name, op_state, enabled, status, violationCount, lastmac in info:
#if portsecurity enabled and port up OR currently there is sercurity issue`
if ( enabled == 1 and op_state == 1) or status == 3:
- inventory.append( (name, None) )
- return inventory
+ return [ (None, None) ]
+ return []
def check_cisco_secure(item, params, info):
secure_states = {
@@ -50,21 +50,17 @@ def check_cisco_secure(item, params, info):
}
info = cisco_secure_convert(info)
+ failed = []
for name, op_state, enabled, status, violationCount, lastmac in info:
- if name == item:
- message = "Port Security %s (Violation Count: %s, Last Mac: %s)" % \
- ( secure_states[status], violationCount, lastmac )
+ message = "Port %s: %s (Violation Count: %s, Last Mac: %s)" % \
+ ( name, secure_states[status], violationCount, lastmac )
- # If port cant be enabled and is up
- if status == 2 and op_state == 1:
- return 1, message
- # Port cant be enabled but is down, so no error state
- elif status == 2:
- return 0, "Port is down"
- # Security issue
- elif status == 3:
- return 2, message
- return 0, message
+ # If port cant be enabled and is up
+ if status == 2 and op_state == 1:
+ yield 1, message
+ # Security issue
+ elif status == 3:
+ yield 2, message
check_info["cisco_secure"] = {
"check_function" : check_cisco_secure,
Module: check_mk
Branch: master
Commit: e3a92f4d402a4015244931d9fe51c5f090b9a7c4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e3a92f4d402a40…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Aug 11 16:06:53 2014 +0200
#1172 New check sap.value_groups
With this check it's possible to create groups of SAP values to avoid dozen of service checks.
---
.werks/1172 | 10 ++++++++++
ChangeLog | 1 +
2 files changed, 11 insertions(+)
diff --git a/.werks/1172 b/.werks/1172
new file mode 100644
index 0000000..941ecee
--- /dev/null
+++ b/.werks/1172
@@ -0,0 +1,10 @@
+Title: New check sap.value_groups
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1407765950
+Class: feature
+
+With this check it's possible to create groups of SAP values to avoid dozen of service checks.
+
diff --git a/ChangeLog b/ChangeLog
index b373406..4f12d8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
* 0199 veeam_client: Check rewritten to get a nicer output
* 0200 arris_cmts_cpu,arris_cmts_temp: New Checks for Arris CMTS Devices ( Temperature and CPU Utilization)
* 0202 cisco_temp_sensor: It is now possible to configure this check in WATO....
+ * 1172 New check sap.value_groups...
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
Module: check_mk
Branch: master
Commit: 64721b5a2c60818f085eab255d93f4168a5ec649
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=64721b5a2c6081…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Aug 11 16:04:43 2014 +0200
New check sap.value_groups
---
checkman/sap.value_groups | 20 +++++++++
checks/sap | 78 +++++++++++++++++++++++++++++++++-
web/plugins/wato/check_parameters.py | 31 ++++++++++++++
3 files changed, 128 insertions(+), 1 deletion(-)
diff --git a/checkman/sap.value_groups b/checkman/sap.value_groups
new file mode 100644
index 0000000..f7d39ca
--- /dev/null
+++ b/checkman/sap.value_groups
@@ -0,0 +1,20 @@
+title: SAP Single Value Monitoring Groups
+agents: linux
+catalog: app/sap
+license: GPL
+distribution: check_mk
+description:
+ Please refer to {sap.value} for details.
+ This check is only a subchecks who enables you to create Groups of values.
+
+ The rule "SAP R/3 Single Value Inventory" is not necessary for that, you
+ only need the rule "SAP Value Grouping Patterns" to define a name and an include
+ nor and exclusion list.
+ After the service detection, the check will display the total number of OK and Critical values,
+ in case of Critical values also these.
+
+item:
+ The Name of the Group
+
+inventory:
+ The check does not inventory all available values by default.
diff --git a/checks/sap b/checks/sap
index 5af2b49..8ee8f3b 100644
--- a/checks/sap
+++ b/checks/sap
@@ -78,7 +78,7 @@ check_info['sap.dialog'] = {
# at the moment the following parameters are supported:
# 1. match: the sap-path matching definition
inventory_sap_values = []
-
+sap_value_groups = []
def inventory_sap_value(info):
inv = []
@@ -157,3 +157,79 @@ check_info['sap.value'] = {
"service_description" : "%s",
"has_perfdata" : True,
}
+
+def sap_value_groups_precompile(hostname, item, _unused):
+ return host_extra_conf(hostname, sap_value_groups)
+
+def sap_groups_of_value( value_name, patterns=False ):
+ groups = []
+ if not patterns:
+ patterns = host_extra_conf(g_hostname, sap_value_groups)
+
+ for line in patterns:
+ for group_name, pattern in line:
+ no_match = False
+ inclusion, exclusion = pattern
+ # Exclude:
+ if exclusion:
+ reg = compiled_regexes.get(exclusion)
+ if not reg:
+ reg = re.compile(exclusion)
+ compiled_regexes[exclusion] = reg
+ if reg.match(value_name):
+ no_match = True
+ break
+ #no match for this group, go on with the next group
+ if no_match:
+ break
+
+ # Include
+ reg = compiled_regexes.get(inclusion)
+ if not reg:
+ reg = re.compile(inclusion)
+ compiled_regexes[inclusion] = reg
+ if reg.match(value_name):
+ groups.append(group_name)
+ return groups
+
+def inventory_sap_value_groups( info ):
+ inventory = []
+ found_groups = []
+ for line in info:
+ path = line[3]
+ for group in sap_groups_of_value( path ):
+ if group not in found_groups:
+ inventory.append(( group, None ))
+ found_groups.append(group)
+ return inventory
+
+def check_sap_value_groups( item, params, info ):
+ frontend = []
+ backend = []
+ count_ok = 0
+ count_crit = 0
+ state = 0
+ for line in info:
+ path = line[3]
+ if item in sap_groups_of_value( path, params ):
+ status = sap_nagios_state_map[int(line[1])]
+ output = ''
+ if line[4] == '-':
+ output = ' '.join(line[6:])
+ backend.append( path + output + " " + nagios_state_names[status] )
+ state = max(state, status)
+ if status > 0:
+ count_crit += 1
+ frontend.append( path + output + " " + nagios_state_names[status] )
+ else:
+ count_ok += 1
+
+ return state, "%s OK, %s Crit %s\n%s" % ( count_ok, count_crit, ", ".join(frontend), "\n".join(backend) )
+
+
+check_info['sap.value-groups'] = {
+ 'check_function': check_sap_value_groups,
+ 'inventory_function': inventory_sap_value_groups,
+ 'service_description': "%s",
+}
+precompile_params['sap.value-groups'] = sap_value_groups_precompile
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 6036366..82c660a 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -476,6 +476,37 @@ register_rule(group + '/' + subgroup_inventory,
)
register_rule(group + '/' + subgroup_inventory,
+ varname = "sap_value_groups",
+ title = _('SAP Value Grouping Patterns'),
+ help = _('The check <tt>sap.value</tt> normaly creates one service for each sap value '
+ 'By defining grouping patterns you can switch to the check <tt>sap.value-groups</tt>. '
+ 'That check monitors a list of SAP values at once. This is usefull if you have '
+ 'a very big list of values which do you want to monitor'),
+ valuespec = ListOf(
+ Tuple(
+ help = _("This defines one value grouping pattern"),
+ show_titles = True,
+ orientation = "horizontal",
+ elements = [
+ TextAscii(
+ title = _("Name of group"),
+ ),
+ Tuple(
+ show_titles = True,
+ orientation = "vertical",
+ elements = [
+ RegExpUnicode(title = _("Include Pattern")),
+ RegExpUnicode(title = _("Exclude Pattern"))
+ ],
+ ),
+ ],
+ ),
+ add_label = _("Add pattern group"),
+ ),
+ match = 'all',
+)
+
+register_rule(group + '/' + subgroup_inventory,
varname = "inventory_heartbeat_crm_rules",
title = _("Heartbeat CRM Inventory"),
valuespec = Dictionary(