2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 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.
27 # Example Agent Output:
29 # .1.3.6.1.4.1.3717.2.1.1.6.1 = INTEGER: 300000
30 # .1.3.6.1.4.1.3717.2.1.1.6.2 = INTEGER: 1268
31 # .1.3.6.1.4.1.3717.2.1.1.6.3 = INTEGER: 1
33 genua_pfstate_default_levels
= {"used": (None, None)}
36 def inventory_genua_pfstate(info
):
37 # remove empty elements due to alternative enterprise id in snmp_info
38 info
= filter(None, info
)
40 if not info
or not info
[0]:
43 if len(info
[0][0]) == 3:
44 return [(None, genua_pfstate_default_levels
)]
53 return names
.get(st
, st
)
56 def check_genua_pfstate(item
, params
, info
):
57 # remove empty elements due to alternative enterprise id in snmp_info
58 info
= filter(None, info
)
61 if len(info
[0][0]) == 3:
62 pfstateMax
= saveint(info
[0][0][0])
63 pfstateUsed
= saveint(info
[0][0][1])
64 pfstateStatus
= info
[0][0][2]
66 return (3, "Invalid Output from Agent")
68 warn
, crit
= params
.get("used")
75 if pfstateStatus
!= "1":
79 if crit
and pfstateUsed
> crit
:
82 elif warn
and pfstateUsed
> warn
:
86 pfstatus
= pfstate(str(pfstateStatus
))
87 infotext
= "PF State: %s%s States used: %d%s States max: %d" \
88 % (pfstatus
, statussym
, pfstateUsed
, usedsym
, pfstateMax
)
89 perfdata
= [("statesused", pfstateUsed
, None, pfstateMax
)]
90 return (state
, infotext
, perfdata
)
93 check_info
['genua_pfstate'] = {
94 "inventory_function": inventory_genua_pfstate
,
95 "check_function": check_genua_pfstate
,
96 "service_description": "Paketfilter Status",
98 "group": "pf_used_states",
101 ".1.3.6.1.4.1.3717.2.1.1.6",
108 ".1.3.6.1.4.1.3137.2.1.1.6",
115 "snmp_scan_function": scan_genua
,
116 "includes": ["genua.include"],