Fix #2188
This commit is contained in:
parent
3f640e0515
commit
b7b4f6c88c
|
@ -24,8 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use DateTime;
|
use POSIX;
|
||||||
use POSIX qw(strftime);
|
|
||||||
|
|
||||||
use base qw(centreon::plugins::templates::counter);
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
@ -45,37 +44,37 @@ sub set_counters {
|
||||||
$self->{maps_counters}->{queues} = [
|
$self->{maps_counters}->{queues} = [
|
||||||
{ label => 'total', nlabel => 'mulesoft.mq.messages.total.count', set => {
|
{ label => 'total', nlabel => 'mulesoft.mq.messages.total.count', set => {
|
||||||
key_values => [ { name => 'total' }, { name => 'display' } ],
|
key_values => [ { name => 'total' }, { name => 'display' } ],
|
||||||
output_template => 'Total : %s',
|
output_template => 'total: %s',
|
||||||
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'inflight', nlabel => 'mulesoft.mq.inflight.count', set => {
|
{ label => 'inflight', nlabel => 'mulesoft.mq.inflight.count', set => {
|
||||||
key_values => [ { name => 'inflight' }, { name => 'display' } ],
|
key_values => [ { name => 'inflight' }, { name => 'display' } ],
|
||||||
output_template => 'inflight : %s',
|
output_template => 'inflight: %s',
|
||||||
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'received', nlabel => 'mulesoft.mq.received.count', set => {
|
{ label => 'received', nlabel => 'mulesoft.mq.received.count', set => {
|
||||||
key_values => [ { name => 'received' }, { name => 'display' } ],
|
key_values => [ { name => 'received' }, { name => 'display' } ],
|
||||||
output_template => 'received : %s',
|
output_template => 'received: %s',
|
||||||
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'sent', nlabel => 'mulesoft.mq.sent.count', set => {
|
{ label => 'sent', nlabel => 'mulesoft.mq.sent.count', set => {
|
||||||
key_values => [ { name => 'sent' }, { name => 'display' } ],
|
key_values => [ { name => 'sent' }, { name => 'display' } ],
|
||||||
output_template => 'sent : %s',
|
output_template => 'sent: %s',
|
||||||
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'visible', nlabel => 'mulesoft.mq.visible.count', set => {
|
{ label => 'visible', nlabel => 'mulesoft.mq.visible.count', set => {
|
||||||
key_values => [ { name => 'visible' }, { name => 'display' } ],
|
key_values => [ { name => 'visible' }, { name => 'display' } ],
|
||||||
output_template => 'visible : %s',
|
output_template => 'visible: %s',
|
||||||
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'acked', nlabel => 'mulesoft.mq.acked.count', set => {
|
{ label => 'acked', nlabel => 'mulesoft.mq.acked.count', set => {
|
||||||
key_values => [ { name => 'acked' }, { name => 'display' } ],
|
key_values => [ { name => 'acked' }, { name => 'display' } ],
|
||||||
output_template => 'acked : %s',
|
output_template => 'acked: %s',
|
||||||
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
perfdatas => [ { template => '%d', min => 0, cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,9 +109,10 @@ sub check_options {
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
POSIX::setlocale(LC_ALL, "C");
|
||||||
my $time = time();
|
my $time = time();
|
||||||
my $end_time = strftime('%a, %d %b %Y %H:%M:%S', gmtime()) . ' GMT';
|
my $end_time = POSIX::strftime('%a, %d %b %Y %H:%M:%S', gmtime()) . ' GMT';
|
||||||
my $start_time = strftime('%a, %d %b %Y %H:%M:%S', gmtime($time - $self->{option_results}->{timeframe})) . ' GMT';
|
my $start_time = POSIX::strftime('%a, %d %b %Y %H:%M:%S', gmtime($time - $self->{option_results}->{timeframe})) . ' GMT';
|
||||||
|
|
||||||
my $destinations = $options{custom}->list_objects(
|
my $destinations = $options{custom}->list_objects(
|
||||||
api_type => 'mq',
|
api_type => 'mq',
|
||||||
|
@ -149,7 +149,7 @@ sub manage_selection {
|
||||||
}
|
}
|
||||||
my $points = scalar(@{$self->{raw_results}->{$queue->{queueId}}->{$message_type}});
|
my $points = scalar(@{$self->{raw_results}->{$queue->{queueId}}->{$message_type}});
|
||||||
|
|
||||||
$self->{raw_results}->{$queue->{queueId}}{$message_type} = $total_value / $points;
|
$self->{raw_results}->{$queue->{queueId}}{$message_type} = $total_value / $points;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{queues}->{$queue->{queueId}} = {
|
$self->{queues}->{$queue->{queueId}} = {
|
||||||
|
|
Loading…
Reference in New Issue