1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 02:13:44 +01:00

enclosure battery support added

This commit is contained in:
Pall Sigurdsson 2013-12-06 13:58:44 +00:00
parent f87963f554
commit 7c41c09b2f

View File

@ -4,7 +4,7 @@ from pynag.Plugins import PluginHelper, ok, warning, critical, unknown
from pynag.Utils import runCommand from pynag.Utils import runCommand
from collections import namedtuple from collections import namedtuple
valid_queries = "lsarray lsmdiskgrp lsdrive lsvdisk" valid_queries = "lsarray lsdrive lsenclosurebattery lsenclosurecanister lsenclosurepsu lsenclosureslot lsenclosure lsmdiskgrp lsmdskgrp lsmgrp lsrcrelationship lsvdisk"
p = PluginHelper() p = PluginHelper()
p.add_option("-H", "--hostname", '-M', help="Hostname or ip address", dest="hostname") p.add_option("-H", "--hostname", '-M', help="Hostname or ip address", dest="hostname")
@ -80,6 +80,14 @@ def check_lsdrive():
p.add_summary("drive %s is %s" % (row.id, row.status)) p.add_summary("drive %s is %s" % (row.id, row.status))
def check_lsenclosurebattery():
p.add_summary("%s batteries found" % (len(rows)))
p.add_metric("number of batteries", len(rows))
for row in rows:
if row.status != 'online':
p.add_summary("battery %s:%s is %s" % (row.enclosure_id, row.battery_id, row.status))
def check_lsvdisk(): def check_lsvdisk():
p.add_summary("%s disks found" % (len(rows))) p.add_summary("%s disks found" % (len(rows)))
p.add_metric("number of disks", len(rows)) p.add_metric("number of disks", len(rows))
@ -110,6 +118,8 @@ elif query == 'lsdrive':
check_lsdrive() check_lsdrive()
elif query == 'lsvdisk': elif query == 'lsvdisk':
check_lsvdisk() check_lsvdisk()
elif query == 'lsenclosurebattery':
check_lsenclosurebattery()
else: else:
p.status(unknown) p.status(unknown)
p.add_summary("unsupported query: %s. See -L for list of valid queries" % query) p.add_summary("unsupported query: %s. See -L for list of valid queries" % query)