mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-30 00:55:18 +02:00
New pack LatenceTech: mode radio (#5686)
Co-authored-by: thibaults-centreon <tscheitenberger@centreon.com> Co-authored-by: omercier <32134301+omercier@users.noreply.github.com>
This commit is contained in:
parent
2240b6e1d8
commit
a44e348c31
157
src/apps/monitoring/latencetech/restapi/mode/radio.pm
Normal file
157
src/apps/monitoring/latencetech/restapi/mode/radio.pm
Normal file
@ -0,0 +1,157 @@
|
||||
#
|
||||
# Copyright 2025 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::monitoring::latencetech::restapi::mode::radio;
|
||||
|
||||
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, cb_prefix_output => 'prefix_output' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'snr-dbm', nlabel => 'signal.noise.ratio.db', set => {
|
||||
key_values => [ { name => 'SINR_dB' }, { name => 'display' } ],
|
||||
output_template => 'Signal noise ratio: %.2fdb',
|
||||
perfdatas => [
|
||||
{ value => 'SINR_dB', template => '%.2f',
|
||||
unit => 'dbm', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'rssi-dbm', nlabel => 'received.signalstrength.indicator.dbm', set => {
|
||||
key_values => [ { name => 'RSSI_dBm' }, { name => 'display' } ],
|
||||
output_template => 'Received Signal Strength Indicator: %.2fdbm',
|
||||
perfdatas => [
|
||||
{ value => 'RSSI_dBm', template => '%.2f',
|
||||
unit => 'dbm', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'rsrp-dbm', nlabel => 'reference.signalreceive.power.dbm', set => {
|
||||
key_values => [ { name => 'RSRP_dBm' }, { name => 'display' } ],
|
||||
output_template => 'Reference signal receive power: %.2fdbm',
|
||||
perfdatas => [
|
||||
{ value => 'RSRP_dBm', template => '%.2f',
|
||||
unit => 'dbm', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'rsrq-db', nlabel => 'reference.signalreceive.quality.dbm', set => {
|
||||
key_values => [ { name => 'RSRQ_dB' }, { name => 'display' } ],
|
||||
output_template => 'Reference signal receive quality: %.2fdb',
|
||||
perfdatas => [
|
||||
{ value => 'RSRQ_dB', template => '%.2f',
|
||||
unit => 'db', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Agent '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{global} = {};
|
||||
my $results = $options{custom}->request_api(endpoint => '/radio');
|
||||
$self->{global}->{display} = $results->{agentID};
|
||||
foreach my $kpi (keys %{$results}) {
|
||||
if (defined($results->{$kpi}) && $results->{$kpi} !~ 'Unknown') {
|
||||
$self->{global}->{$kpi} = $results->{$kpi};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check agent radio statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--agent-id>
|
||||
|
||||
Set the ID of the agent (mandatory option).
|
||||
|
||||
=item B<--warning-snr-dbm>
|
||||
|
||||
Warning thresholds for signal noise ratio in dbm.
|
||||
|
||||
=item B<--critical-snr-dbm>
|
||||
|
||||
Critical thresholds for signal noise ratio in dbm.
|
||||
|
||||
=item B<--warning-rssi-dbm>
|
||||
|
||||
Warning thresholds for received signal strength indicator in dbm.
|
||||
|
||||
=item B<--critical-rssi-dbm>
|
||||
|
||||
Critical thresholds for received signal strength indicator in dbm.
|
||||
|
||||
=item B<--warning-rsrp-dbm>
|
||||
|
||||
Warning thresholds for reference signal receive power in dbm.
|
||||
|
||||
=item B<--critical-rsrp-dbm>
|
||||
|
||||
Critical thresholds for reference signal receive power in dbm.
|
||||
|
||||
=item B<--warning-rsrq-db>
|
||||
|
||||
Warning thresholds for reference signal receive quality in db.
|
||||
|
||||
=item B<--critical-rsrq-db>
|
||||
|
||||
Critical thresholds for reference signal receive quality in db.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
@ -34,7 +34,8 @@ sub new {
|
||||
'connectivity' => 'apps::monitoring::latencetech::restapi::mode::connectivity',
|
||||
'discovery' => 'apps::monitoring::latencetech::restapi::mode::discovery',
|
||||
'forecast' => 'apps::monitoring::latencetech::restapi::mode::forecast',
|
||||
'latency' => 'apps::monitoring::latencetech::restapi::mode::latency'
|
||||
'latency' => 'apps::monitoring::latencetech::restapi::mode::latency',
|
||||
'radio' => 'apps::monitoring::latencetech::restapi::mode::radio'
|
||||
};
|
||||
|
||||
$self->{custom_modes}->{api} = 'apps::monitoring::latencetech::restapi::custom::api';
|
||||
|
@ -328,6 +328,35 @@
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
},
|
||||
{
|
||||
"uuid": "6ba46385-639a-41c6-8890-c487af160499",
|
||||
"type": "http",
|
||||
"documentation": "",
|
||||
"method": "get",
|
||||
"endpoint": "api/v1/radio",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "0d20ae09-1365-42e9-913c-e75c0fcc7ba4",
|
||||
"body": "{\n \"CustomerID\": \"0\",\n \"agentID\": \"1\",\n \"time\": \"2025-02-04T17:12:56.062Z\",\n \"networkName\": \"Bell\",\n \"networkType\": \"4G LTE\",\n \"cellID\": \"40\",\n \"SINR_dB\": \"2.147489\",\n \"RSSI_dBm\": \"-63\",\n \"RSRP_dBm\": \"-10\",\n \"RSRQ_dB\": \"-94\"\n}",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
}
|
||||
],
|
||||
"rootChildren": [
|
||||
@ -346,6 +375,10 @@
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "febdf454-e06c-4f7c-9ff4-99eecdc98447"
|
||||
},
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "6ba46385-639a-41c6-8890-c487af160499"
|
||||
}
|
||||
],
|
||||
"proxyMode": false,
|
||||
|
55
tests/apps/monitoring/latencetech/restapi/radio.robot
Normal file
55
tests/apps/monitoring/latencetech/restapi/radio.robot
Normal file
@ -0,0 +1,55 @@
|
||||
*** Settings ***
|
||||
Documentation Check the LatenceTech radio mode with api custom mode
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Suite Setup Start Mockoon ${MOCKOON_JSON}
|
||||
Suite Teardown Stop Mockoon
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${MOCKOON_JSON} ${CURDIR}${/}mockoon.json
|
||||
|
||||
${cmd} ${CENTREON_PLUGINS}
|
||||
... --plugin=apps::monitoring::latencetech::restapi::plugin
|
||||
... --custommode=api
|
||||
... --mode=radio
|
||||
... --hostname=${HOSTNAME}
|
||||
... --api-key=key
|
||||
... --port=${APIPORT}
|
||||
... --proto=http
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
Radio ${tc}
|
||||
[Documentation] Check the agent radio statistics.
|
||||
[Tags] apps monitoring latencetech restapi
|
||||
|
||||
${command} Catenate
|
||||
... ${cmd}
|
||||
... --customer-id=0
|
||||
... --agent-id=1
|
||||
... ${extraoptions}
|
||||
Log ${cmd}
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 1 ${EMPTY}
|
||||
... OK: Agent '1' Signal noise ratio: 2.15db, Received Signal Strength Indicator: -63.00dbm, Reference signal receive power: -10.00dbm, Reference signal receive quality: -94.00db | '1#signal.noise.ratio.db'=2.15dbm;;;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;;;; '1#reference.signalreceive.power.dbm'=-10.00dbm;;;; '1#reference.signalreceive.quality.dbm'=-94.00db;;;;
|
||||
... 2 --warning-snr-dbm=1.5
|
||||
... WARNING: Agent '1' Signal noise ratio: 2.15db | '1#signal.noise.ratio.db'=2.15dbm;0:1.5;;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;;;; '1#reference.signalreceive.power.dbm'=-10.00dbm;;;; '1#reference.signalreceive.quality.dbm'=-94.00db;;;;
|
||||
... 3 --critical-snr-dbm=2.05
|
||||
... CRITICAL: Agent '1' Signal noise ratio: 2.15db | '1#signal.noise.ratio.db'=2.15dbm;;0:2.05;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;;;; '1#reference.signalreceive.power.dbm'=-10.00dbm;;;; '1#reference.signalreceive.quality.dbm'=-94.00db;;;;
|
||||
... 4 --warning-rssi-dbm=-65.5
|
||||
... WARNING: Agent '1' Received Signal Strength Indicator: -63.00dbm | '1#signal.noise.ratio.db'=2.15dbm;;;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;0:-65.5;;; '1#reference.signalreceive.power.dbm'=-10.00dbm;;;; '1#reference.signalreceive.quality.dbm'=-94.00db;;;;
|
||||
... 5 --critical-rssi-dbm=-70.3
|
||||
... CRITICAL: Agent '1' Received Signal Strength Indicator: -63.00dbm | '1#signal.noise.ratio.db'=2.15dbm;;;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;;0:-70.3;; '1#reference.signalreceive.power.dbm'=-10.00dbm;;;; '1#reference.signalreceive.quality.dbm'=-94.00db;;;;
|
||||
... 6 --warning-rsrp-dbm=-15.2
|
||||
... WARNING: Agent '1' Reference signal receive power: -10.00dbm | '1#signal.noise.ratio.db'=2.15dbm;;;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;;;; '1#reference.signalreceive.power.dbm'=-10.00dbm;0:-15.2;;; '1#reference.signalreceive.quality.dbm'=-94.00db;;;;
|
||||
... 7 --critical-rsrp-dbm=-20.7
|
||||
... CRITICAL: Agent '1' Reference signal receive power: -10.00dbm | '1#signal.noise.ratio.db'=2.15dbm;;;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;;;; '1#reference.signalreceive.power.dbm'=-10.00dbm;;0:-20.7;; '1#reference.signalreceive.quality.dbm'=-94.00db;;;;
|
||||
... 8 --warning-rsrq-db=-90.5
|
||||
... WARNING: Agent '1' Reference signal receive quality: -94.00db | '1#signal.noise.ratio.db'=2.15dbm;;;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;;;; '1#reference.signalreceive.power.dbm'=-10.00dbm;;;; '1#reference.signalreceive.quality.dbm'=-94.00db;0:-90.5;;;
|
||||
... 9 --critical-rsrq-db=-95.2
|
||||
... CRITICAL: Agent '1' Reference signal receive quality: -94.00db | '1#signal.noise.ratio.db'=2.15dbm;;;; '1#received.signalstrength.indicator.dbm'=-63.00dbm;;;; '1#reference.signalreceive.power.dbm'=-10.00dbm;;;; '1#reference.signalreceive.quality.dbm'=-94.00db;;0:-95.2;;
|
Loading…
x
Reference in New Issue
Block a user