2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2013 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
29 # Media Synchronized true
30 # SIP Synchronized true
31 # BGF Synchronized disabled
32 # MGCP Synchronized disabled
33 # H248 Synchronized disabled
34 # Config Synchronized true
35 # Collect Synchronized disabled
36 # Radius CDR Synchronized disabled
37 # Rotated CDRs Synchronized disabled
38 # IPSEC Synchronized disabled
39 # Iked Synchronized disabled
40 # Active Peer Address 179.253.2.2
42 # Redundancy Protocol Process (v3):
45 # Lowest Local Address 189.253.3.1:9090
46 # 1 peer(s) on 2 socket(s):
47 # BERTZSBC02: v3, Active, health=100, max silence=1050
48 # last received from 142.224.2.3 on wancom1:0
51 # Apr 24 10:14:09.235: Standby to BecomingActive, active peer xxx has timed out, no arp reply from active in 250ms
52 # Oct 17 10:07:44.567: Active to RelinquishingActive
53 # Oct 20 18:41:11.855: Standby to BecomingActive, active peer xxx has unacceptable health (70)
54 # Oct 29 11:46:04.294: Active to RelinquishingActive
55 # Oct 29 11:47:05.452: Standby to BecomingActive, active peer xxx has unacceptable health (70)
56 # Dec 8 11:37:36.445: Active to RelinquishingActive
57 # Dec 8 11:43:00.227: Standby to BecomingActive, active peer xxx has timed out, no arp reply from active in 250ms
58 # Mar 16 10:13:33.248: Active to RelinquishingActive
61 def acme_sbc_parse_function(info
):
66 for what
in ["Health", "State"]:
68 states
[what
] = line
[1]
69 elif len(line
) == 3 and line
[1] == "Synchronized":
70 settings
[line
[0]] = line
[2]
71 return states
, settings
74 def inventory_acme_sbc(parsed
):
78 def check_acme_sbc(_no_item
, _no_params
, parsed
):
79 health
= int(parsed
[0]["Health"])
80 dev_state
= parsed
[0]["State"]
85 return state
, "Health at %d %% (State: %s)" % (health
, dev_state
)
88 check_info
["acme_sbc"] = {
89 "check_function": check_acme_sbc
,
90 "inventory_function": inventory_acme_sbc
,
91 "service_description": "Status",
92 "parse_function": acme_sbc_parse_function
,
96 def inventory_acme_sbc_settings(parsed
):
97 return [(None, parsed
[1])]
100 def check_acme_sbc_settings(_no_item
, params
, parsed
):
101 current_settings
= parsed
[1]
102 saved_settings
= params
103 yield 0, "Checking %d settings" % len(saved_settings
)
104 for setting
, value
in saved_settings
.items():
105 if current_settings
[setting
] != value
:
106 yield 2, "%s changed from %s to %s" % (setting
, value
, current_settings
[setting
])
109 check_info
["acme_sbc.settings"] = {
110 "check_function": check_acme_sbc_settings
,
111 "inventory_function": inventory_acme_sbc_settings
,
112 "service_description": "Settings",