Module: check_mk
Branch: master
Commit: 6d9ae3d23878811f183b4112366c14b87089a5cd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6d9ae3d2387881…
Author: Florian Heigl <fh(a)mathias-kettner.de>
Date: Mon Jan 9 18:07:47 2012 +0100
Linux Agent: update URL of MegaCli to better / newer version
Linux Agent: add agent part for new check megaraid_bbu
New Check: megaraid_bbu - Check the status of battery backup unit in midrange / highend
LSI based controllers.
Users of very old MegaCli versions might need to update.
---
agents/check_mk_agent.linux | 2 +
checkman/megaraid_bbu | 22 +++++++++
checks/megaraid_bbu | 100 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 124 insertions(+), 0 deletions(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 474f374..0745ecc 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -276,6 +276,8 @@ if which MegaCli >/dev/null ; then
MegaCli -PDList -aALL -NoLog < /dev/null | egrep 'Enclosure|Raw Size|Slot
Number|Device Id|Firmware state|Inquiry'
echo '<<<megaraid_ldisks>>>'
MegaCli -LDInfo -Lall -aALL -NoLog < /dev/null | egrep
'Size|State|Number|Adapter|Virtual'
+ echo '<<<megaraid_bbu>>>'
+ MegaCli -AdpBbuCmd -GetBbuStatus -aALL -NoLog < /dev/null | grep -v Exit
fi
# 3WARE disk controller (by Radoslaw Bak)
diff --git a/checkman/megaraid_bbu b/checkman/megaraid_bbu
new file mode 100644
index 0000000..e4ea82f
--- /dev/null
+++ b/checkman/megaraid_bbu
@@ -0,0 +1,22 @@
+title: Check state of battery backup unit (BBU) on LSI MegaRAID
+agents: linux
+author: Florian Heigl <fh(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the existance and status of battery backup units on controllers that
are based on the mid- and highend LSI Megaraid chipsets. The entry chipsets do not support
BBUs. The Linux agent will try find any existing BBUs - if {MegaCli} is found in your
search path.
+ The BBUs might come in various types {(iBBU, BBU)} and also some other vendors are using
this RAID chip. It is tested against Intel, Dell, IBM and FSC models.
+
+ The check works by matching the agent output against a dictionary of expected values. If
you have MegaCli installed and some values are not detected, it might be neccessary to
update your version of MegaCli.
+
+ {MegaCli} can be downloaded from LSI at the following URL
{http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaCLI.zip}
+
+ It would be possible to make the warning / critical levels user specifiable. See the
check source for this if you have a need to influence those parameters.
+
+item:
+ A string "RAID Adapter/BBU" followed by the ID of the adapter as reported by
MegaCli.
+
+inventory:
+ One item is generated per adapter that has an attached BBU module.
+
+
diff --git a/checks/megaraid_bbu b/checks/megaraid_bbu
new file mode 100644
index 0000000..183352b
--- /dev/null
+++ b/checks/megaraid_bbu
@@ -0,0 +1,100 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 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 output not included since it has almost 100 lines
+# it's available in our archive or fh's bitbucket
+
+# Load a fake controller with known good values for the most
+# important parameters only and try to define their importance
+megaraid_bbu_refvalues = {
+ 'Remaining Capacity Low' : ('No', 1),
+ 'I2c Errors Detected' : ('No', 1),
+ 'Temperature' : ('OK', 2),
+ 'Pack is about to fail & should be replaced': ('No', 1),
+ 'Charging Status' : ('None', 1),
+ 'Battery State' : ('Operational', 2),
+ 'Learn Cycle Status' : ('OK', 1),
+ 'Battery Pack Missing' : ('No', 2),
+ 'Battery Replacement required' : ('No', 1),
+ 'Over Temperature' : ('No', 2),
+ 'Over Charged' : ('No', 1),
+ 'Voltage' : ('OK', 2),
+}
+
+
+def megaraid_bbu_parse(info):
+ controllers = {}
+ for line in info:
+ # Format the Agent output
+ name, data = " ".join(line).split(":")
+ name = name.strip()
+ data = data.strip()
+
+ # Scan each controller into its own dictionary
+ if name == "BBU status for Adapter":
+ current_hba = {}
+ controllers[data] = current_hba
+ else:
+ # We lose the numerical temperature here
+ # (same key is used twice in output of megacli)
+ current_hba[name] = data
+ return controllers
+
+
+def inventory_megaraid_bbu(info):
+ return [ (name, None) for name in megaraid_bbu_parse(info) ]
+
+
+def check_megaraid_bbu(item, _no_params, info):
+ controllers = megaraid_bbu_parse(info)
+ if item not in controllers:
+ return (3, "UNKNOWN - Controller data not found in agent output")
+
+ controller = controllers[item]
+ broken = []
+ state = 0
+ # get current charge level
+ charge = (", Charge is %s" % controller['Relative State of
Charge'])
+
+ # verify defined important parameters to current level
+ for varname, (refvalue, refstate) in megaraid_bbu_refvalues.items():
+ value = controller[varname]
+ # build a list of all errors
+ if controller[varname] != refvalue:
+ broken.append("%s is %s, but should be %s(%s)" % (varname, value,
refvalue, "!" * refstate))
+ state = max(state, refstate)
+
+ # return assembled info
+ if broken:
+ return (state, nagios_state_names[state] + " - " + ", ".join(broken)
+ charge)
+ else:
+ return (0, "OK - all states as expected" + charge)
+
+ return (3, "UNKNOWN - Check not implemented")
+
+
+check_info["megaraid_bbu"] = (check_megaraid_bbu, "RAID Adapter/BBU
%s", 0, inventory_megaraid_bbu)