+ indentation fix

This commit is contained in:
garnier-quentin 2016-01-22 10:32:42 +01:00
parent a37549ca1d
commit 5ebbcc6c3e
4 changed files with 39 additions and 45 deletions

View File

@ -148,19 +148,19 @@ sub change_macros {
}
my %map_ap_status = (
1 => 'cleared',
2 => 'init',
3 => 'bootStarted',
4 => 'imageDownloaded',
5 => 'connectFailed',
6 => 'configuring',
7 => 'operationnal',
10 => 'redundant',
20 => 'connOutage',
1 => 'cleared',
2 => 'init',
3 => 'bootStarted',
4 => 'imageDownloaded',
5 => 'connectFailed',
6 => 'configuring',
7 => 'operationnal',
10 => 'redundant',
20 => 'connOutage',
);
my $mapping_name_oid = {
trpzApStatApStatusApName => { oid => '.1.3.6.1.4.1.14525.4.5.1.1.2.1.8' },
trpzApStatApStatusApName => { oid => '.1.3.6.1.4.1.14525.4.5.1.1.2.1.8' },
};
my $mapping_state_oid = {
trpzApStatApStatusApState => { oid => '.1.3.6.1.4.1.14525.4.5.1.1.2.1.5', map => \%map_ap_status },
@ -175,7 +175,7 @@ sub manage_selection {
{ oid => $mapping_state_oid->{trpzApStatApStatusApState}->{oid} },
],
nothing_quit => 1);
foreach my $oid (keys %{$self->{results}->{ $mapping_name_oid->{trpzApStatApStatusApName}->{oid} }}) {
$oid =~ /^$mapping_name_oid->{trpzApStatApStatusApName}->{oid}\.(.*)$/;
my $instance = $1;

View File

@ -100,14 +100,13 @@ sub prefix_ap_output {
}
my $mapping = {
trpzClSessClientSessApSerialNum => { oid => '.1.3.6.1.4.1.14525.4.4.1.1.1.1.7' },
trpzClSessClientSessApSerialNum => { oid => '.1.3.6.1.4.1.14525.4.4.1.1.1.1.7' },
};
my $mapping1 = {
trpzClSessClientSessSsid => { oid => '.1.3.6.1.4.1.14525.4.4.1.1.1.1.15' },
};
sub manage_selection {
my ($self, %options) = @_;
@ -119,18 +118,18 @@ sub manage_selection {
$self->{results} = $options{snmp}->get_multiple_table(oids => [{ oid => $oid_trpzApStatApStatusApName }, { oid => $mapping->{trpzClSessClientSessApSerialNum}->{oid} },
{ oid => $mapping1->{trpzClSessClientSessSsid}->{oid} }],
nothing_quit => 1);
foreach my $oid (keys %{$self->{results}->{ $mapping->{trpzClSessClientSessApSerialNum}->{oid} }}) {
$oid =~ /^$mapping->{trpzClSessClientSessApSerialNum}->{oid}\.(.*)$/;
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $mapping->{trpzClSessClientSessApSerialNum}->{oid} }, instance => $instance);
my $result1 = $options{snmp}->map_instance(mapping => $mapping1, results => $self->{results}->{ $mapping1->{trpzClSessClientSessSsid}->{oid} }, instance => $instance);
my @chars = split(//,$result->{trpzClSessClientSessApSerialNum});
my $ap_oid = '12';
foreach my $char (@chars) {
$ap_oid .= '.'.ord($char);
}
my $ap_name = $self->{results}->{$oid_trpzApStatApStatusApName}->{$oid_trpzApStatApStatusApName . '.' . $ap_oid};
my @chars = split(//,$result->{trpzClSessClientSessApSerialNum});
my $ap_oid = '12';
foreach my $char (@chars) {
$ap_oid .= '.'.ord($char);
}
my $ap_name = $self->{results}->{$oid_trpzApStatApStatusApName}->{$oid_trpzApStatApStatusApName . '.' . $ap_oid};
if (defined($self->{option_results}->{filter_ap}) && $self->{option_results}->{filter_ap} ne '' &&
$ap_name !~ /$self->{option_results}->{filter_ap}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $ap_name . "': no matching filter.", debug => 1);
@ -142,12 +141,11 @@ sub manage_selection {
next;
}
$self->{global}->{total}++;
$self->{ap}->{$ap_name} = { total => 0, display => $ap_name } if (!defined($self->{ap}->{$ap_name}));
$self->{global}->{total}++;
$self->{ap}->{$ap_name} = { total => 0, display => $ap_name } if (!defined($self->{ap}->{$ap_name}));
$self->{ap}->{$ap_name}->{total}++;
$self->{ssid}->{$result1->{trpzClSessClientSessSsid}} = { total => 0, display => $result1->{trpzClSessClientSessSsid} } if (!defined($self->{ssid}->{$result1->{trpzClSessClientSessSsid}}));
$self->{ssid}->{$result1->{trpzClSessClientSessSsid}}->{total}++
$self->{ssid}->{$result1->{trpzClSessClientSessSsid}} = { total => 0, display => $result1->{trpzClSessClientSessSsid} } if (!defined($self->{ssid}->{$result1->{trpzClSessClientSessSsid}}));
$self->{ssid}->{$result1->{trpzClSessClientSessSsid}}->{total}++;
}
if (scalar(keys %{$self->{ap}}) <= 0 && scalar(keys %{$self->{ssid}}) <= 0) {

View File

@ -33,7 +33,7 @@ sub set_counters {
];
$self->{maps_counters}->{cpu} = [
{ label => 'average', set => {
{ label => 'average', set => {
key_values => [ { name => 'trpzSysCpuAverageLoad' } ],
output_template => 'average : %.2f %%',
perfdatas => [
@ -99,7 +99,7 @@ sub manage_selection {
my $oid_trpzSysCpuLastMinuteLoad = '.1.3.6.1.4.1.14525.4.8.1.1.11.2.0';
my $oid_trpzSysCpuLast5MinutesLoad = '.1.3.6.1.4.1.14525.4.8.1.1.11.3.0';
my $oid_trpzSysCpuLastHourLoad = '.1.3.6.1.4.1.14525.4.8.1.1.11.4.0';
my $results = $options{snmp}->get_leef(oids => [$oid_trpzSysCpuAverageLoad, $oid_trpzSysCpuLastMinuteLoad,
$oid_trpzSysCpuLast5MinutesLoad, $oid_trpzSysCpuLastHourLoad ],
nothing_quit => 1);

View File

@ -70,7 +70,7 @@ sub set_counters {
],
}
},
];
];
}
sub prefix_memory_output {
@ -85,7 +85,6 @@ sub prefix_flash_output {
return "Flash ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
@ -102,10 +101,8 @@ sub new {
sub manage_selection {
my ($self, %options) = @_;
my $total_bytes;
my $used_bytes;
my $free_bytes;
my ($total_bytes, $used_bytes, $free_bytes);
# TRAPEZE-NETWORKS-SYSTEM-MIB
my $oid_trpzSysFlashMemoryUsedBytes = '.1.3.6.1.4.1.14525.4.8.1.1.3.0';
my $oid_trpzSysFlashMemoryTotalBytes = '.1.3.6.1.4.1.14525.4.8.1.1.4.0';
@ -131,19 +128,18 @@ sub manage_selection {
my $free_bytes_flash = $results->{$oid_trpzSysFlashMemoryTotalBytes} - $results->{$oid_trpzSysFlashMemoryUsedBytes};
$self->{memory} = {display => 'memory',
prct_used => $used_bytes * 100 / $total_bytes,
used => $used_bytes,
free => $free_bytes,
total => $total_bytes,
};
prct_used => $used_bytes * 100 / $total_bytes,
used => $used_bytes,
free => $free_bytes,
total => $total_bytes,
};
$self->{flash} = {display => 'flash',
prct_used => $results->{$oid_trpzSysFlashMemoryUsedBytes} * 100 / $results->{$oid_trpzSysFlashMemoryTotalBytes},
used => $results->{$oid_trpzSysFlashMemoryUsedBytes},
free => $free_bytes_flash,
total => $results->{$oid_trpzSysFlashMemoryTotalBytes},
};
prct_used => $results->{$oid_trpzSysFlashMemoryUsedBytes} * 100 / $results->{$oid_trpzSysFlashMemoryTotalBytes},
used => $results->{$oid_trpzSysFlashMemoryUsedBytes},
free => $free_bytes_flash,
total => $results->{$oid_trpzSysFlashMemoryTotalBytes},
};
}
1;