Cisco tc 2 (#2184)

* fix cisco tc
This commit is contained in:
qgarnier 2020-09-02 12:06:58 +02:00 committed by GitHub
parent 1489326501
commit 884d876549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 10 deletions

View File

@ -29,6 +29,11 @@ use Digest::MD5 qw(md5_hex);
sub custom_traffic_calc {
my ($self, %options) = @_;
if (!defined($options{delta_time})) {
$self->{error_msg} = 'Buffer creation';
return -1;
}
my $total_bytes = 0;
foreach (keys %{$options{new_datas}}) {
if (/\Q$self->{instance}\E_.*_bytes/) {

View File

@ -157,17 +157,18 @@ sub manage_selection {
$self->{global_video_outgoing} = { loss => 0, pkts => 0, loss_prct => 0, maxjitter => 0, label => 'video outgoing' };
$self->{global_audio_incoming} = { loss => 0, pkts => 0, loss_prct => 0, maxjitter => 0, label => 'audio incoming' };
$self->{global_audio_outgoing} = { loss => 0, pkts => 0, loss_prct => 0, maxjitter => 0, label => 'audio outgoing' };
$self->{global_roomanalytics} = { peoplecount => 0 };
$self->{global_roomanalytics} = {};
return if (!defined($result->{CallHistoryGetResult}->{Entry}));
my $save_last_time = 0;
foreach (@{$result->{CallHistoryGetResult}->{Entry}}) {
my $end_time = Date::Parse::str2time($_->{EndTimeUTC});
my $end_time_utc = ref($_->{EndTimeUTC}) eq 'HASH' ? $_->{EndTimeUTC}->{content} : $_->{EndTimeUTC};
my $end_time = Date::Parse::str2time($end_time_utc);
if (!defined($end_time)) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "can't parse date '" . $_->{EndTimeUTC} . "'"
short_msg => "can't parse date '" . $end_time_utc . "'"
);
next;
}
@ -177,17 +178,21 @@ sub manage_selection {
$self->{global}->{new_calls}++;
foreach my $type (('Video', 'Audio')) {
foreach my $direction (('Incoming', 'Outgoing')) {
$self->{'global_' . lc($type) . '_' . lc($direction)}->{maxjitter} = $_->{$type}->{$direction}->{MaxJitter}
if ($self->{'global_' . lc($type) . '_' . lc($direction)}->{maxjitter} < $_->{$type}->{$direction}->{MaxJitter});
if ($_->{$type}->{$direction}->{PacketLoss} =~ /^(\d+)\/(\d+)/) {
my $max_jitter = ref($_->{$type}->{$direction}->{MaxJitter}) eq 'HASH' ? $_->{$type}->{$direction}->{MaxJitter}->{content} : $_->{$type}->{$direction}->{MaxJitter};
my $packet_loss = ref($_->{$type}->{$direction}->{PacketLoss}) eq 'HASH' ? $_->{$type}->{$direction}->{PacketLoss}->{content} : $_->{$type}->{$direction}->{PacketLoss};
$self->{'global_' . lc($type) . '_' . lc($direction)}->{maxjitter} = $max_jitter
if ($self->{'global_' . lc($type) . '_' . lc($direction)}->{maxjitter} < $max_jitter);
if ($packet_loss =~ /^(\d+)\/(\d+)/) {
$self->{'global_' . lc($type) . '_' . lc($direction)}->{loss} += $1;
$self->{'global_' . lc($type) . '_' . lc($direction)}->{pkts} += $2;
}
}
}
$self->{global_roomanalytics}->{peoplecount} = $_->{RoomAnalytics}->{PeopleCount};
if ($_->{RoomAnalytics}->{PeopleCount} =~ /^N\/A$/) {
$self->{global_roomanalytics}->{peoplecount} = 0;
if (defined($_->{RoomAnalytics}->{PeopleCount})) {
$self->{global_roomanalytics}->{peoplecount} = $_->{RoomAnalytics}->{PeopleCount};
if ($_->{RoomAnalytics}->{PeopleCount} =~ /^N\/A$/) {
$self->{global_roomanalytics}->{peoplecount} = 0;
}
}
}

View File

@ -31,7 +31,7 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
$self->{modes}} = {
$self->{modes} = {
'components' => 'hardware::devices::cisco::ces::restapi::mode::components',
'calls-summary' => 'hardware::devices::cisco::ces::restapi::mode::callssummary',
'calls-rt' => 'hardware::devices::cisco::ces::restapi::mode::callsrt',