glensc / nagios-plugin-check_raid

Nagios/Icinga/Sensu plugin to check current server's RAID status ⛺
144 stars 84 forks source link

Sort megacli devices numerically #191

Closed odenbach closed 5 years ago

odenbach commented 5 years ago

Hi,

one of our Supermicro servers has 36 local disks attached to a MegaRaid controller. megacli sorts the disks by enclosure id and slot number, but check_raid displays the device id instead. This may lead to unsorted output:

root@tc-covp[nagios-plugin-check_raid]# /usr/lib/nagios/plugins/check_raid 
CRITICAL: megacli:[Volumes(1): DISK0.0:Partially; Devices(35): 10,19,12,23,13,22,14,25,15,39,18,28,27,33,11,32,36,43,40,38,44,41,45,42,20,31,26,17,16,37,29,21,34,24,35=Online]

The attached patch sorts the devices numerically:

root@tc-covp[nagios-plugin-check_raid]# ./check_raid.sh 
CRITICAL: megacli:[Volumes(1): DISK0.0:Partially; Devices(35): 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45=Online]

Which makes it much easier to spot the missing disk id 30.

I tried to put the sort function into _joinstatus() first, but that did not work as not all controllers return disk names that are easily sortable (01 vs. 1:2 vs. Y2O483PAS).

Regards,

Christopher

odenbach commented 5 years ago

The build error has nothing to do with my patch. Something else must be broken.