add axis video camera plugin (#1196)
* good * K * Add last functions audio, video, storage * OK! * Version final * Version final2 * Correction OID AudioStatus * Correction after review * Correctio path storage.pm
This commit is contained in:
parent
29773de93e
commit
b7e95425b9
|
@ -0,0 +1,68 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::mode::components::audio;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_audio_status = (
|
||||||
|
1 => 'signalOk',
|
||||||
|
2 => 'noSignal',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
axisAudioState => { oid => '.1.3.6.1.4.1.368.4.1.5.1.2', map => \%map_audio_status },
|
||||||
|
};
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $mapping->{axisAudioState}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking audio Signal");
|
||||||
|
$self->{components}->{audio} = {name => 'audio', total => 0, skip => 0};
|
||||||
|
return if ($self->check_filter(section => 'audio'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{axisAudioState}->{oid}}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{axisAudioState}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{axisAudioState}->{oid}}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'audio', instance => $instance));
|
||||||
|
$self->{components}->{audio}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("audio '%s' state is %s [instance: %s].",
|
||||||
|
$instance, $result->{axisAudioState}, $instance
|
||||||
|
));
|
||||||
|
my $exit = $self->get_severity(section => 'audio', value => $result->{axisAudioState});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("audio '%s' state is %s",
|
||||||
|
$instance, $result->{axisAudioState}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -0,0 +1,71 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::mode::components::casing;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_casing_status = (
|
||||||
|
1 => 'closed',
|
||||||
|
2 => 'open',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
axiscasingState => { oid => '.1.3.6.1.4.1.368.4.1.6.1.3', map => \%map_casing_status },
|
||||||
|
axiscasingName => { oid => '.1.3.6.1.4.1.368.4.1.6.1.2' },
|
||||||
|
};
|
||||||
|
|
||||||
|
my $oid_axiscasingEntry = '.1.3.6.1.4.1.368.4.1.6.1';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $oid_axiscasingEntry, start => $mapping->{axiscasingState}->{oid}, end => $mapping->{axiscasingName}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking casings");
|
||||||
|
$self->{components}->{casing} = {name => 'casings', total => 0, skip => 0};
|
||||||
|
return if ($self->check_filter(section => 'casing'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_axiscasingEntry}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{axiscasingState}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_axiscasingEntry}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'casing', instance => $instance));
|
||||||
|
$self->{components}->{casing}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("casing '%s' status is %s [casing: %s]",
|
||||||
|
$instance, $result->{axiscasingState}, $result->{axiscasingName},
|
||||||
|
));
|
||||||
|
my $exit = $self->get_severity(section => 'casing', value => $result->{axiscasingState});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("casing state is %s [casing: %s]",
|
||||||
|
$result->{axiscasingState}, $result->{axiscasingName}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -0,0 +1,68 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::mode::components::fan;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_fan_status = (
|
||||||
|
0 => 'ok',
|
||||||
|
1 => 'failed',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
axisFanState => { oid => '.1.3.6.1.4.1.368.4.1.2.1.3', map => \%map_fan_status },
|
||||||
|
};
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $mapping->{axisFanState}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking fans");
|
||||||
|
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||||
|
return if ($self->check_filter(section => 'fan'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{axisFanState}->{oid}}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{axisFanState}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{axisFanState}->{oid}}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||||
|
$self->{components}->{fan}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("fan '%s' state is %s [instance: %s].",
|
||||||
|
$instance, $result->{axisFanState}, $instance
|
||||||
|
));
|
||||||
|
my $exit = $self->get_severity(section => 'fan', value => $result->{axisFanState});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("fan '%s' state is %s",
|
||||||
|
$instance, $result->{axisFanState}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -0,0 +1,68 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::mode::components::psu;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_psu_status = (
|
||||||
|
1 => 'ok',
|
||||||
|
2 => 'failure',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
axisPsState => { oid => '.1.3.6.1.4.1.368.4.1.2.1.3', map => \%map_psu_status },
|
||||||
|
};
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $mapping->{axisPsState}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking power supply");
|
||||||
|
$self->{components}->{psu} = {name => 'psu', total => 0, skip => 0};
|
||||||
|
return if ($self->check_filter(section => 'psu'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{axisPsState}->{oid}}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{axisPsState}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{axisPsState}->{oid}}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||||
|
$self->{components}->{psu}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("power supply '%s' state is %s [instance: %s].",
|
||||||
|
$instance, $result->{axisPsState}, $instance
|
||||||
|
));
|
||||||
|
my $exit = $self->get_severity(section => 'psu', value => $result->{axisPsState});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("power supply '%s' state is %s",
|
||||||
|
$instance, $result->{axisPsState}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -0,0 +1,68 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::mode::components::storage;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_storage_status = (
|
||||||
|
1 => 'no',
|
||||||
|
2 => 'yes',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
axisStorageState => { oid => '.1.3.6.1.4.1.368.4.1.8.1.3', map => \%map_storage_status },
|
||||||
|
};
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $mapping->{axisStorageState}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking Storage");
|
||||||
|
$self->{components}->{storage} = {name => 'storage', total => 0, skip => 0};
|
||||||
|
return if ($self->check_filter(section => 'storage'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{axisStorageState}->{oid}}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{axisStorageState}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{axisStorageState}->{oid}}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'storage', instance => $instance));
|
||||||
|
$self->{components}->{storage}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("storage '%s' state is %s [instance: %s].",
|
||||||
|
$instance, $result->{axisStorageState}, $instance
|
||||||
|
));
|
||||||
|
my $exit = $self->get_severity(section => 'storage', value => $result->{axisStorageState});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("storage '%s' state is %s",
|
||||||
|
$instance, $result->{axisStorageState}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -0,0 +1,86 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::mode::components::temperature;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_temperature_status = (
|
||||||
|
1 => 'ok',
|
||||||
|
2 => 'failed',
|
||||||
|
3 => 'outOfBoundary',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
axisTemperatureState => { oid => '.1.3.6.1.4.1.368.4.1.3.1.3', map => \%map_temperature_status },
|
||||||
|
axisTemperatureCelsius => { oid => '.1.3.6.1.4.1.368.4.1.3.1.4' },
|
||||||
|
};
|
||||||
|
|
||||||
|
my $oid_axisTemperatureEntry = '.1.3.6.1.4.1.368.4.1.3.1';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $oid_axisTemperatureEntry, start => $mapping->{axisTemperatureState}->{oid}, end => $mapping->{axisTemperatureCelsius}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||||
|
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||||
|
return if ($self->check_filter(section => 'temperature'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_axisTemperatureEntry}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{axisTemperatureState}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_axisTemperatureEntry}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||||
|
$self->{components}->{temperature}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' status is %s [temperature: %s C]",
|
||||||
|
$instance, $result->{axisTemperatureState}, $result->{axisTemperatureCelsius},
|
||||||
|
));
|
||||||
|
my $exit = $self->get_severity(section => 'temperature', value => $result->{axisTemperatureState});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Temperature state is %s [temperature: %s C]",
|
||||||
|
$result->{axisTemperatureState}, $result->{axisTemperaturecelsius}));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (defined($result->{axisTemperatureCelsius}) && $result->{axisTemperatureCelsius} != -1) {
|
||||||
|
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{axisTemperatureCelsius});
|
||||||
|
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $instance, $result->{axisTemperatureCelsius}));
|
||||||
|
}
|
||||||
|
$self->{output}->perfdata_add(label => "temperature_" . $instance, unit => 'C',
|
||||||
|
value => $result->{axisTemperatureCelsius},
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -0,0 +1,69 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::mode::components::video;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_video_status = (
|
||||||
|
1 => 'signalOk',
|
||||||
|
2 => 'noSignal',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
axisVideoState => { oid => '.1.3.6.1.4.1.368.4.1.4.1.2', map => \%map_video_status },
|
||||||
|
};
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $mapping->{axisVideoState}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking Video Signal");
|
||||||
|
$self->{components}->{video} = {name => 'video', total => 0, skip => 0};
|
||||||
|
return if ($self->check_filter(section => 'video'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{axisVideoState}->{oid}}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{axisVideoState}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{axisVideoState}->{oid}}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'video', instance => $instance));
|
||||||
|
$self->{components}->{video}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("video '%s' state is %s [instance: %s].",
|
||||||
|
$instance, $result->{axisVideoState}, $instance
|
||||||
|
));
|
||||||
|
my $exit = $self->get_severity(section => 'video', value => $result->{axisVideoState});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("video '%s' state is %s",
|
||||||
|
$instance, $result->{axisVideoState}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -0,0 +1,131 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::mode::environment;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::hardware);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
sub set_system {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{regexp_threshold_overload_check_section_option} = '^(video|fan|psu|temperature|audio|storage|casing)$';
|
||||||
|
|
||||||
|
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature)$';
|
||||||
|
|
||||||
|
$self->{cb_hook2} = 'snmp_execute';
|
||||||
|
|
||||||
|
$self->{thresholds} = {
|
||||||
|
video => [
|
||||||
|
['signalOk', 'OK'],
|
||||||
|
['noSignal', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
psu => [
|
||||||
|
['failure', 'CRITICAL'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
],
|
||||||
|
fan => [
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
],
|
||||||
|
temperature => [
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
['outOfBoundary', 'CRITICAL'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
],
|
||||||
|
audio => [
|
||||||
|
['signalOk', 'OK'],
|
||||||
|
['noSignal', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
storage => [
|
||||||
|
['yes', 'OK'],
|
||||||
|
['no', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
casing => [
|
||||||
|
['open', 'OK'],
|
||||||
|
['closed', 'WARNING'],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
$self->{components_path} = 'hardware::devices::video::axis::snmp::mode::components';
|
||||||
|
$self->{components_module} = ['video', 'psu', 'fan', 'temperature', 'audio', 'storage', 'casing'];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub snmp_execute {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check videos (AXIS-VIDEO-MIB).
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--component>
|
||||||
|
|
||||||
|
Which component to check (Default: '.*').
|
||||||
|
Can be: 'video', 'psu', 'fan', 'temperature', 'audio', 'storage', 'casing'.
|
||||||
|
|
||||||
|
=item B<--filter>
|
||||||
|
|
||||||
|
Exclude some parts (comma seperated list) (Example: --filter=video)
|
||||||
|
Can also exclude specific instance: --filter=video,fan.1
|
||||||
|
|
||||||
|
=item B<--absent-problem>
|
||||||
|
|
||||||
|
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
||||||
|
Can be specific or global: --absent-problem=video,temperature.2
|
||||||
|
|
||||||
|
=item B<--no-component>
|
||||||
|
|
||||||
|
Return an error if no compenents are checked.
|
||||||
|
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||||
|
|
||||||
|
=item B<--threshold-overload>
|
||||||
|
|
||||||
|
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
|
||||||
|
It used before default thresholds (order stays).
|
||||||
|
Example: --threshold-overload='video,CRITICAL,^(?!(good)$)'
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,48 @@
|
||||||
|
#
|
||||||
|
# Copyright 2018 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 hardware::devices::video::axis::snmp::plugin;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use base qw(centreon::plugins::script_snmp);
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
%{$self->{modes}} = (
|
||||||
|
'environment' => 'hardware::devices::video::axis::snmp::mode::environment',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 PLUGIN DESCRIPTION
|
||||||
|
|
||||||
|
Check Video Camera Axis in SNMP.
|
||||||
|
|
||||||
|
=cut
|
Loading…
Reference in New Issue