Enhance alcatel omniswitch hardware for new version

This commit is contained in:
garnier-quentin 2019-03-21 16:00:29 +01:00
parent 741d75edc9
commit 9c47b1000e
13 changed files with 127 additions and 86 deletions

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'backplane'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 4) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 4) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'backplane', instance => $instance));
$self->{components}->{backplane}->{total}++;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'chassis'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 3) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 3) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'chassis', instance => $instance));
$self->{components}->{chassis}->{total}++;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'container'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 5) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 5) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'container', instance => $instance));
$self->{components}->{container}->{total}++;

View File

@ -40,17 +40,17 @@ sub check {
return if ($self->check_filter(section => 'fan'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 7) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 7) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'fan', instance => $instance));
$self->{components}->{fan}->{total}++;
@ -84,14 +84,14 @@ sub check {
}
}
foreach my $key (keys %{$self->{results}->{$oids{alaChasEntPhysFanStatus}}}) {
next if ($key !~ /^$oids{alaChasEntPhysFanStatus}\.(.*?)\.(.*?)$/);
foreach my $key (keys %{$self->{results}->{$oids{$self->{type}}->{alaChasEntPhysFanStatus}}}) {
next if ($key !~ /^$oids{$self->{type}}->{alaChasEntPhysFanStatus}\.(.*?)\.(.*?)$/);
my ($phys_index, $loc_index) = ($1, $2);
my $status = $self->{results}->{$oids{alaChasEntPhysFanStatus}}->{$key};
my $descr = defined($self->{results}->{entity}->{$oids{entPhysicalDescr} . '.' . $phys_index}) ?
$self->{results}->{entity}->{$oids{entPhysicalDescr} . '.' . $phys_index} : 'unknown';
my $name = defined($self->{results}->{entity}->{$oids{entPhysicalName} . '.' . $phys_index}) ?
$self->{results}->{entity}->{$oids{entPhysicalName} . '.' . $phys_index} : 'unknown';
my $status = $self->{results}->{$oids{$self->{type}}->{alaChasEntPhysFanStatus}}->{$key};
my $descr = defined($self->{results}->{entity}->{$oids{common}->{entPhysicalDescr} . '.' . $phys_index}) ?
$self->{results}->{entity}->{$oids{common}->{entPhysicalDescr} . '.' . $phys_index} : 'unknown';
my $name = defined($self->{results}->{entity}->{$oids{common}->{entPhysicalName} . '.' . $phys_index}) ?
$self->{results}->{entity}->{$oids{common}->{entPhysicalName} . '.' . $phys_index} : 'unknown';
next if ($self->check_filter(section => 'fan', instance => $phys_index . '.' . $loc_index));
$self->{components}->{fan}->{total}++;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'module'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 9) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 9) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'module', instance => $instance));
$self->{components}->{module}->{total}++;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'other'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 1) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 1) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'other', instance => $instance));
$self->{components}->{other}->{total}++;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'port'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 10) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 10) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'port', instance => $instance));
$self->{components}->{port}->{total}++;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'psu'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 6) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 6) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'psu', instance => $instance));
$self->{components}->{psu}->{total}++;

View File

@ -57,7 +57,7 @@ our @EXPORT_OK = qw(%physical_class %phys_oper_status %phys_admin_status %oids $
7 => 'unpowered',
8 => 'master',
9 => 'idle',
10 => 'unpoweredLicMismatch',
10 => 'pwrsave',
);
%phys_admin_status = (
@ -70,29 +70,58 @@ our @EXPORT_OK = qw(%physical_class %phys_oper_status %phys_admin_status %oids $
7 => 'standby',
8 => 'resetWithFabric',
9 => 'takeoverWithFabrc',
10 => 'vcTakeover',
11 => 'resetVcAll',
);
%oids = (
entPhysicalDescr => '.1.3.6.1.2.1.47.1.1.1.1.2',
entPhysicalClass => '.1.3.6.1.2.1.47.1.1.1.1.5',
entPhysicalName => '.1.3.6.1.2.1.47.1.1.1.1.7',
chasEntPhysAdminStatus => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.1',
chasEntPhysOperStatus => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.2',
chasEntPhysPower => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.4',
common => {
entPhysicalDescr => '.1.3.6.1.2.1.47.1.1.1.1.2',
entPhysicalClass => '.1.3.6.1.2.1.47.1.1.1.1.5',
entPhysicalName => '.1.3.6.1.2.1.47.1.1.1.1.7',
},
aos6 => {
entreprise_alcatel_base => '.1.3.6.1.4.1.6486.800',
chasEntPhysAdminStatus => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.1',
chasEntPhysOperStatus => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.2',
chasEntPhysPower => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.4',
chasHardwareBoardTemp => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.4',
chasTempThreshold => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.7',
chasDangerTempThreshold => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.8',
chasHardwareBoardTemp => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.4',
chasTempThreshold => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.7',
chasDangerTempThreshold => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.8',
alaChasEntPhysFanStatus => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.11.1.2',
alaChasEntPhysFanStatus => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.11.1.2',
},
aos7 => {
entreprise_alcatel_base => '.1.3.6.1.4.1.6486.801',
chasEntPhysAdminStatus => '1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.1',
chasEntPhysOperStatus => '1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.2',
chasEntPhysPower => '1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.3',
chasTempThreshold => '1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.5',
chasDangerTempThreshold => '1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.6',
alaChasEntPhysFanStatus => '1.3.6.1.4.1.6486.801.1.1.1.3.1.1.11.1.2',
},
);
$mapping = {
entPhysicalDescr => { oid => $oids{entPhysicalDescr} },
entPhysicalName => { oid => $oids{entPhysicalName} },
chasEntPhysAdminStatus => { oid => $oids{chasEntPhysAdminStatus}, map => \%phys_admin_status, default => 'unknown' },
chasEntPhysOperStatus => { oid => $oids{chasEntPhysOperStatus}, map => \%phys_oper_status, default => 'unknown' },
chasEntPhysPower => { oid => $oids{chasEntPhysPower}, default => -1 },
aos6 => {
entPhysicalDescr => { oid => $oids{common}->{entPhysicalDescr} },
entPhysicalName => { oid => $oids{common}->{entPhysicalName} },
chasEntPhysAdminStatus => { oid => $oids{aos6}->{chasEntPhysAdminStatus}, map => \%phys_admin_status, default => 'unknown' },
chasEntPhysOperStatus => { oid => $oids{aos6}->{chasEntPhysOperStatus}, map => \%phys_oper_status, default => 'unknown' },
chasEntPhysPower => { oid => $oids{aos6}->{chasEntPhysPower}, default => -1 },
},
aos7 => {
entPhysicalDescr => { oid => $oids{common}->{entPhysicalDescr} },
entPhysicalName => { oid => $oids{common}->{entPhysicalName} },
chasEntPhysAdminStatus => { oid => $oids{aos7}->{chasEntPhysAdminStatus}, map => \%phys_admin_status, default => 'unknown' },
chasEntPhysOperStatus => { oid => $oids{aos7}->{chasEntPhysOperStatus}, map => \%phys_oper_status, default => 'unknown' },
chasEntPhysPower => { oid => $oids{aos7}->{chasEntPhysPower}, default => -1 },
},
};
1;
1;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'sensor'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 8) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 8) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'sensor', instance => $instance));
$self->{components}->{sensor}->{total}++;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'stack'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 11) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 11) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'stack', instance => $instance));
$self->{components}->{stack}->{total}++;

View File

@ -34,17 +34,17 @@ sub check {
return if ($self->check_filter(section => 'unknown'));
my @instances = ();
foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) {
if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 2) {
next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/);
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 2) {
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
push @instances, $1;
}
}
foreach my $instance (@instances) {
next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}));
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}->{chasEntPhysAdminStatus} . '.' . $instance}));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance);
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
next if ($self->check_filter(section => 'unknown', instance => $instance));
$self->{components}->{unknown}->{total}++;

View File

@ -61,16 +61,28 @@ sub snmp_execute {
$self->{snmp} = $options{snmp};
$self->{results} = $self->{snmp}->get_multiple_table(oids => [
{ oid => $oids{entPhysicalClass} },
{ oid => $oids{alaChasEntPhysFanStatus} },
{ oid => $oids{common}->{entPhysicalClass} },
{ oid => $oids{aos6}->{alaChasEntPhysFanStatus} },
{ oid => $oids{aos7}->{alaChasEntPhysFanStatus} },
]);
$self->{results}->{entity} = $self->{snmp}->get_multiple_table(oids => [
{ oid => $oids{entPhysicalDescr} },
{ oid => $oids{entPhysicalName} },
{ oid => $oids{chasEntPhysAdminStatus} },
{ oid => $oids{chasEntPhysOperStatus} },
{ oid => $oids{chasEntPhysPower} },
{ oid => $oids{common}->{entPhysicalDescr} },
{ oid => $oids{common}->{entPhysicalName} },
{ oid => $oids{aos6}->{chasEntPhysAdminStatus} },
{ oid => $oids{aos6}->{chasEntPhysOperStatus} },
{ oid => $oids{aos6}->{chasEntPhysPower} },
{ oid => $oids{aos7}->{chasEntPhysAdminStatus} },
{ oid => $oids{aos7}->{chasEntPhysOperStatus} },
{ oid => $oids{aos7}->{chasEntPhysPower} },
], return_type => 1);
$self->{type} = 'aos6';
foreach (keys %{$self->{results}->{entity}}) {
if (/^$oids{aos7}->{entreprise_alcatel_base}\./) {
$self->{type} = 'aos7';
last;
}
}
}
sub new {