Support LLD discovery for MegaRAID controllers
This commit is contained in:
parent
6153c4aa15
commit
a5f8da6aa0
|
@ -9,4 +9,7 @@
|
||||||
|
|
||||||
# You can add a simple trigger on this check like:
|
# You can add a simple trigger on this check like:
|
||||||
# { hostname:raid.mega.status.str( OK ) }=0
|
# { hostname:raid.mega.status.str( OK ) }=0
|
||||||
UserParameter=raid.mega.status,/usr/bin/sudo /var/lib/zabbix/bin/check_raid_megaraid_sudo
|
UserParameter=raid.mega.status[*],/usr/bin/sudo /var/lib/zabbix/bin/check_raid_megaraid_sudo -s $1 -o $2 -m $3
|
||||||
|
|
||||||
|
# Discover if there's a controller to check
|
||||||
|
UserParameter=raid.mega.discovery,/usr/bin/sudo /var/lib/zabbix/bin/disco_raid_megaraid_sudo
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use JSON;
|
||||||
|
|
||||||
|
my $json;
|
||||||
|
@{$json->{data}} = ();
|
||||||
|
|
||||||
|
my $megacli = undef;
|
||||||
|
|
||||||
|
if (-x '/opt/MegaRAID/MegaCli/MegaCli64'){
|
||||||
|
$megacli = '/opt/MegaRAID/MegaCli/MegaCli64';
|
||||||
|
}
|
||||||
|
elsif (-x '/opt/MegaRAID/MegaCli/MegaCli'){
|
||||||
|
$megacli = '/opt/MegaRAID/MegaCli/MegaCli';
|
||||||
|
}
|
||||||
|
|
||||||
|
unless($megacli){
|
||||||
|
print to_json($json);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $adapters = 0;
|
||||||
|
open (ADPCOUNT, "$megacli -adpCount -NoLog |")
|
||||||
|
|| die "error: Could not execute MegaCli -adpCount";
|
||||||
|
|
||||||
|
while (<ADPCOUNT>) {
|
||||||
|
if ( m/Controller Count:\s*(\d+)/ ) {
|
||||||
|
$adapters = $1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close ADPCOUNT;
|
||||||
|
|
||||||
|
if ($adapters > 0){
|
||||||
|
push @{$json->{data}}, {"{#CONTROLLERNO}" => $adapters};
|
||||||
|
}
|
||||||
|
|
||||||
|
print to_json($json);
|
||||||
|
exit(0);
|
Loading…
Reference in New Issue