| 1 |
# |
| 2 |
# Copyright 2024 Centreon (http://www.centreon.com/) |
| 3 |
# |
| 4 |
# Centreon is a full-fledged industry-strength solution that meets |
| 5 |
# the needs in IT infrastructure and application monitoring for |
| 6 |
# service performance. |
| 7 |
# |
| 8 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 |
# you may not use this file except in compliance with the License. |
| 10 |
# You may obtain a copy of the License at |
| 11 |
# |
| 12 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 13 |
# |
| 14 |
# Unless required by applicable law or agreed to in writing, software |
| 15 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 16 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 |
# See the License for the specific language governing permissions and |
| 18 |
# limitations under the License. |
| 19 |
# |
| 20 |
|
| 21 |
package centreon::common::microsoft::skype::mssql::mode::appsharingqoe; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::counter); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
|
| 28 |
sub set_counters { |
| 29 |
my ($self, %options) = @_; |
| 30 |
|
| 31 |
$self->{maps_counters_type} = [ |
| 32 |
{ name => 'global', type => 0, skipped_code => { -10 => 1 } }, |
| 33 |
{ name => 'count', type => 0 }, |
| 34 |
]; |
| 35 |
|
| 36 |
$self->{maps_counters}->{global} = [ |
| 37 |
{ label => 'spoiled-tile-prct-total-avg', set => { |
| 38 |
key_values => [ { name => 'SpoiledTilePercentTotal' } ], |
| 39 |
output_template => 'Average Spoiled Tiles: %.2f%%', |
| 40 |
perfdatas => [ |
| 41 |
{ label => 'spoiled_tile_prct_total_avg', value => 'SpoiledTilePercentTotal', |
| 42 |
template => '%.2f', unit => '%', min => 0, max => 100 }, |
| 43 |
], |
| 44 |
} |
| 45 |
}, |
| 46 |
{ label => 'rdp-tile-processing-latency-avg', set => { |
| 47 |
key_values => [ { name => 'RDPTileProcessingLatencyAverage' } ], |
| 48 |
output_template => 'Average RDP Tiles Processing Latency: %.2f ms', |
| 49 |
perfdatas => [ |
| 50 |
{ label => 'rdp_tile_processing_latency_avg', value => 'RDPTileProcessingLatencyAverage', |
| 51 |
template => '%.2f', unit => 'ms', min => 0 }, |
| 52 |
], |
| 53 |
} |
| 54 |
}, |
| 55 |
{ label => 'relative-one-way-average', set => { |
| 56 |
key_values => [ { name => 'RelativeOneWayAverage' } ], |
| 57 |
output_template => 'Average Amount of One-way Latency: %.2f ms', |
| 58 |
perfdatas => [ |
| 59 |
{ label => 'relative_one_way_average', value => 'RelativeOneWayAverage', |
| 60 |
template => '%.2f', unit => 'ms', min => 0 }, |
| 61 |
], |
| 62 |
} |
| 63 |
}, |
| 64 |
]; |
| 65 |
$self->{maps_counters}->{count} = [ |
| 66 |
{ label => 'stream-count', set => { |
| 67 |
key_values => [ { name => 'TotalStreams' } ], |
| 68 |
output_template => 'Streams Count: %.2f/s', |
| 69 |
perfdatas => [ |
| 70 |
{ label => 'stream_count', value => 'TotalStreams', template => '%.2f', |
| 71 |
unit => 'streams/s', min => 0 }, |
| 72 |
], |
| 73 |
} |
| 74 |
}, |
| 75 |
]; |
| 76 |
} |
| 77 |
|
| 78 |
sub new { |
| 79 |
my ($class, %options) = @_; |
| 80 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options); |
| 81 |
bless $self, $class; |
| 82 |
|
| 83 |
$options{options}->add_options(arguments => |
| 84 |
{ |
| 85 |
"timeframe:s" => { name => 'timeframe', default => '900' }, |
| 86 |
"filter-counters:s" => { name => 'filter_counters', default => '' }, |
| 87 |
}); |
| 88 |
return $self; |
| 89 |
} |
| 90 |
|
| 91 |
sub manage_selection { |
| 92 |
my ($self, %options) = @_; |
| 93 |
|
| 94 |
$self->{sql} = $options{sql}; |
| 95 |
$self->{sql}->connect(); |
| 96 |
|
| 97 |
my $query = "SELECT AVG(SpoiledTilePercentTotal) AS SpoiledTilePercentTotal, |
| 98 |
AVG(RDPTileProcessingLatencyAverage) AS RDPTileProcessingLatencyAverage, |
| 99 |
AVG(RelativeOneWayAverage) AS RelativeOneWayAverage, |
| 100 |
COUNT(*) AS TotalStreams |
| 101 |
FROM [QoEMetrics].[dbo].AppSharingStream |
| 102 |
WHERE ConferenceDateTime > (DATEADD(SECOND,-" . $self->{option_results}->{timeframe} . ",SYSUTCDATETIME())) |
| 103 |
AND ConferenceDateTime < SYSUTCDATETIME()"; |
| 104 |
|
| 105 |
$self->{sql}->query(query => $query); |
| 106 |
|
| 107 |
my $results = $self->{sql}->fetchrow_hashref; |
| 108 |
|
| 109 |
$self->{global} = { |
| 110 |
SpoiledTilePercentTotal => (defined($results->{SpoiledTilePercentTotal})) ? $results->{SpoiledTilePercentTotal} : 0, |
| 111 |
RDPTileProcessingLatencyAverage => (defined($results->{RDPTileProcessingLatencyAverage})) ? $results->{RDPTileProcessingLatencyAverage} : 0, |
| 112 |
RelativeOneWayAverage => (defined($results->{RelativeOneWayAverage})) ? $results->{RelativeOneWayAverage} : 0, |
| 113 |
}; |
| 114 |
$self->{count}->{TotalStreams} = $results->{TotalStreams} / $self->{option_results}->{timeframe}; |
| 115 |
} |
| 116 |
|
| 117 |
1; |
| 118 |
|
| 119 |
__END__ |
| 120 |
|
| 121 |
=head1 MODE |
| 122 |
|
| 123 |
Check app sharing QoE metrics from SQL Server (Lync 2013, Skype 2015). |
| 124 |
|
| 125 |
MS Recommandations : |
| 126 |
|
| 127 |
SpoiledTilePercentTotal (Total percentage of the content that did not reach the viewer but was instead discarded and overwritten by fresh content) > 36 |
| 128 |
RDPTileProcessingLatencyAverage (Average processing time for remote desktop protocol (RDP) tiles. A higher total equates to a longer delay in the viewing experience) > 400 |
| 129 |
RelativeOneWayAverage (Average amount of one-way latency. Relative one-way latency measures the delay between the client and the server) > 1.75 |
| 130 |
|
| 131 |
=over 8 |
| 132 |
|
| 133 |
=item B<--filter-counters> |
| 134 |
|
| 135 |
Only display some counters (regexp can be used). |
| 136 |
|
| 137 |
=item B<--timeframe> |
| 138 |
|
| 139 |
Set the timeframe to query in seconds (default: 900) |
| 140 |
|
| 141 |
=item B<--warning-*> |
| 142 |
|
| 143 |
Set warning thresholds. |
| 144 |
Can be : 'spoiled-tile-prct-total-avg', 'rdp-tile-processing-latency-avg', |
| 145 |
'relative-one-way-average' |
| 146 |
|
| 147 |
=item B<--critical-*> |
| 148 |
|
| 149 |
Set critical thresholds. |
| 150 |
Can be : 'spoiled-tile-prct-total-avg', 'rdp-tile-processing-latency-avg', |
| 151 |
'relative-one-way-average' |
| 152 |
|
| 153 |
=back |
| 154 |
|
| 155 |
=cut |