fix mitel zap bandwidth perfdata
This commit is contained in:
parent
82d6a0e758
commit
7877330e76
|
@ -32,17 +32,23 @@ sub custom_usage_calc {
|
||||||
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_mitelBWMCurrentBandwidthInUse'} * 1000;
|
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_mitelBWMCurrentBandwidthInUse'} * 1000;
|
||||||
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_mitelBWMCurrentBandwidthLimit'} * 1000;
|
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_mitelBWMCurrentBandwidthLimit'} * 1000;
|
||||||
$self->{result_values}->{used_prct} = $self->{result_values}->{used} / $self->{result_values}->{total} * 100;
|
$self->{result_values}->{used_prct} = $self->{result_values}->{used} / $self->{result_values}->{total} * 100;
|
||||||
|
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub custom_usage_perfdata {
|
sub custom_usage_perfdata {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $extra_label = '';
|
||||||
|
$extra_label = '_' . $self->{result_values}->{display} if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => 'usage', unit => 'b/s',
|
$self->{output}->perfdata_add(
|
||||||
value => $self->{result_values}->{used},
|
label => 'usage' . $extra_label, unit => 'b/s',
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, total => $self->{result_values}->{total}, cast_int => 1),
|
value => $self->{result_values}->{used},
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, total => $self->{result_values}->{total}, cast_int => 1),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, total => $self->{result_values}->{total}, cast_int => 1),
|
||||||
min => 0, max => $self->{result_values}->{total});
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, total => $self->{result_values}->{total}, cast_int => 1),
|
||||||
|
min => 0, max => $self->{result_values}->{total}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub custom_usage_output {
|
sub custom_usage_output {
|
||||||
|
@ -56,12 +62,14 @@ sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
{ name => 'zap', type => 1, cb_prefix_output => 'prefix_zap_output', message_multiple => 'All zone access points are ok' },
|
{ name => 'zap', type => 1, cb_prefix_output => 'prefix_zap_output',
|
||||||
|
message_multiple => 'All zone access points are ok' },
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{zap} = [
|
$self->{maps_counters}->{zap} = [
|
||||||
{ label => 'usage', set => {
|
{ label => 'usage', set => {
|
||||||
key_values => [ { name => 'mitelBWMCurrentBandwidthInUse' }, { name => 'mitelBWMCurrentBandwidthLimit' },
|
key_values => [ { name => 'mitelBWMCurrentBandwidthInUse' },
|
||||||
|
{ name => 'mitelBWMCurrentBandwidthLimit' },
|
||||||
{ name => 'display' } ],
|
{ name => 'display' } ],
|
||||||
closure_custom_calc => $self->can('custom_usage_calc'),
|
closure_custom_calc => $self->can('custom_usage_calc'),
|
||||||
closure_custom_output => $self->can('custom_usage_output'),
|
closure_custom_output => $self->can('custom_usage_output'),
|
||||||
|
@ -84,10 +92,9 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
"filter-name:s" => { name => 'filter_name' },
|
||||||
"filter-name:s" => { name => 'filter_name' },
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -99,8 +106,8 @@ sub check_options {
|
||||||
|
|
||||||
my $oid_mitelBWMCurrentZAPLabel = '.1.3.6.1.4.1.1027.4.1.1.2.5.1.1.1.1.4',
|
my $oid_mitelBWMCurrentZAPLabel = '.1.3.6.1.4.1.1027.4.1.1.2.5.1.1.1.1.4',
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
mitelBWMCurrentBandwidthInUse => { oid => '.1.3.6.1.4.1.1027.4.1.1.2.5.1.1.1.1.5' },
|
mitelBWMCurrentBandwidthInUse => { oid => '.1.3.6.1.4.1.1027.4.1.1.2.5.1.1.1.1.5' },
|
||||||
mitelBWMCurrentBandwidthLimit => { oid => '.1.3.6.1.4.1.1027.4.1.1.2.5.1.1.1.1.6' },
|
mitelBWMCurrentBandwidthLimit => { oid => '.1.3.6.1.4.1.1027.4.1.1.2.5.1.1.1.1.6' },
|
||||||
};
|
};
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
|
@ -127,8 +134,7 @@ sub manage_selection {
|
||||||
$snmp_result = $options{snmp}->get_leef(nothing_quit => 1);
|
$snmp_result = $options{snmp}->get_leef(nothing_quit => 1);
|
||||||
|
|
||||||
foreach (keys %{$self->{zap}}) {
|
foreach (keys %{$self->{zap}}) {
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $_);
|
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $_);
|
||||||
|
|
||||||
foreach my $name (keys %{$mapping}) {
|
foreach my $name (keys %{$mapping}) {
|
||||||
$self->{zap}->{$_}->{$name} = $result->{$name};
|
$self->{zap}->{$_}->{$name} = $result->{$name};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue