add AIX and AS400 support
git-svn-id: http://svn.centreon.com/Plugins/Dev@2946 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
e5421414bc
commit
15c49f8b7a
|
@ -40,7 +40,7 @@ if (eval "require oreon" ) {
|
|||
}
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_v $opt_f $opt_C $opt_d $opt_k $opt_u $opt_p $opt_n $opt_w $opt_c $opt_H $opt_s @test);
|
||||
use vars qw($opt_V $opt_t $opt_h $opt_v $opt_f $opt_C $opt_d $opt_k $opt_u $opt_p $opt_n $opt_w $opt_c $opt_H $opt_s @test);
|
||||
|
||||
# Plugin var init
|
||||
|
||||
|
@ -66,7 +66,8 @@ GetOptions
|
|||
"n" => \$opt_n, "name" => \$opt_n,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||
"t=s" => \$opt_t);
|
||||
|
||||
|
||||
if ($opt_V) {
|
||||
|
@ -142,11 +143,15 @@ my $name = $0;
|
|||
$name =~ s/\.pl.*//g;
|
||||
|
||||
# Plugin snmp requests
|
||||
|
||||
my $OID_hrStorageDescr =$oreon{MIB2}{HR_STORAGE_DESCR};
|
||||
my $OID_hrStorageAllocationUnits =$oreon{MIB2}{HR_STORAGE_ALLOCATION_UNITS};
|
||||
my $OID_hrStorageSize =$oreon{MIB2}{HR_STORAGE_SIZE};
|
||||
my $OID_hrStorageUsed =$oreon{MIB2}{HR_STORAGE_USED};
|
||||
my $OID_hrStorageDescr = "";
|
||||
if (defined($opt_t) && ($opt_t eq "AIX" || $opt_t eq "AS400")){
|
||||
$OID_hrStorageDescr = ".1.3.6.1.2.1.25.3.8.1.2";
|
||||
} else {
|
||||
$OID_hrStorageDescr = $oreon{MIB2}{HR_STORAGE_DESCR};
|
||||
}
|
||||
my $OID_hrStorageAllocationUnits = $oreon{MIB2}{HR_STORAGE_ALLOCATION_UNITS};
|
||||
my $OID_hrStorageSize = $oreon{MIB2}{HR_STORAGE_SIZE};
|
||||
my $OID_hrStorageUsed = $oreon{MIB2}{HR_STORAGE_USED};
|
||||
|
||||
# create a SNMP session
|
||||
my ($session, $error);
|
||||
|
@ -188,12 +193,16 @@ if ($opt_n) {
|
|||
$expr = "$opt_d";
|
||||
}
|
||||
foreach my $key ( oid_lex_sort(keys %$result)) {
|
||||
if (defined($opt_t) && $opt_t eq "AS400"){
|
||||
$result->{$key} =~ s/\ //g;
|
||||
}
|
||||
if ($result->{$key} =~ m/$expr/) {
|
||||
my @oid_list = split (/\./,$key);
|
||||
$partition = pop (@oid_list) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($opt_s) {
|
||||
# Get description table
|
||||
my $result = $session->get_table(
|
||||
|
@ -214,6 +223,7 @@ if ($opt_s) {
|
|||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
|
||||
my $result = $session->get_request(
|
||||
-varbindlist => [$OID_hrStorageDescr.".".$partition ,
|
||||
$OID_hrStorageAllocationUnits.".".$partition ,
|
||||
|
@ -228,6 +238,7 @@ if (!defined($result)) {
|
|||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
$hrStorageDescr = $result->{$OID_hrStorageDescr.".".$partition };
|
||||
$AllocationUnits = $result->{$OID_hrStorageAllocationUnits.".".$partition };
|
||||
$Size = $result->{$OID_hrStorageSize.".".$partition };
|
||||
|
@ -274,6 +285,7 @@ if (($Size =~ /([0-9]+)/) && ($AllocationUnits =~ /([0-9]+)/)){
|
|||
}
|
||||
|
||||
if ($hrStorageDescr){
|
||||
$hrStorageDescr =~ s/\ //g if (defined($opt_t) && $opt_t eq "AS400");
|
||||
print $hrStorageDescr . " TOTAL: ";
|
||||
printf("%.3f", $tot);
|
||||
print " Go USED: " . $pourcent . "% : ";
|
||||
|
|
Loading…
Reference in New Issue