diff --git a/apps/lync/2013/mssql/mode/appsharingqoe.pm b/apps/lync/2013/mssql/mode/appsharingqoe.pm deleted file mode 100644 index 2e43d76cf..000000000 --- a/apps/lync/2013/mssql/mode/appsharingqoe.pm +++ /dev/null @@ -1,134 +0,0 @@ -# -# Copyright 2019 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package apps::lync::2013::mssql::mode::appsharingqoe; - -use base qw(centreon::plugins::templates::counter); - -use strict; -use warnings; - -sub set_counters { - my ($self, %options) = @_; - - $self->{maps_counters_type} = [ - { name => 'spoiled_tile_prct_total_avg', type => 0 }, - { name => 'rdp_tile_processing_latency_avg', type => 0 }, - { name => 'relative_one_way_average', type => 0 }, - ]; - - $self->{maps_counters}->{spoiled_tile_prct_total_avg} = [ - { label => 'spoiled-tile-prct-total-avg', set => { - key_values => [ { name => 'value' } ], - output_template => 'SpoiledTilePercentTotal(Avg) : %.2f ms', - perfdatas => [ - { label => 'spoiled_tile_prct_total_avg', value => 'value_absolute', template => '%.2f', - unit => 'ms', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - - $self->{maps_counters}->{rdp_tile_processing_latency_avg} = [ - { label => 'rdp-tile-processing-latency-avg', set => { - key_values => [ { name => 'value' } ], - output_template => 'RDPTileProcessingLatencyAverage : %.2f ms', - perfdatas => [ - { label => 'rdp_tile_processing_latency_avg', value => 'value_absolute', template => '%.2f', - unit => 'ms', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{relative_one_way_average} = [ - { label => 'relative-one-way-average', set => { - key_values => [ { name => 'value' } ], - output_template => 'RelativeOneWayAverage : %.2f ms', - perfdatas => [ - { label => 'relative_one_way_average', value => 'value_absolute', template => '%.2f', - unit => 'ms', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; -} - -sub new { - my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); - bless $self, $class; - - $self->{version} = '1.0'; - $options{options}->add_options(arguments => - { - }); - return $self; -} - -sub manage_selection { - my ($self, %options) = @_; - # $options{sql} = sqlmode object - $self->{sql} = $options{sql}; - $self->{sql}->connect(); - - $self->{sql}->query(query => q{SELECT avg(SpoiledTilePercentTotal) - ,avg(RDPTileProcessingLatencyAverage) - ,avg(RelativeOneWayAverage) - FROM [QoEMetrics].[dbo].AppSharingStream}); - - my ($spoiled_tile_prct_total_avg, $rdp_tile_processing_latency_avg, $relative_one_way_average) = $self->{sql}->fetchrow_array(); - - $self->{spoiled_tile_prct_total_avg} = { value => $spoiled_tile_prct_total_avg }; - $self->{rdp_tile_processing_latency_avg} = { value => $rdp_tile_processing_latency_avg }; - $self->{relative_one_way_average} = { value => $relative_one_way_average }; - -} - -1; - -__END__ - -=head1 MODE - -Check AppSharing Qoe metrics from SQL Server Lync 2013 Database ([QoEMetrics].[dbo].AppSharingStream) - -MS Recommandations : - -SpoiledTilePercentTotal (Total percentage of the content that did not reach the viewer but was instead discarded and overwritten by fresh content) > 36 -RDPTileProcessingLatencyAverage (Average processing time for remote desktop protocol (RDP) tiles. A higher total equates to a longer delay in the viewing experience) > 400 -RelativeOneWayAverage (Average amount of one-way latency. Relative one-way latency measures the delay between the client and the server) > 1.75 - -=over 8 - -=item B<--filter-counters> - -Only display some counters (regexp can be used). - -=item B<--warning-*> - -Set warning threshold for number of user. Can be : 'spoiled-tile-prct-total-avg', 'rdp-tile-processing-latency-avg', 'relative-one-way-average' - -=item B<--critical-*> - -Set critical threshold for number of user. Can be : 'spoiled-tile-prct-total-avg', 'rdp-tile-processing-latency-avg', 'relative-one-way-average' - -=back - -=cut diff --git a/apps/lync/2013/mssql/mode/audioqoe.pm b/apps/lync/2013/mssql/mode/audioqoe.pm deleted file mode 100644 index 02cc06cb9..000000000 --- a/apps/lync/2013/mssql/mode/audioqoe.pm +++ /dev/null @@ -1,172 +0,0 @@ -# -# Copyright 2019 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package apps::lync::2013::mssql::mode::audioqoe; - -use base qw(centreon::plugins::templates::counter); - -use strict; -use warnings; - -sub set_counters { - my ($self, %options) = @_; - - $self->{maps_counters_type} = [ - { name => 'jittermin', type => 0 }, - { name => 'jittermax', type => 0 }, - { name => 'jitteravg', type => 0 }, - { name => 'pcktlossmin', type => 0 }, - { name => 'pcktlossmax', type => 0 }, - { name => 'pcktlossavg', type => 0 }, - ]; - - $self->{maps_counters}->{jittermin} = [ - { label => 'jitter-min', set => { - key_values => [ { name => 'min' } ], - output_template => 'Jitter(Min) : %d ms', - perfdatas => [ - { label => 'jitter_min', value => 'min_absolute', template => '%d', - unit => 'ms', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{jittermax} = [ - { label => 'jitter-max', set => { - key_values => [ { name => 'max' } ], - output_template => 'Jitter(Max) : %d ms', - perfdatas => [ - { label => 'jitter_max', value => 'max_absolute', template => '%d', - unit => 'ms', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{jitteravg} = [ - { label => 'jitter-avg', set => { - key_values => [ { name => 'avg' } ], - output_template => 'Jitter(Avg) : %d ms', - perfdatas => [ - { label => 'jitter_avg', value => 'avg_absolute', template => '%d', - unit => 'ms', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{pcktlossmin} = [ - { label => 'loss-min', set => { - key_values => [ { name => 'min' } ], - output_template => 'Packet-loss(Min) : %.2f%%', - perfdatas => [ - { label => 'pckt_loss_min', value => 'min_absolute', template => '%.2f', - unit => '%', min => 0, max => 100, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{pcktlossmax} = [ - { label => 'loss-max', set => { - key_values => [ { name => 'max' } ], - output_template => 'Packet-loss(Max) : %.2f%%', - perfdatas => [ - { label => 'pckt_loss_max', value => 'max_absolute', template => '%.2f', - unit => '%', min => 0, max => 100 }, - ], - } - }, - ]; - $self->{maps_counters}->{pcktlossavg} = [ - { label => 'loss-avg', set => { - key_values => [ { name => 'avg' } ], - output_template => 'Packet-loss(Avg) : %.2f%%', - perfdatas => [ - { label => 'pckt_loss_avg', value => 'avg_absolute', template => '%.2f', - unit => '%', min => 0, max => 100, label_extra_instance => 0 }, - ], - } - }, - ]; - -} - -sub new { - my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); - bless $self, $class; - - $self->{version} = '1.0'; - $options{options}->add_options(arguments => - { - }); - return $self; -} - -sub manage_selection { - my ($self, %options) = @_; - # $options{sql} = sqlmode object - $self->{sql} = $options{sql}; - $self->{sql}->connect(); - - $self->{sql}->query(query => q{select min(cast(JitterInterArrival as bigint)) as JitterMin, - max(cast(JitterInterArrival as bigint)) as JitterMax, - avg(cast(JitterInterArrival as bigint)) as JitterAvg, - min(PacketLossRate) as PacketLossMin, - max(PacketLossRate) as PacketLossMax, - avg(PacketLossRate) as PacketLossRateAvg - from [QoEMetrics].[dbo].AudioStream - } - ); - - my ($jittermin, $jittermax, $jitteravg, $pcktlossmin, $pcktlossmax, $pcktlossavg) = $self->{sql}->fetchrow_array(); - - $self->{jittermin} = { min => $jittermin }; - $self->{jittermax} = { max => $jittermax }; - $self->{jitteravg} = { avg => $jitteravg }; - $self->{pcktlossmin} = { min => $pcktlossmin }; - $self->{pcktlossmax} = { max => $pcktlossmax }; - $self->{pcktlossavg} = { avg => $pcktlossavg }; - -} - -1; - -__END__ - -=head1 MODE - -Check audio metrics QoE from SQL Server Lync Database [QoEMetrics].[dbo].AudioStream - -=over 8 - -=item B<--filter-counters> - -Only display some counters (regexp can be used). - -=item B<--warning-*> - -Set warning threshold for number of user. Can be : 'jitter-min', 'jitter-max', 'jitter-avg', 'loss-min', 'loss-max', 'loss-avg' - -=item B<--critical-*> - -Set critical threshold for number of user. Can be : 'jitter-min', 'jitter-max', 'jitter-avg', 'loss-min', 'loss-max', 'loss-avg' - -=back - -=cut diff --git a/apps/lync/2013/mssql/mode/sessionstypes.pm b/apps/lync/2013/mssql/mode/sessionstypes.pm deleted file mode 100644 index 4dd5c3951..000000000 --- a/apps/lync/2013/mssql/mode/sessionstypes.pm +++ /dev/null @@ -1,192 +0,0 @@ -# -# Copyright 2019 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package apps::lync::2013::mssql::mode::sessionstypes; - -use base qw(centreon::plugins::templates::counter); - -use strict; -use warnings; - -sub set_counters { - my ($self, %options) = @_; - - $self->{maps_counters_type} = [ - { name => 'instant_messaging', type => 0 }, - { name => 'file_transfer', type => 0 }, - { name => 'remote_assistance', type => 0 }, - { name => 'app_sharing', type => 0 }, - { name => 'audio', type => 0 }, - { name => 'video', type => 0 }, - { name => 'app_invite', type => 0 }, - ]; - - $self->{maps_counters}->{instant_messaging} = [ - { label => 'instant-messaging', set => { - key_values => [ { name => 'value' } ], - output_template => 'Instant Messaging : %d', - perfdatas => [ - { label => 'instant_messaging', value => 'value_absolute', template => '%d', - unit => 'sessions', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{file_transfer} = [ - { label => 'file-transfer', set => { - key_values => [ { name => 'value' } ], - output_template => 'File transfer : %d', - perfdatas => [ - { label => 'file_transfer', value => 'value_absolute', template => '%d', - unit => 'sessions', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{remote_assistance} = [ - { label => 'remote-assistance', set => { - key_values => [ { name => 'value' } ], - output_template => 'Remote assistance : %d', - perfdatas => [ - { label => 'remote_assistance', value => 'value_absolute', template => '%d', - unit => 'sessions', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{app_sharing} = [ - { label => 'app-sharing', set => { - key_values => [ { name => 'value' } ], - output_template => 'App Sharing : %d', - perfdatas => [ - { label => 'app_sharing', value => 'value_absolute', template => '%d', - unit => 'sessions', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{audio} = [ - { label => 'audio', set => { - key_values => [ { name => 'value' } ], - output_template => 'Audio : %d', - perfdatas => [ - { label => 'audio', value => 'value_absolute', template => '%d', - unit => 'sessions', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{video} = [ - { label => 'video', set => { - key_values => [ { name => 'value' } ], - output_template => 'Video : %d', - perfdatas => [ - { label => 'video', value => 'value_absolute', template => '%d', - unit => 'sessions', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{app_invite} = [ - { label => 'app-invite', set => { - key_values => [ { name => 'value' } ], - output_template => 'App Invite : %d', - perfdatas => [ - { label => 'app_invite', value => 'value_absolute', template => '%d', - unit => 'sessions', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - -} - -sub new { - my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); - bless $self, $class; - - $self->{version} = '1.0'; - $options{options}->add_options(arguments => - { - 'lookback:s' => { name => 'lookback', default => '5' }, - }); - return $self; -} - -my %mapping_types = ( - 1 => 'instant_messaging', - 2 => 'file_transfer', - 4 => 'remote_assistance', - 8 => 'app_sharing', - 16 => 'audio', - 32 => 'video', - 64 => 'app_invite', -); - -sub manage_selection { - my ($self, %options) = @_; - # $options{sql} = sqlmode object - $self->{sql} = $options{sql}; - $self->{sql}->connect(); - - foreach my $bit (keys %mapping_types) { - my $query = "SELECT count(*) - FROM [LcsCDR].[dbo].[SessionDetails] s - left outer join [LcsCDR].[dbo].[Users] u1 on s.User1Id = u1.UserId left outer join [LcsCDR].[dbo].[Users] u2 on s.User2Id = u2.UserId - WHERE MediaTypes=".$bit." - AND s.SessionIdTime>=dateadd(minute,-".$self->{option_results}->{lookback}.",getdate())"; - - $self->{sql}->query(query => $query); - my $value = $self->{sql}->fetchrow_array(); - $self->{$mapping_types{$bit}} = { value => $value }; - } - -} - -1; - -__END__ - -=head1 MODE - -Check number of sessions ordered by type during last X minutes - -=over 8 - -=item B<--filter-counters> - -Only display some counters (regexp can be used). - -=item B<--lookback> - -Minutes to lookback (From you to UTC) - -=item B<--warning-*> - -Set warning threshold Can be : 'instant-messaging', 'app-sharing', 'audio', 'video', 'app-invite', 'remote-assistance' - -=item B<--critical-*> - -Set critical threshold for number of user. Can be : 'instant-messaging', 'app-sharing', 'audio', 'video', 'app-invite', 'remote-assistance' - -=back - -=cut diff --git a/apps/lync/2013/mssql/mode/videoqoe.pm b/apps/lync/2013/mssql/mode/videoqoe.pm deleted file mode 100644 index 96cc688ac..000000000 --- a/apps/lync/2013/mssql/mode/videoqoe.pm +++ /dev/null @@ -1,152 +0,0 @@ -package apps::lync::2013::mssql::mode::videoqoe; - -use base qw(centreon::plugins::templates::counter); - -use strict; -use warnings; - -sub set_counters { - my ($self, %options) = @_; - - $self->{maps_counters_type} = [ - { name => 'video_post_fecplr', type => 0 }, - { name => 'video_local_frame_loss_prct_avg', type => 0 }, - { name => 'recv_frame_rate_avg', type => 0 }, - { name => 'video_packet_loss_rate', type => 0 }, - { name => 'inbound_video_frame_rate_avg', type => 0 }, - { name => 'outbound_video_frame_rate_avg', type => 0 }, - ]; - - $self->{maps_counters}->{video_post_fecplr} = [ - { label => 'post-fecplr', set => { - key_values => [ { name => 'value' } ], - output_template => 'VideoPostFECPLR : %d', - perfdatas => [ - { label => 'video_post_fecplr', value => 'value_absolute', template => '%d', - unit => '', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{video_local_frame_loss_prct_avg} = [ - { label => 'local-frame-loss', set => { - key_values => [ { name => 'value' } ], - output_template => 'VideoLocalFrameLossPercentageAvg : %d', - perfdatas => [ - { label => 'video_frame_loss_prct_avg', value => 'value_absolute', template => '%d', - unit => '', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{recv_frame_rate_avg} = [ - { label => 'recv-frame', set => { - key_values => [ { name => 'value' } ], - output_template => 'RecvFrameRateAverage : %d', - perfdatas => [ - { label => 'rcv_frame_rate_avg', value => 'value_absolute', template => '%d', - unit => '', min => 0, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{video_packet_loss_rate} = [ - { label => 'packet-loss', set => { - key_values => [ { name => 'value' } ], - output_template => 'video_packet_loss_rate : %.2f%%', - perfdatas => [ - { label => 'video_pckt_loss_rate', value => 'value_absolute', template => '%.2f', - unit => '%', min => 0, max => 100, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{inbound_video_frame_rate_avg} = [ - { label => 'inbound-frame', set => { - key_values => [ { name => 'value' } ], - output_template => 'inbound_video_frame_rate_avg : %.2f%%', - perfdatas => [ - { label => 'inbound_video_frame_rate_avg', value => 'value_absolute', template => '%.2f', - unit => '%', min => 0, max => 100, label_extra_instance => 0 }, - ], - } - }, - ]; - $self->{maps_counters}->{outbound_video_frame_rate_avg} = [ - { label => 'outbound-frame', set => { - key_values => [ { name => 'value' } ], - output_template => 'outbound_video_frame_rate_avg : %.2f%%', - perfdatas => [ - { label => 'outbound_video_frame_rate_avg', value => 'value_absolute', template => '%.2f', - unit => '%', min => 0, max => 100, label_extra_instance => 0 }, - ], - } - }, - ]; -} - -sub new { - my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); - bless $self, $class; - - $self->{version} = '1.0'; - $options{options}->add_options(arguments => - { - }); - return $self; -} - -sub manage_selection { - my ($self, %options) = @_; - # $options{sql} = sqlmode object - $self->{sql} = $options{sql}; - $self->{sql}->connect(); - - $self->{sql}->query(query => q{select avg(VideoPostFECPLR) - ,avg(VideoLocalFrameLossPercentageAvg) - ,avg(RecvFrameRateAverage) - ,avg(VideoPacketLossRate) - ,avg(InboundVideoFrameRateAvg) - ,avg(OutboundVideoFrameRateAvg) - from [QoEMetrics].[dbo].VideoStream - } - ); - - my ($video_post_fecplr, $video_local_frame_loss_prct_avg, $recv_frame_rate_avg, - $video_packet_loss_rate, $inbound_video_frame_rate_avg, $outbound_video_frame_rate_avg) = $self->{sql}->fetchrow_array(); - - $self->{video_post_fecplr} = { value => $video_post_fecplr }; - $self->{video_local_frame_loss_prct_avg} = { value => $video_local_frame_loss_prct_avg }; - $self->{recv_frame_rate_avg} = { value => $recv_frame_rate_avg }; - $self->{video_packet_loss_rate} = { value => $video_packet_loss_rate }; - $self->{inbound_video_frame_rate_avg} = { value => $inbound_video_frame_rate_avg }; - $self->{outbound_video_frame_rate_avg} = { value => $outbound_video_frame_rate_avg }; - -} - -1; - -__END__ - -=head1 MODE - -Check video metrics QoE from SQL Server Lync Database [QoEMetrics].[dbo].VideoStream - -=over 8 - -=item B<--filter-counters> - -Only display some counters (regexp can be used). - -=item B<--warning-*> - -Set warning threshold for QoE metrics. Can be : 'recv-frame', 'local-frame-loss', 'post-fecplr', ''packet-loss', 'inboud-frame', 'outbound-frame' - -=item B<--critical-*> - -Set critical threshold for QoE. Can be : 'recv-frame', 'local-frame-loss', 'post-fecplr', ''packet-loss', 'inboud-frame', 'outbound-frame' - -=back - -=cut diff --git a/centreon/common/microsoft/skype/mssql/appsharingqoe.pm b/centreon/common/microsoft/skype/mssql/appsharingqoe.pm new file mode 100644 index 000000000..e77b97b68 --- /dev/null +++ b/centreon/common/microsoft/skype/mssql/appsharingqoe.pm @@ -0,0 +1,156 @@ +# +# Copyright 2019 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package centreon::common::microsoft::skype::mssql::mode::appsharingqoe; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, skipped_code => { -10 => 1 } }, + { name => 'count', type => 0 }, + ]; + + $self->{maps_counters}->{global} = [ + { label => 'spoiled-tile-prct-total-avg', set => { + key_values => [ { name => 'SpoiledTilePercentTotal' } ], + output_template => 'Average Spoiled Tiles: %.2f%%', + perfdatas => [ + { label => 'spoiled_tile_prct_total_avg', value => 'SpoiledTilePercentTotal_absolute', + template => '%.2f', unit => '%', min => 0, max => 100 }, + ], + } + }, + { label => 'rdp-tile-processing-latency-avg', set => { + key_values => [ { name => 'RDPTileProcessingLatencyAverage' } ], + output_template => 'Average RDP Tiles Processing Latency: %.2f ms', + perfdatas => [ + { label => 'rdp_tile_processing_latency_avg', value => 'RDPTileProcessingLatencyAverage_absolute', + template => '%.2f', unit => 'ms', min => 0 }, + ], + } + }, + { label => 'relative-one-way-average', set => { + key_values => [ { name => 'RelativeOneWayAverage' } ], + output_template => 'Average Amount of One-way Latency: %.2f ms', + perfdatas => [ + { label => 'relative_one_way_average', value => 'RelativeOneWayAverage_absolute', + template => '%.2f', unit => 'ms', min => 0 }, + ], + } + }, + ]; + $self->{maps_counters}->{count} = [ + { label => 'stream-count', set => { + key_values => [ { name => 'TotalStreams' } ], + output_template => 'Streams Count: %.2f/s', + perfdatas => [ + { label => 'stream_count', value => 'TotalStreams_absolute', template => '%.2f', + unit => 'streams/s', min => 0 }, + ], + } + }, + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "timeframe:s" => { name => 'timeframe', default => '900' }, + "filter-counters:s" => { name => 'filter_counters', default => '' }, + }); + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + $self->{sql} = $options{sql}; + $self->{sql}->connect(); + + my $query = "SELECT AVG(SpoiledTilePercentTotal) AS SpoiledTilePercentTotal, + AVG(RDPTileProcessingLatencyAverage) AS RDPTileProcessingLatencyAverage, + AVG(RelativeOneWayAverage) AS RelativeOneWayAverage, + COUNT(*) AS TotalStreams + FROM [QoEMetrics].[dbo].AppSharingStream + WHERE ConferenceDateTime > (DATEADD(SECOND,-" . $self->{option_results}->{timeframe} . ",SYSUTCDATETIME())) + AND ConferenceDateTime < SYSUTCDATETIME()"; + + $self->{sql}->query(query => $query); + + my $results = $self->{sql}->fetchrow_hashref; + + $self->{global} = { + SpoiledTilePercentTotal => (defined($results->{SpoiledTilePercentTotal})) ? $results->{SpoiledTilePercentTotal} : 0, + RDPTileProcessingLatencyAverage => (defined($results->{RDPTileProcessingLatencyAverage})) ? $results->{RDPTileProcessingLatencyAverage} : 0, + RelativeOneWayAverage => (defined($results->{RelativeOneWayAverage})) ? $results->{RelativeOneWayAverage} : 0, + }; + $self->{count}->{TotalStreams} = $results->{TotalStreams} / $self->{option_results}->{timeframe}; +} + +1; + +__END__ + +=head1 MODE + +Check app sharing QoE metrics from SQL Server (Lync 2013, Skype 2015). + +MS Recommandations : + +SpoiledTilePercentTotal (Total percentage of the content that did not reach the viewer but was instead discarded and overwritten by fresh content) > 36 +RDPTileProcessingLatencyAverage (Average processing time for remote desktop protocol (RDP) tiles. A higher total equates to a longer delay in the viewing experience) > 400 +RelativeOneWayAverage (Average amount of one-way latency. Relative one-way latency measures the delay between the client and the server) > 1.75 + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). + +=item B<--timeframe> + +Set the timeframe to query in seconds (Default: 900) + +=item B<--warning-*> + +Set warning thresholds. +Can be : 'spoiled-tile-prct-total-avg', 'rdp-tile-processing-latency-avg', +'relative-one-way-average' + +=item B<--critical-*> + +Set critical thresholds. +Can be : 'spoiled-tile-prct-total-avg', 'rdp-tile-processing-latency-avg', +'relative-one-way-average' + +=back + +=cut diff --git a/centreon/common/microsoft/skype/mssql/audioqoe.pm b/centreon/common/microsoft/skype/mssql/audioqoe.pm new file mode 100644 index 000000000..2ad8ddbb5 --- /dev/null +++ b/centreon/common/microsoft/skype/mssql/audioqoe.pm @@ -0,0 +1,205 @@ +# +# Copyright 2019 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package centreon::common::microsoft::skype::mssql::mode::audioqoe; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'jitter', type => 0, cb_prefix_output => 'prefix_jitter_output', skipped_code => { -10 => 1 } }, + { name => 'packet', type => 0, cb_prefix_output => 'prefix_packet_output', skipped_code => { -10 => 1 } }, + { name => 'count', type => 0 }, + ]; + + $self->{maps_counters}->{jitter} = [ + { label => 'jitter-avg', set => { + key_values => [ { name => 'JitterAvg' } ], + output_template => 'Average: %d ms', + perfdatas => [ + { label => 'jitter_avg', value => 'JitterAvg_absolute', template => '%d', + unit => 'ms', min => 0 }, + ], + } + }, + { label => 'jitter-min', set => { + key_values => [ { name => 'JitterMin' } ], + output_template => 'Min: %d ms', + perfdatas => [ + { label => 'jitter_min', value => 'JitterMin_absolute', template => '%d', + unit => 'ms', min => 0 }, + ], + } + }, + { label => 'jitter-max', set => { + key_values => [ { name => 'JitterMax' } ], + output_template => 'Max: %d ms', + perfdatas => [ + { label => 'jitter_max', value => 'JitterMax_absolute', template => '%d', + unit => 'ms', min => 0 }, + ], + } + }, + ]; + $self->{maps_counters}->{packet} = [ + { label => 'loss-avg', set => { + key_values => [ { name => 'PacketLossAvg' } ], + output_template => 'Average: %.2f%%', + perfdatas => [ + { label => 'pckt_loss_avg', value => 'PacketLossAvg_absolute', template => '%.2f', + unit => '%', min => 0, max => 100 }, + ], + } + }, + { label => 'loss-min', set => { + key_values => [ { name => 'PacketLossMin' } ], + output_template => 'Min: %.2f%%', + perfdatas => [ + { label => 'pckt_loss_min', value => 'PacketLossMin_absolute', template => '%.2f', + unit => '%', min => 0, max => 100 }, + ], + } + }, + { label => 'loss-max', set => { + key_values => [ { name => 'PacketLossMax' } ], + output_template => 'Max: %.2f%%', + perfdatas => [ + { label => 'pckt_loss_max', value => 'PacketLossMax_absolute', template => '%.2f', + unit => '%', min => 0, max => 100 }, + ], + } + }, + ]; + $self->{maps_counters}->{count} = [ + { label => 'stream-count', set => { + key_values => [ { name => 'TotalStreams' } ], + output_template => 'Streams Count: %.2f/s', + perfdatas => [ + { label => 'stream_count', value => 'TotalStreams_absolute', template => '%.2f', + unit => 'streams/s', min => 0 }, + ], + } + }, + ]; +} + +sub prefix_jitter_output { + my ($self, %options) = @_; + + return "Jitter "; +} + +sub prefix_packet_output { + my ($self, %options) = @_; + + return "Packets Loss "; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "timeframe:s" => { name => 'timeframe', default => '900' }, + "filter-counters:s" => { name => 'filter_counters', default => '' }, + }); + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + $self->{sql} = $options{sql}; + $self->{sql}->connect(); + + my $query = "SELECT MIN(CAST(JitterInterArrival AS BIGINT)) AS JitterMin, + MAX(CAST(JitterInterArrival AS BIGINT)) AS JitterMax, + AVG(CAST(JitterInterArrival AS BIGINT)) AS JitterAvg, + MIN(PacketLossRate) AS PacketLossMin, + MAX(PacketLossRate) AS PacketLossMax, + AVG(PacketLossRate) AS PacketLossAvg, + COUNT(*) AS TotalStreams + FROM [QoEMetrics].[dbo].AudioStream + WHERE ConferenceDateTime > (DATEADD(SECOND,-" . $self->{option_results}->{timeframe} . ",SYSUTCDATETIME())) + AND ConferenceDateTime < SYSUTCDATETIME()"; + + $self->{sql}->query(query => $query); + + my $results = $self->{sql}->fetchrow_hashref; + + $self->{jitter} = { + JitterMin => (defined($results->{JitterMin})) ? $results->{JitterMin} : 0, + JitterMax => (defined($results->{JitterMax})) ? $results->{JitterMax} : 0, + JitterAvg => (defined($results->{JitterAvg})) ? $results->{JitterAvg} : 0, + }; + $self->{packet} = { + PacketLossMin => (defined($results->{PacketLossMin})) ? $results->{PacketLossMin} : 0, + PacketLossMax => (defined($results->{PacketLossMax})) ? $results->{PacketLossMax} : 0, + PacketLossAvg => (defined($results->{PacketLossAvg})) ? $results->{PacketLossAvg} : 0, + }; + $self->{count}->{TotalStreams} = $results->{TotalStreams} / $self->{option_results}->{timeframe}; +} + +1; + +__END__ + +=head1 MODE + +Check audio stream QoE metrics from SQL Server (Lync 2013, Skype 2015). + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). + +=item B<--timeframe> + +Set the timeframe to query in seconds (Default: 900) + +=item B<--warning-*> + +Set warning thresholds. +Can be : 'jitter-min', 'jitter-max', 'jitter-avg', +'loss-min', 'loss-max', 'loss-avg' + +=item B<--critical-*> + +Set critical thresholds. +Can be : 'jitter-min', 'jitter-max', 'jitter-avg', +'loss-min', 'loss-max', 'loss-avg' + +=back + +=cut diff --git a/apps/lync/2013/mssql/mode/poorcalls.pm b/centreon/common/microsoft/skype/mssql/poorcalls.pm similarity index 65% rename from apps/lync/2013/mssql/mode/poorcalls.pm rename to centreon/common/microsoft/skype/mssql/poorcalls.pm index 7e39420d6..0bba2a080 100644 --- a/apps/lync/2013/mssql/mode/poorcalls.pm +++ b/centreon/common/microsoft/skype/mssql/poorcalls.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package apps::lync::2013::mssql::mode::poorcalls; +package centreon::common::microsoft::skype::mssql::mode::poorcalls; use base qw(centreon::plugins::templates::counter); @@ -37,10 +37,10 @@ sub set_counters { $self->{maps_counters}->{global} = [ { label => 'global', set => { key_values => [ { name => 'count' } ], - output_template => '%d Poor calls', + output_template => 'Poor Calls: %d', perfdatas => [ { label => 'poor_calls', value => 'count_absolute', template => '%d', - unit => 'calls', min => 0, label_extra_instance => 0 }, + unit => 'calls', min => 0 }, ], } }, @@ -48,11 +48,7 @@ sub set_counters { $self->{maps_counters}->{uri} = [ { label => 'user', set => { key_values => [ { name => 'count' }, { name => 'display' } ], - output_template => 'count : %d', - perfdatas => [ - { label => 'poor_calls', value => 'count_absolute', template => '%d', - unit => 'calls', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' }, - ], + output_template => 'poor calls count: %d', } }, ]; @@ -66,8 +62,10 @@ sub new { $self->{version} = '1.0'; $options{options}->add_options(arguments => { - 'lookback:s' => { name => 'lookback', default => '65' }, - 'filter-user:s' => { name => 'filter_user' }, + "lookback:s" => { name => 'lookback', default => '65' }, # not used + "timeframe:s" => { name => 'timeframe', default => '900' }, + "filter-user:s" => { name => 'filter_user' }, + "filter-counters:s" => { name => 'filter_counters', default => '' }, }); return $self; } @@ -75,19 +73,24 @@ sub new { sub prefix_uri_output { my ($self, %options) = @_; - return "'" . $options{instance_value}->{display} . "' "; + return "User '" . $options{instance_value}->{display} . "' "; } sub manage_selection { my ($self, %options) = @_; - # $options{sql} = sqlmode object + $self->{sql} = $options{sql}; $self->{sql}->connect(); - $self->{sql}->query(query => "SELECT URI, LastPoorCallTime - FROM [QoEMetrics].[dbo].[User] - WHERE LastPoorCallTime>=dateadd(minute,-".$self->{option_results}->{lookback}.",getdate())"); - my $total; + my $query = "SELECT URI, LastPoorCallTime + FROM [QoEMetrics].[dbo].[User] + WHERE LastPoorCallTime > (DATEADD(SECOND,-" . $self->{option_results}->{timeframe} . ",SYSUTCDATETIME())) + AND LastPoorCallTime < SYSUTCDATETIME()"; + + $self->{sql}->query(query => $query); + + $self->{global}->{count} = 0; + while (my $row = $self->{sql}->fetchrow_hashref()) { if (defined($self->{option_results}->{filter_user}) && $self->{option_results}->{filter_user} ne '' && $row->{URI} !~ /$self->{option_results}->{filter_user}/) { @@ -95,10 +98,9 @@ sub manage_selection { next; } $self->{global}->{count}++; - $self->{uri}->{$row->{URI}} = {count => 0, display => $row->{URI}} if (!defined($self->{uri}->{$row->{URI}})); + $self->{uri}->{$row->{URI}} = { count => 0, display => $row->{URI} } if (!defined($self->{uri}->{$row->{URI}})); $self->{uri}->{$row->{URI}}->{count}++; } - } 1; @@ -107,7 +109,7 @@ __END__ =head1 MODE -Check Lync Poor Calls during last X minutes (Total and per users) +Check poor calls from SQL Server (Lync 2013, Skype 2015). =over 8 @@ -119,17 +121,17 @@ Filter user name (can be a regexp) Only display some counters (regexp can be used). -=item B<--lookback> +=item B<--timeframe> -Minutes to lookback (From you to UTC) default: 65 +Set the timeframe to query in seconds (Default: 900) -=item B<--warning-*> +=item B<--warning-global> -Set warning threshold for number of poor calls. Can be : 'global', 'user' +Set warning threshold for number of poor calls. -=item B<--critical-*> +=item B<--critical-global> -Set critical threshold for number of poor calls. Can be : 'global', 'user' +Set critical threshold for number of poor calls. =back diff --git a/centreon/common/microsoft/skype/mssql/sessionstypes.pm b/centreon/common/microsoft/skype/mssql/sessionstypes.pm new file mode 100644 index 000000000..e730777c4 --- /dev/null +++ b/centreon/common/microsoft/skype/mssql/sessionstypes.pm @@ -0,0 +1,183 @@ +# +# Copyright 2019 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package centreon::common::microsoft::skype::mssql::mode::sessionstypes; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0 }, + ]; + + $self->{maps_counters}->{global} = [ + { label => 'instant-messaging', set => { + key_values => [ { name => 'instant_messaging' } ], + output_template => 'Instant Messaging: %d', + perfdatas => [ + { label => 'instant_messaging', value => 'instant_messaging_absolute', template => '%d', + unit => 'sessions', min => 0 }, + ], + } + }, + { label => 'audio', set => { + key_values => [ { name => 'audio' } ], + output_template => 'Audio: %d', + perfdatas => [ + { label => 'audio', value => 'audio_absolute', template => '%d', + unit => 'sessions', min => 0 }, + ], + } + }, + { label => 'video', set => { + key_values => [ { name => 'video' } ], + output_template => 'Video: %d', + perfdatas => [ + { label => 'video', value => 'video_absolute', template => '%d', + unit => 'sessions', min => 0 }, + ], + } + }, + { label => 'file-transfer', set => { + key_values => [ { name => 'file_transfer' } ], + output_template => 'File Transfer: %d', + perfdatas => [ + { label => 'file_transfer', value => 'file_transfer_absolute', template => '%d', + unit => 'sessions', min => 0 }, + ], + } + }, + { label => 'remote-assistance', set => { + key_values => [ { name => 'remote_assistance' } ], + output_template => 'Remote Assistance: %d', + perfdatas => [ + { label => 'remote_assistance', value => 'remote_assistance_absolute', template => '%d', + unit => 'sessions', min => 0 }, + ], + } + }, + { label => 'app-sharing', set => { + key_values => [ { name => 'app_sharing' } ], + output_template => 'App Sharing: %d', + perfdatas => [ + { label => 'app_sharing', value => 'app_sharing_absolute', template => '%d', + unit => 'sessions', min => 0 }, + ], + } + }, + { label => 'app-invite', set => { + key_values => [ { name => 'app_invite' } ], + output_template => 'App Invite: %d', + perfdatas => [ + { label => 'app_invite', value => 'app_invite_absolute', template => '%d', + unit => 'sessions', min => 0 }, + ], + } + }, + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "lookback:s" => { name => 'lookback', default => '5' }, # not used + "timeframe:s" => { name => 'timeframe', default => '900' }, + "filter-counters:s" => { name => 'filter_counters', default => '' }, + }); + return $self; +} + +my %mapping_types = ( + 1 => 'instant_messaging', + 2 => 'file_transfer', + 4 => 'remote_assistance', + 8 => 'app_sharing', + 16 => 'audio', + 32 => 'video', + 64 => 'app_invite', +); + +sub manage_selection { + my ($self, %options) = @_; + + $self->{sql} = $options{sql}; + $self->{sql}->connect(); + + $self->{global} = { instant_messaging => 0, file_transfer => 0, remote_assistance => 0, + app_sharing => 0, app_sharing => 0, video => 0, app_invite => 0 }; + + my $query = "SELECT * + FROM [LcsCDR].[dbo].[SessionDetails] s + LEFT OUTER JOIN [LcsCDR].[dbo].[Users] u1 ON s.User1Id = u1.UserId + LEFT OUTER JOIN [LcsCDR].[dbo].[Users] u2 ON s.User2Id = u2.UserId + WHERE s.SessionIdTime > (DATEADD(SECOND,-" . $self->{option_results}->{timeframe} . ",SYSUTCDATETIME())) + AND s.SessionIdTime < SYSUTCDATETIME()"; + + $self->{sql}->query(query => $query); + + while (my $row = $self->{sql}->fetchrow_hashref()) { + next if (!defined($mapping_types{$row->{MediaTypes}})); + $self->{global}->{$mapping_types{$row->{MediaTypes}}}++; + } +} + +1; + +__END__ + +=head1 MODE + +Check number of sessions ordered by type. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). + +=item B<--timeframe> + +Set the timeframe to query in seconds (Default: 900) + +=item B<--warning-*> + +Set warning threshold. +Can be : 'instant-messaging', 'app-sharing', 'audio', +'video', 'app-invite', 'remote-assistance' + +=item B<--critical-*> + +Set critical threshold. +Can be : 'instant-messaging', 'app-sharing', 'audio', +'video', 'app-invite', 'remote-assistance' + +=back + +=cut diff --git a/centreon/common/microsoft/skype/mssql/videoqoe.pm b/centreon/common/microsoft/skype/mssql/videoqoe.pm new file mode 100644 index 000000000..341f9c72a --- /dev/null +++ b/centreon/common/microsoft/skype/mssql/videoqoe.pm @@ -0,0 +1,168 @@ +package centreon::common::microsoft::skype::mssql::mode::videoqoe; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, skipped_code => { -10 => 1 } }, + { name => 'count', type => 0 }, + ]; + + $self->{maps_counters}->{global} = [ + { label => 'packet-loss', set => { + key_values => [ { name => 'VideoPacketLossRate' } ], + output_template => 'Packet Loss Rate: %.2f%%', + perfdatas => [ + { label => 'video_pckt_loss_rate', value => 'VideoPacketLossRate_absolute', + template => '%.2f', unit => '%', min => 0, max => 100 }, + ], + } + }, + { label => 'post-fecplr', set => { + key_values => [ { name => 'VideoPostFECPLR' } ], + output_template => 'Packet Loss Rate After Correction: %.2f%%', + perfdatas => [ + { label => 'video_post_fecplr', value => 'VideoPostFECPLR_absolute', + template => '%.2f', unit => '%', min => 0, max => 100 }, + ], + } + }, + { label => 'local-frame-loss', set => { + key_values => [ { name => 'VideoLocalFrameLossPercentageAvg' } ], + output_template => 'Video Frame Loss: %.2f%%', + perfdatas => [ + { label => 'video_frame_loss_prct_avg', value => 'VideoLocalFrameLossPercentageAvg_absolute', + template => '%.2f', unit => '%', min => 0, max => 100 }, + ], + } + }, + { label => 'recv-frame', set => { + key_values => [ { name => 'RecvFrameRateAverage' } ], + output_template => 'Receiver Frame Rate: %.2f%%', + perfdatas => [ + { label => 'rcv_frame_rate_avg', value => 'RecvFrameRateAverage_absolute', + template => '%.2f', unit => '%', min => 0, max => 100 }, + ], + } + }, + { label => 'inbound-frame', set => { + key_values => [ { name => 'InboundVideoFrameRateAvg' } ], + output_template => 'Inbound Video Frame Rate: %.2f%%', + perfdatas => [ + { label => 'inbound_video_frame_rate_avg', value => 'InboundVideoFrameRateAvg_absolute', + template => '%.2f', unit => '%', min => 0, max => 100 }, + ], + } + }, + { label => 'outbound-frame', set => { + key_values => [ { name => 'OutboundVideoFrameRateAvg' } ], + output_template => 'Outbound Video Frame Rate: %.2f%%', + perfdatas => [ + { label => 'outbound_video_frame_rate_avg', value => 'OutboundVideoFrameRateAvg_absolute', + template => '%.2f', unit => '%', min => 0, max => 100 }, + ], + } + }, + ]; + $self->{maps_counters}->{count} = [ + { label => 'stream-count', set => { + key_values => [ { name => 'TotalStreams' } ], + output_template => 'Streams Count: %.2f/s', + perfdatas => [ + { label => 'stream_count', value => 'TotalStreams_absolute', template => '%.2f', + unit => 'streams/s', min => 0 }, + ], + } + }, + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "timeframe:s" => { name => 'timeframe', default => '900' }, + "filter-counters:s" => { name => 'filter_counters', default => '' }, + }); + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + $self->{sql} = $options{sql}; + $self->{sql}->connect(); + + my $query = "SELECT AVG(VideoPostFECPLR) AS VideoPostFECPLR, + AVG(VideoLocalFrameLossPercentageAvg) AS VideoLocalFrameLossPercentageAvg, + AVG(RecvFrameRateAverage) AS RecvFrameRateAverage, + AVG(VideoPacketLossRate) AS VideoPacketLossRate, + AVG(InboundVideoFrameRateAvg) AS InboundVideoFrameRateAvg, + AVG(OutboundVideoFrameRateAvg) AS OutboundVideoFrameRateAvg, + COUNT(*) AS TotalStreams + FROM [QoEMetrics].[dbo].VideoStream + WHERE ConferenceDateTime > (DATEADD(SECOND,-" . $self->{option_results}->{timeframe} . ",SYSUTCDATETIME())) + AND ConferenceDateTime < SYSUTCDATETIME()"; + + $self->{sql}->query(query => $query); + + my $results = $self->{sql}->fetchrow_hashref; + + $self->{global} = { + VideoPostFECPLR => (defined($results->{VideoPostFECPLR})) ? $results->{VideoPostFECPLR} : 0, + VideoLocalFrameLossPercentageAvg => (defined($results->{VideoLocalFrameLossPercentageAvg})) ? $results->{VideoLocalFrameLossPercentageAvg} : 0, + RecvFrameRateAverage => (defined($results->{RecvFrameRateAverage})) ? $results->{RecvFrameRateAverage} : 0, + VideoPacketLossRate => (defined($results->{VideoPacketLossRate})) ? $results->{VideoPacketLossRate} : 0, + InboundVideoFrameRateAvg => (defined($results->{InboundVideoFrameRateAvg})) ? $results->{InboundVideoFrameRateAvg} : 0, + OutboundVideoFrameRateAvg => (defined($results->{OutboundVideoFrameRateAvg})) ? $results->{OutboundVideoFrameRateAvg} : 0, + }; + $self->{count}->{TotalStreams} = $results->{TotalStreams} / $self->{option_results}->{timeframe}; +} + +1; + +__END__ + +=head1 MODE + +Check video stream QoE from SQL Server (Lync 2013, Skype 2015). + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). + +=item B<--timeframe> + +Set the timeframe to query in seconds (Default: 900) + +=item B<--warning-*> + +Set warning thresholds. +Can be : 'recv-frame', 'local-frame-loss', 'post-fecplr', +'packet-loss', 'inboud-frame', 'outbound-frame' + +=item B<--critical-*> + +Set critical thresholds. +Can be : 'recv-frame', 'local-frame-loss', 'post-fecplr', +packet-loss', 'inboud-frame', 'outbound-frame' + +=back + +=cut