-
Notifications
You must be signed in to change notification settings - Fork 0
/
F5_Bigip_pool_RIPS
139 lines (125 loc) · 6.18 KB
/
F5_Bigip_pool_RIPS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2013 mk@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.
#Modified by Jeremy McLaurin on 5/2/2013 to include all RIP in pool checks.
# Agent / MIB output
# see: 1.3.6.1.4.1.3375.2.2.5.1.2.1
# F5-BIGIP-LOCAL-MIB::ltmPoolName. 8.80.111.111.108.asci_encoded_str = Pool_NMA
# F5-BIGIP-LOCAL-MIB::ltmPoolMemberCnt. 8.80.111.111.108.95.78.77.65 = 2
# F5-BIGIP-LOCAL-MIB::ltmPoolActiveMemberCnt. 8.80.111.111.108.95.78.77.65 = 0
### Additional notes will need to be added for the RIP
# warn, crit numbers of pool members
f5_bigip_pool_rips_default_levels = (1, 2)
#dictname = "f5thresholds"
#execfile('/opt/omd/sites/node/var/check_mk/thresholds/f5thresholds.thr')
def inventory_f5_bigip_pool_rips(checkname,info):
# inventorize all pools and their member count
inventory = []
# print info
for set in info:
info = set
# print info
for line in set:
if line[0] != "":
item = "%s for member %s:%s" % (line[0], check_f5_bigip_pool_rips_readme(line[1]), line[2])
# print item
# levels = "%s.get(\'%s\',f5_bigip_pool_rips_default_levels)" % (dictname, line[0])
# inventory.append((item, levels))
inventory.append((item, "f5_bigip_pool_rips_default_levels"))
# print inventory
# break # this to inventory the first set only
# print inventory
return inventory
def check_f5_bigip_pool_rips_readme(hstr):
ip = "%i.%i.%i.%i" % (ord(hstr[0]),ord(hstr[1]),ord(hstr[2]),ord(hstr[3]))
return ip
def check_f5_bigip_pool_rips_getmyripinfo(linein):
leg = "Pool Member %s:%s [%s] and (%s)" % (check_f5_bigip_pool_rips_readme(linein[1]),linein[2],check_f5_bigip_pool_rips_checkmystatus(linein[3]),linein[4])
# leg = " ###%s:%s(%s)->%s" % (check_f5_bigip_pool_rips_readme(linein[1]),linein[2],{'0' : 'none','1' : 'enabled','2' : 'disabled','3' : 'disabledbyparent'}[linein[3]],linein[4]) ### this will work as well
return leg
def check_f5_bigip_pool_rips_checkmystatus(mystatus):
return {
'0' : 'none',
'1' : 'enabled',
'2' : 'disabled',
'3' : 'disabledbyparent'
}[mystatus]
def check_f5_bigip_pool_rips(item, params, info):
cool = 1
rip=""
check=0
for set in info:
check += 1
for line in set:
if line[0] == item.split()[0]:
if check == 1:
ip = "%s:%s" % (check_f5_bigip_pool_rips_readme(line[1]), line[2])
if ip == item.split()[3]:
if line[4] != 'Pool member is available':
cool = 0
# return (3, "Lets see if I catch you at unavailable for %s with pool member status: %s, %s" % (item, line[2], line[4]))
rip += check_f5_bigip_pool_rips_getmyripinfo(line)
break
if check == 2:
warn_num_members, crit_num_members = params
pool_act_members = saveint(line[1])
pool_def_members = saveint(line[2])
pool_unv_members = pool_def_members - pool_act_members
message = "The Pool has %i/%i members available." % (pool_act_members, pool_def_members)
### determine the monitor state now
if cool != 0:
return (0, "OK - %s. %s" % (rip, message))
# elif cool == 0:
# return (3, "Lets see if I catch you at unavailable for %s with pool member status: %s %s %s" % (item, line[0], line[1], line[2]))
elif pool_act_members == pool_def_members:
return (0, "OK - %s. %s" % (rip, message))
elif pool_act_members == 0:
return (2, "CRIT - %s. %s" % (rip, message))
elif pool_unv_members >= crit_num_members:
return (2, "CRIT - %s. %s" % (rip, message))
elif pool_unv_members >= warn_num_members:
return (1, "WARN - %s. %s" % (rip, message))
elif pool_unv_members < warn_num_members:
return (0, "OK - %s. %s" % (rip, message))
else:
return (3, "UNKNOWN output for %s" % (item))
return (3, "UNKNOWN - unexpected Output from SNMP Agent")
snmp_info["f5_bigip_pool_rips"] = \
[ ( ".1.3.6.1.4.1.3375.2.2.5.6.2.1", [
1, # ltmPoolMbrStatusPoolName
3, # ltmPoolMbrStatusAddr
4, # ltmPoolMbrStatusPort
6, # ltmPoolMbrStatusEnabledState
8, # ltmPoolMbrStatusDetailReaso
]),
( ".1.3.6.1.4.1.3375.2.2.5.1.2.1", [
1, # ltmPoolEntry
8, # ltmPoolActiveMemberCnt
23, # ltmPoolMemberCnt
])
]
check_info["f5_bigip_pool_rips"] = (check_f5_bigip_pool_rips, "F5 LB Pool %s", 0, lambda info: inventory_f5_bigip_pool_rips("f5_bigip_pool_rips", info))
snmp_scan_functions["f5_bigip_pool_rips"] = \
lambda oid: '.1.3.6.1.4.1.3375.2' in oid(".1.3.6.1.2.1.1.2.0") and "big-ip" in oid(".1.3.6.1.4.1.3375.2.1.4.1.0").lower()