feat(appeartv) - package AppearTV connector (#5313)
Co-authored-by: omercier <32134301+omercier@users.noreply.github.com> REFS: CTOR-797
This commit is contained in:
parent
651095a4ea
commit
55409b71fd
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"libsnmp-perl"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"pkg_name": "centreon-plugin-Hardware-Devices-Video-Appeartv-Snmp",
|
||||
"pkg_summary": "Centreon Plugin to monitor Appear TV using SNMP",
|
||||
"plugin_name": "centreon_video_appeartv_snmp.pl",
|
||||
"files": [
|
||||
"centreon/plugins/script_snmp.pm",
|
||||
"centreon/plugins/snmp.pm",
|
||||
"hardware/devices/video/appeartv/snmp/"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"perl(SNMP)"
|
||||
]
|
||||
}
|
|
@ -47,7 +47,6 @@ sub custom_status_calc {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -58,7 +57,9 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{alarm} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
{ label => 'status',
|
||||
threshold => 0,
|
||||
set => {
|
||||
key_values => [ { name => 'msgSourceName' }, { name => 'msgText' }, { name => 'since' }, { name => 'msgSeverity' }, { name => 'msgGenerationTime' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
|
@ -92,14 +93,19 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
$self->change_macros(macros => [ 'warning_status', 'critical_status' ]);
|
||||
if (defined($self->{option_results}->{memory})) {
|
||||
$self->{statefile_cache}->check_options(%options);
|
||||
}
|
||||
}
|
||||
|
||||
my %map_severity = (0 => 'indeterminate', 1 => 'critical', 2 => 'major', 3 => 'minor',
|
||||
4 => 'warning', 5 => 'cleared', 6 => 'notify');
|
||||
my %map_severity = (0 => 'indeterminate',
|
||||
1 => 'critical',
|
||||
2 => 'major',
|
||||
3 => 'minor',
|
||||
4 => 'warning',
|
||||
5 => 'cleared',
|
||||
6 => 'notify');
|
||||
|
||||
my $mapping = {
|
||||
msgSourceName => { oid => '.1.3.6.1.4.1.23916.3.1.4.1.3' },
|
||||
|
@ -117,11 +123,12 @@ sub manage_selection {
|
|||
{ oid => $mapping->{msgText}->{oid} },
|
||||
{ oid => $mapping->{msgGenerationTime}->{oid} },
|
||||
{ oid => $mapping->{msgSeverity}->{oid} },
|
||||
], return_type => 1);
|
||||
],
|
||||
return_type => 1);
|
||||
|
||||
my $last_time;
|
||||
if (defined($self->{option_results}->{memory})) {
|
||||
$self->{statefile_cache}->read(statefile => "cache_appeartv_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port(). '_' . $self->{mode});
|
||||
$self->{statefile_cache}->read(statefile => "cache_appeartv_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode});
|
||||
$last_time = $self->{statefile_cache}->get(name => 'last_time');
|
||||
}
|
||||
|
||||
|
@ -166,21 +173,21 @@ Check alarms.
|
|||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-msg>
|
||||
=item C<--filter-msg>
|
||||
|
||||
Filter by message (can be a regexp).
|
||||
|
||||
=item B<--warning-status>
|
||||
=item C<--warning-status>
|
||||
|
||||
Define the conditions to match for the status to be WARNING (default: '%{severity} =~ /minor|warning/i')
|
||||
You can use the following variables: %{severity}, %{text}, %{source}, %{since}
|
||||
|
||||
=item B<--critical-status>
|
||||
=item C<--critical-status>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (default: '%{severity} =~ /critical|major/i').
|
||||
You can use the following variables: %{severity}, %{text}, %{source}, %{since}
|
||||
|
||||
=item B<--memory>
|
||||
=item C<--memory>
|
||||
|
||||
Only check new alarms.
|
||||
|
||||
|
|
|
@ -43,6 +43,6 @@ __END__
|
|||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check AppeartTV in SNMP.
|
||||
Check AppearTV in SNMP.
|
||||
|
||||
=cut
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
*** Settings ***
|
||||
Documentation Hardware Video Appeartv Alarms
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Suite Setup Ctn Generic Suite Setup
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS}
|
||||
... --plugin=hardware::devices::video::appeartv::snmp::plugin
|
||||
... --mode=alarms
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=hardware/devices/video/appeartv/snmp/appeartv
|
||||
|
||||
*** Test Cases ***
|
||||
AppearTV Alarms ${tc}
|
||||
[Documentation] Hardware Video AppeartTV Alarms
|
||||
[Tags] hardware appeartv alarms
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... ${extraoptions}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 1 ${EMPTY} WARNING: 1 problem(s) detected | 'alerts'=1;;;0;
|
||||
... 2 --warning-status='\\\%{severity} =~ /minor/i' WARNING: 1 problem(s) detected | 'alerts'=1;;;0;
|
||||
... 3 --critical-status='\\\%{severity} =~ /critical|major|minor/i' CRITICAL: 1 problem(s) detected | 'alerts'=1;;;0;
|
||||
... 4 --filter-msg='Error' OK: 0 problem(s) detected | 'alerts'=0;;;0;
|
||||
... 5 --filter-msg='Disconnected' WARNING: 1 problem(s) detected | 'alerts'=1;;;0;
|
||||
... 6 --filter-msg='Disconnected' --critical-status='\\\%{severity} =~ /minor/i' CRITICAL: 1 problem(s) detected | 'alerts'=1;;;0;
|
||||
... 7 --memory WARNING: 1 problem(s) detected | 'alerts'=1;;;0;
|
||||
... 8 --memory OK: 0 problem(s) detected | 'alerts'=0;;;0;
|
|
@ -0,0 +1,4 @@
|
|||
.1.3.6.1.4.1.23916.3.1.4.1.3.0 = STRING: "Alarm 1"
|
||||
.1.3.6.1.4.1.23916.3.1.4.1.4.0 = STRING: "Disconnected sound"
|
||||
.1.3.6.1.4.1.23916.3.1.4.1.6.0 = STRING: "2024-09-16 14:49:18"
|
||||
.1.3.6.1.4.1.23916.3.1.4.1.13.0 = INTEGER: 3
|
|
@ -21,6 +21,7 @@ api.meraki.com
|
|||
--api-token
|
||||
--api-username
|
||||
--api-version
|
||||
AppearTV
|
||||
ASAM
|
||||
Avigilon
|
||||
Avocent
|
||||
|
|
Loading…
Reference in New Issue