1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-09-28 16:33:46 +02:00

Added performance counter for mode check_disks

mode check_disks will output performance data "| 'Good Disks'=60"
It just counts all disks with operationalstate == good
This commit is contained in:
gitmopp 2014-02-05 10:19:14 +01:00
parent 553a182dd1
commit 3f44b6bf01

View File

@ -497,6 +497,7 @@ def check_generic(command="ls disk full", namefield="objectname", perfdata_field
usedstoragespacegb = 0 usedstoragespacegb = 0
occupancyalarmlvel = 0 occupancyalarmlvel = 0
warninggb = 0 warninggb = 0
gooddisks = 0
for i in objects: for i in objects:
systemname = i['systemname'] systemname = i['systemname']
# Some versions of commandview use "objectname" instead of namefield # Some versions of commandview use "objectname" instead of namefield
@ -528,6 +529,12 @@ def check_generic(command="ls disk full", namefield="objectname", perfdata_field
add_perfdata("'%s%s'=%s " % add_perfdata("'%s%s'=%s " %
(identifier, field, i.get(field, None))) (identifier, field, i.get(field, None)))
# Count disks with operationalstate good
if command == "ls disk full":
if i['operationalstate'] == 'good':
gooddisks += 1
perfdata = "'Good Disks'=" + str(gooddisks)
# Disk group gets a special perfdata treatment # Disk group gets a special perfdata treatment
if command == "ls disk_group full": if command == "ls disk_group full":
totalstoragespacegb = float(i['totalstoragespacegb']) totalstoragespacegb = float(i['totalstoragespacegb'])