Module: check_mk
Branch: master
Commit: 1bacc202473ceda3bc291da1d4b96ceddd922706
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1bacc202473ced…
Author: Florian Heigl <fh(a)mathias-kettner.de>
Date: Fri Jun 3 16:41:18 2011 +0200
New checks: f5_bigip_cluster (cluster sync status), f5_bigip_fans (system and cpu fan
status). Needs testing, man pages.
---
checks/f5_bigip_cluster | 79 +++++++++++++++++++++++++++++++++++++++++
checks/f5_bigip_fans | 89 +++++++++++++++++++++++++++++++++++++++++++++++
checks/f5_bigip_pool | 14 ++++----
3 files changed, 175 insertions(+), 7 deletions(-)
diff --git a/checks/f5_bigip_cluster b/checks/f5_bigip_cluster
new file mode 100644
index 0000000..e0ecb01
--- /dev/null
+++ b/checks/f5_bigip_cluster
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 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.
+
+
+# Agent / MIB output
+# see: 1.3.6.1.4.1.3375.2.1.1.1.1.6.0
+# F5-BIGIP-SYSTEM-MIB::sysAttrConfigsyncState (STRING)
+# "-1 - uninitialized or disabled config state"
+
+# F5 nodes need to be ntp synced otherwise status reports might be wrong.
+
+
+def inventory_f5_bigip_cluster(checkname, info):
+ # run inventory unless we found a device in unconfigured state
+ # don't need to loop over the input as there's only one status.
+ if len(info) == 1 and not info[0][0].startswith("-1"):
+ return [(None, None)]
+ return []
+
+
+def check_f5_bigip_cluster(item, _no_params, info):
+ cfgsyncstate = info[0][0]
+
+ # Split the snmp supplied status string to the numeric and textual status
+ statusid, statustxt = cfgsyncstate.split(" - ")
+
+ # Possible states:
+ # -1 unconfigured, ok only if original status
+ # otherwise this would mean something is heavily
broken?
+ # 0 in sync, ok
+ # 1/2 one system outdated, warn
+ # 3 both systems outdated, crit (config split brain)
+
+ if statusid == "0":
+ return (0, "OK - " + statustxt)
+ elif statusid == "-1":
+ return (2, "CRIT - " + statustxt)
+ elif statusid == "1" or statusid == "2":
+ return (1, "WARNING - " + statustxt)
+ elif statusid == "3":
+ return (2, "CRIT - " + statustxt)
+ else:
+ return (3, "UNKNOWN - unexpected Output from SNMP Agent")
+
+
+snmp_info["f5_bigip_cluster"] = \
+ ( ".1.3.6.1.4.1.3375.2.1.1.1.1", [
+ 6, # sysAttrConfigsyncState
+ ])
+
+
+check_info["f5_bigip_cluster"] = (check_f5_bigip_cluster, "Config Sync
status", 0, inventory_f5_bigip_cluster )
+
+
+snmp_scan_functions["f5_bigip_cluster"] = \
+ 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()
diff --git a/checks/f5_bigip_fans b/checks/f5_bigip_fans
new file mode 100644
index 0000000..e27aa52
--- /dev/null
+++ b/checks/f5_bigip_fans
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 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.
+
+
+# Agent / MIB output
+# see: 1.3.6.1.4.1.3375.2.1.3.2.1.2 (Chassis fans)
+# F5-BIGIP-SYSTEM-MIB::sysChassisFanEntry
+# see: 1.3.6.1.4.1.3375.2.1.3.1.1 (CPU & CPU fans)
+# sysCpuGroup
+
+
+def f5_bigip_fans_genitem(fanid):
+ fanid = int(fanid)
+ if fanid < 10:
+ fantype = "Processor"
+ elif fanid >=100:
+ fantype = "Chassis"
+ else:
+ fantype = "Unknown"
+ return ("%s %d" % (fantype, fanid))
+
+
+def inventory_f5_bigip_fans(checkname, info):
+ inventory = []
+ for line in info:
+ for fanentry in line:
+ inventory.append((f5_bigip_fans_genitem(fanentry[0]), None))
+
+ return inventory
+
+
+def check_f5_bigip_fans(item, _no_params, info):
+ for line in info:
+ for fanentry in line:
+ if f5_bigip_fans_genitem(fanentry[0]) == item:
+ speed = int(fanentry[1])
+ if "Chassis" in item:
+ # the "normal" speed is around 10K RPM
+ warn, crit = (7500, 2000)
+ else:
+ # F5's CPU Fans run around 6K RPM
+ warn, crit = (4000, 1200)
+ msgtxt = " - speed is %d rpm" % speed
+ if speed > warn:
+ return (0, "OK" + msgtxt)
+ elif speed < crit:
+ return (2, "CRITCAL" + msgtxt)
+ elif speed < warn:
+ return (1, "WARNING" + msgtxt)
+ else:
+ return (3, "UNKNOWN - could not detect speed")
+
+ return (3, "UNKNOWN - item not found in SNMP output")
+
+
+snmp_info["f5_bigip_fans"] = \
+ [ (".1.3.6.1.4.1.3375.2.1.3.2.1.2.1", [ 1, 3 ]),
+ ( ".1.3.6.1.4.1.3375.2.1.3.1.2.1", [ 1, 3 ]), ]
+
+
+check_info["f5_bigip_fans"] = (check_f5_bigip_fans, "Fan %s", 0,
inventory_f5_bigip_fans )
+
+
+# Get ID and Speed from the CPU and chassis fan tables
+snmp_scan_functions["f5_bigip_fans"] = \
+ 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()
diff --git a/checks/f5_bigip_pool b/checks/f5_bigip_pool
index 7126b91..63ca11a 100644
--- a/checks/f5_bigip_pool
+++ b/checks/f5_bigip_pool
@@ -53,9 +53,9 @@ def check_f5_bigip_pool(item, params, info):
pool_def_members = int(line[2])
if pool_act_members == pool_def_members or pool_act_members >
warn_num_members:
- return (0, "OK - all members online")
+ return (0, "OK - all members online")
elif pool_act_members <= crit_num_members:
- return (2, "CRIT - only %s pool member(s) left" % pool_act_members)
+ return (2, "CRIT - only %s pool member(s) left" %
pool_act_members)
elif pool_act_members == 0:
return (2, "CRIT - no pool members left")
elif pool_act_members <= warn_num_members:
@@ -64,16 +64,16 @@ def check_f5_bigip_pool(item, params, info):
return (3, "UNKNOWN output for pool %s" % item)
return (3, "UNKNOWN - unexpected Output from SNMP Agent")
-
+
snmp_info["f5_bigip_pool"] = \
( ".1.3.6.1.4.1.3375.2.2.5.1.2.1", [
- 1, # ltmPoolEntry
- 8, # ltmPoolActiveMemberCnt
- 23, # ltmPoolMemberCnt
+ 1, # ltmPoolEntry
+ 8, # ltmPoolActiveMemberCnt
+ 23, # ltmPoolMemberCnt
])
-check_info["f5_bigip_pool"] = (check_f5_bigip_pool, "Load Balancing Pool
%s", 0, inventory_f5_bigip_pool )
+check_info["f5_bigip_pool"] = (check_f5_bigip_pool, "Load Balancing Pool
%s", 0, inventory_f5_bigip_pool )
snmp_scan_functions["f5_bigip_pool"] = \