Module: check_mk
Branch: master
Commit: 069a5bc29eec36728f868437941ae29f7aba4173
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=069a5bc29eec36…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu May 21 13:55:18 2015 +0200
#1248 acme_sbc, acme_sbc.settings: New Checks to monitor an ACME Session Border
Controller
In order to work, that check needs excpect installed on the monitoring server. Also
it's needed to add a public SSH keys from your OMD Site to the device.
---
.werks/1248 | 10 +++++
ChangeLog | 1 +
acme_sbc | 73 +++++++++++++++++++++++++++++++
agents/special/agent_acme_sbc | 12 +++++
checkman/acme_sbc | 12 +++++
checkman/acme_sbc.settings | 11 +++++
checks/agent_acme_sbc | 30 +++++++++++++
web/plugins/wato/datasource_programs.py | 14 ++++++
8 files changed, 163 insertions(+)
diff --git a/.werks/1248 b/.werks/1248
new file mode 100644
index 0000000..445f194
--- /dev/null
+++ b/.werks/1248
@@ -0,0 +1,10 @@
+Title: acme_sbc, acme_sbc.settings: New Checks to monitor an ACME Session Border
Controller
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1432209154
+Class: feature
+
+In order to work, that check needs excpect installed on the monitoring server. Also
it's needed to add a public SSH keys from your OMD Site to the device.
+
diff --git a/ChangeLog b/ChangeLog
index c66bdfe..5897a46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -190,6 +190,7 @@
* 2294 if, if64: Move global option for padding port numbers with zeroes into
rule...
* 2296 win_dhcp_pools: Convert global option for discovery empty pools into rule
set...
* 1247 alcatel_timetra_chassis: New Check for Slots, Power Supplies, MDAs, cf cards
and Fans of Alcatel Switches Supporting the TIMETRA-CHASSIS-MIB
+ * 1248 acme_sbc, acme_sbc.settings: New Checks to monitor an ACME Session Border
Controller...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/acme_sbc b/acme_sbc
new file mode 100644
index 0000000..261a3a9
--- /dev/null
+++ b/acme_sbc
@@ -0,0 +1,73 @@
+#!/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.
+
+def acme_sbc_parse_function(info):
+ states = {}
+ settings = {}
+ for line in info:
+ if len(line) == 2:
+ for what in [ "Health", "State" ]:
+ if line[0] == what:
+ states[what] = line[1]
+ elif len(line) == 3 and line[1] == "Synchronized":
+ settings[line[0]] = line[2]
+ return states, settings
+
+def inventory_acme_sbc(parsed):
+ return [(None, None)]
+
+def check_acme_sbc(_no_item, _no_params, parsed):
+ health = int(parsed[0]["Health"])
+ dev_state = parsed[0]["State"]
+ if health == 100:
+ state = 0
+ else:
+ state = 2
+ return state, "Health at %d %% (State: %s)" % (health, dev_state)
+
+check_info["acme_sbc"] = {
+ "check_function" : check_acme_sbc,
+ "inventory_function" : inventory_acme_sbc,
+ "service_description" : "Status",
+ "parse_function" : acme_sbc_parse_function,
+}
+
+def inventory_acme_sbc_settings(parsed):
+ return [(None, parsed[1])]
+
+def check_acme_sbc_settings(_no_item, params, parsed):
+ current_settings = parsed[1]
+ saved_settings = params
+ yield 0, "Checking %d settings" % len(saved_settings)
+ for setting, value in saved_settings.items():
+ if current_settings[setting] != value:
+ yield 2, "%s changed from %s to %s" % (setting, value,
current_settings[setting])
+
+check_info["acme_sbc.settings"] = {
+ "check_function" : check_acme_sbc_settings,
+ "inventory_function" : inventory_acme_sbc_settings,
+ "service_description" : "Settings",
+}
diff --git a/agents/special/agent_acme_sbc b/agents/special/agent_acme_sbc
new file mode 100644
index 0000000..93d6ace
--- /dev/null
+++ b/agents/special/agent_acme_sbc
@@ -0,0 +1,12 @@
+#!/usr/bin/expect -f
+send_user "<<<acme_sbc>>>\n"
+log_user 0
+set host [lindex $argv 0]
+spawn ssh -l user $host
+
+expect "*>"
+log_user 1
+send "show health\r"
+expect "*>"
+log_user 0
+send "exit\r"
diff --git a/checkman/acme_sbc b/checkman/acme_sbc
new file mode 100644
index 0000000..0cbe5f9
--- /dev/null
+++ b/checkman/acme_sbc
@@ -0,0 +1,12 @@
+title: ACME SBC: Health
+agents: special
+catalog: hw/network/acme
+license: GPL
+distribution: check_mk
+description:
+ This is a simple check which checks the health status in percent.
+ The percent value is reported by the devices and reflects the status of cluster
+ and harware. If the status not is at 100 %, a {CRIT} is raised.
+
+inventory:
+ One check will be created.
diff --git a/checkman/acme_sbc.settings b/checkman/acme_sbc.settings
new file mode 100644
index 0000000..92d3a26
--- /dev/null
+++ b/checkman/acme_sbc.settings
@@ -0,0 +1,11 @@
+title: ACME SBC: Health Settings
+agents: special
+catalog: hw/network/acme
+license: GPL
+distribution: check_mk
+description:
+ This Checks monitors changes of health releated options on the device.
+ If e.g. Media Synchronized changes from true to disabled/ false, a {CRIT} is raised.
+
+inventory:
+ One check will be created.
diff --git a/checks/agent_acme_sbc b/checks/agent_acme_sbc
new file mode 100644
index 0000000..65a11b6
--- /dev/null
+++ b/checks/agent_acme_sbc
@@ -0,0 +1,30 @@
+#!/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-
+# 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.
+
+def agent_acme_sbc(params, hostname, ipaddress):
+ return hostname
+
+special_agent_info['acme_sbc'] = agent_acme_sbc
diff --git a/web/plugins/wato/datasource_programs.py
b/web/plugins/wato/datasource_programs.py
index d816bb4..b918974 100644
--- a/web/plugins/wato/datasource_programs.py
+++ b/web/plugins/wato/datasource_programs.py
@@ -360,6 +360,20 @@ register_rule(group,
match = 'first')
register_rule(group,
+ "special_agents:acme_sbc",
+ FixedValue(
+ {},
+ title = _("Check ACME Session Border Controller"),
+ help = _("This rule activates an expect based agent who connects"
+ "to an ACME Session Border Controller (SBC). This agent uses SSH,
this"
+ "means that you have to exchange a SSH key to make a password
less"
+ "connect possible"),
+ totext = _("Connect to ACME SBC"),
+ ),
+ factory_default = FACTORY_DEFAULT_UNUSED, # No default, do not use setting if no rule
matches
+ match = 'first')
+
+register_rule(group,
"special_agents:fritzbox",
Dictionary(
title = _("Check state of Fritz!Box Devices"),