(plugin) hardware::devices:📷:optelecom::snmp - new (#4629)
This commit is contained in:
parent
f6068be83a
commit
3ff6b3f79d
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"libsnmp-perl"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"pkg_name": "centreon-plugin-Hardware-Devices-Camera-Optelecom-Snmp",
|
||||
"pkg_summary": "Centreon Plugin to monitor Optelecom camera using SNMP",
|
||||
"plugin_name": "centreon_camera_optelecom_snmp.pl",
|
||||
"files": [
|
||||
"centreon/plugins/script_snmp.pm",
|
||||
"centreon/plugins/snmp.pm",
|
||||
"snmp_standard/mode/interfaces.pm",
|
||||
"snmp_standard/mode/listinterfaces.pm",
|
||||
"snmp_standard/mode/resources/",
|
||||
"snmp_standard/mode/uptime.pm",
|
||||
"hardware/devices/camera/optelecom/snmp/"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"perl(SNMP)"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,417 @@
|
|||
#
|
||||
# Copyright 2023 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::camera::optelecom::snmp::mode::alarms;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub custom_alarm_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"alarm: %s",
|
||||
$self->{result_values}->{alarm}
|
||||
);
|
||||
}
|
||||
|
||||
sub device_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"checking device '%s'",
|
||||
$options{instance_value}->{deviceName}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_device_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"device '%s' ",
|
||||
$options{instance_value}->{deviceName}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_alarm_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => 'alarm.enabled.count',
|
||||
instances => [$self->{result_values}->{deviceName}, $self->{result_values}->{alarmName}],
|
||||
value => sprintf('%s', $self->{result_values}->{alarmValue})
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_alarm_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "alarm '" . $options{instance_value}->{alarmName} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'devices', type => 3, cb_prefix_output => 'prefix_device_output', cb_long_output => 'device_long_output',
|
||||
indent_long_output => ' ', message_multiple => 'All devices are ok',
|
||||
group => [
|
||||
{ name => 'alarms', type => 1, cb_prefix_output => 'prefix_alarm_output', message_multiple => 'all alarms are ok', skipped_code => { -10 => 1 } }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{alarms} = [
|
||||
{
|
||||
label => 'alarm-status',
|
||||
type => 2,
|
||||
critical_default => '%{alarm} eq "enabled"',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'alarm' }, { name => 'alarmValue' }, { name => 'alarmName' }, { name => 'deviceName' }
|
||||
],
|
||||
closure_custom_output => $self->can('custom_alarm_output'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_perfdata => $self->can('custom_alarm_perfdata')
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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 => {
|
||||
'filter-device-name:s' => { name => 'filter_device_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my $mapping_device = {
|
||||
serial => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.6' }, # optcSerialNumber
|
||||
userLabel1 => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.8' }, # optcUserLabel1
|
||||
userLabel2 => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.9' } # optcUserLabel2
|
||||
};
|
||||
my $mapping_stream = {
|
||||
streamDesc => { oid => '.1.3.6.1.4.1.17534.2.2.2.2.1.5' }, # optcStreamDescription
|
||||
streamDownAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.2.2.1.10' } # optcStreamDownAlarm
|
||||
};
|
||||
my $mapping_input = {
|
||||
inputDesc => { oid => '.1.3.6.1.4.1.17534.2.2.2.3.1.4' }, # optcInputDescription
|
||||
signalLostAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.2.3.1.7' }, # optcSignalLostAlarm
|
||||
formatAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.2.3.1.8' } # optcFormatAlarm
|
||||
};
|
||||
my $mapping_image_quality = {
|
||||
badContrastAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.3.1.1.5' }, # optcBadContrastAlarm
|
||||
badExposureAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.3.1.1.6' }, # optcBadExposureAlarm
|
||||
lowDetailAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.3.1.1.7' }, # optcLowDetailAlarm
|
||||
lowSnrAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.3.1.1.8' } # optcLowSnrAlarm
|
||||
};
|
||||
my $mapping_tampering = {
|
||||
noMatchAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.3.2.1.3' }, # optcNoMatchAlarm
|
||||
positionChangedAlarm => { oid => '.1.3.6.1.4.1.17534.2.2.3.2.1.4' } # optcPositionChangedAlarm
|
||||
};
|
||||
|
||||
sub add_stream_alarm {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_streamTable = '.1.3.6.1.4.1.17534.2.2.2.2.1'; # optcStreamEntry
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_streamTable,
|
||||
start => $mapping_stream->{streamDesc}->{oid}
|
||||
);
|
||||
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /\.(\d+)\.(\d+)$/);
|
||||
my ($deviceIndex, $streamIndex) = ($1, $2);
|
||||
|
||||
next if (!defined($self->{devices}->{$deviceIndex}));
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_stream, results => $snmp_result, instance => $deviceIndex . '.' . $streamIndex);
|
||||
|
||||
my $name = 'streamDown ' . $result->{streamDesc};
|
||||
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{streamDownAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{streamDownAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub add_input_alarm {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_inputTable = '.1.3.6.1.4.1.17534.2.2.2.3.1'; # optcInputEntry
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_inputTable,
|
||||
start => $mapping_stream->{inputDesc}->{oid}
|
||||
);
|
||||
|
||||
$self->{inputs} = {};
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /\.(\d+)\.(\d+)$/);
|
||||
my ($deviceIndex, $inputIndex) = ($1, $2);
|
||||
|
||||
next if (!defined($self->{devices}->{$deviceIndex}));
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_input, results => $snmp_result, instance => $deviceIndex . '.' . $inputIndex);
|
||||
|
||||
$self->{inputs}->{$deviceIndex . $inputIndex} = $result->{inputDesc};
|
||||
|
||||
my $name = 'signalLost ' . $result->{inputDesc};
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{signalLostAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{signalLostAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
|
||||
$name = 'format ' . $result->{inputDesc};
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{formatAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{formatAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub add_image_quality_alarm {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_imageQualityTable = '.1.3.6.1.4.1.17534.2.2.3.1.1'; # optcImageQualityEntry
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_imageQualityTable,
|
||||
start => $mapping_image_quality->{badContrastAlarm}->{oid}
|
||||
);
|
||||
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /\.(\d+)\.(\d+)$/);
|
||||
my ($deviceIndex, $inputIndex) = ($1, $2);
|
||||
|
||||
next if (!defined($self->{devices}->{$deviceIndex}));
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_image_quality, results => $snmp_result, instance => $deviceIndex . '.' . $inputIndex);
|
||||
|
||||
my $name = 'badContrast ' . $self->{inputs}->{$deviceIndex . $inputIndex};
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{badContrastAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{badContrastAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
|
||||
$name = 'badExposure ' . $self->{inputs}->{$deviceIndex . $inputIndex};
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{badExposureAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{badExposureAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
|
||||
$name = 'lowDetail ' . $self->{inputs}->{$deviceIndex . $inputIndex};
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{lowDetailAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{lowDetailAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
|
||||
$name = 'lowSnr ' . $self->{inputs}->{$deviceIndex . $inputIndex};
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{lowSnrAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{lowSnrAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub add_tampering_alarm {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_tamperingTable = '.1.3.6.1.4.1.17534.2.2.3.2.1'; # optcTamperingEntry
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_tamperingTable,
|
||||
start => $mapping_tampering->{noMatchAlarm}->{oid}
|
||||
);
|
||||
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /\.(\d+)\.(\d+)$/);
|
||||
my ($deviceIndex, $inputIndex) = ($1, $2);
|
||||
|
||||
next if (!defined($self->{devices}->{$deviceIndex}));
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_tampering, results => $snmp_result, instance => $deviceIndex . '.' . $inputIndex);
|
||||
|
||||
my $name = 'noMatchoptcNoMatchAlarm ' . $self->{inputs}->{$deviceIndex . $inputIndex};
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{noMatchAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{noMatchAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
|
||||
$name = 'positionChanged ' . $self->{inputs}->{$deviceIndex . $inputIndex};
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $result->{positionChangedAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{positionChangedAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub add_network_alarm {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_networkOverloadAlarm = '.1.3.6.1.4.1.17534.2.2.2.4.1.2';
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_networkOverloadAlarm
|
||||
);
|
||||
|
||||
foreach (keys %$snmp_result) {
|
||||
/\.(\d+)$/;
|
||||
my $deviceIndex = $1;
|
||||
|
||||
next if (!defined($self->{devices}->{$deviceIndex}));
|
||||
|
||||
my $name = 'networkOverload';
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $snmp_result->{$_} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $snmp_result->{$_} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub add_psu_alarm {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
# it's not linked to a device... weird..
|
||||
my $oid_powerSupplyAlarm = '.1.3.6.1.4.1.17534.2.2.1.3.3.0';
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [$oid_powerSupplyAlarm]
|
||||
);
|
||||
|
||||
if (defined($snmp_result->{$oid_powerSupplyAlarm})) {
|
||||
foreach (keys %{$self->{devices}}) {
|
||||
my $name = 'powersupply';
|
||||
$self->{devices}->{$_}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$_}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $snmp_result->{$oid_powerSupplyAlarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $snmp_result->{$oid_powerSupplyAlarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_deviceTable = '.1.3.6.1.4.1.17534.2.2.1.1.1'; # optcSysInfoEntry
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_deviceTable,
|
||||
start => $mapping_device->{serial}->{oid},
|
||||
end => $mapping_device->{userLabel2}->{oid},
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{devices} = {};
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /^$mapping_device->{serial}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_device, results => $snmp_result, instance => $instance);
|
||||
|
||||
my $name = defined($result->{userLabel1}) && $result->{userLabel1} ne '' ? $result->{userLabel1} : $result->{serial};
|
||||
next if (defined($self->{option_results}->{filter_device_name}) && $self->{option_results}->{filter_device_name} ne '' &&
|
||||
$name !~ /$self->{option_results}->{filter_device_name}/);
|
||||
|
||||
$self->{devices}->{$instance} = { deviceName => $name, alarms => {} };
|
||||
}
|
||||
|
||||
my $oid_temperatureAlarm = '.1.3.6.1.4.1.17534.2.2.1.3.1.1.5'; # optcTemperatureAlarm
|
||||
$snmp_result = $options{snmp}->get_table(oid => $oid_temperatureAlarm);
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /\.(\d+).(\d+)$/);
|
||||
my ($deviceIndex, $probeIndex) = ($1, $2);
|
||||
|
||||
next if (!defined($self->{devices}->{$deviceIndex}));
|
||||
|
||||
my $name = 'temperature ' . $probeIndex;
|
||||
|
||||
$self->{devices}->{$deviceIndex}->{alarms}->{$name} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
alarmName => $name,
|
||||
alarmValue => $snmp_result->{$_} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $snmp_result->{$_} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
}
|
||||
|
||||
$self->add_stream_alarm(snmp => $options{snmp});
|
||||
$self->add_input_alarm(snmp => $options{snmp});
|
||||
$self->add_image_quality_alarm(snmp => $options{snmp});
|
||||
$self->add_tampering_alarm(snmp => $options{snmp});
|
||||
$self->add_network_alarm(snmp => $options{snmp});
|
||||
$self->add_psu_alarm(snmp => $options{snmp});
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check alarms.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-device-name>
|
||||
|
||||
Filter devices by name (can be a regexp).
|
||||
|
||||
=item B<--unknown-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be UNKNOWN.
|
||||
You can use the following variables: %{alarm}, %{alarmName}, %{deviceName}
|
||||
|
||||
=item B<--warning-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be WARNING.
|
||||
You can use the following variables: %{alarm}, %{alarmName}, %{deviceName}
|
||||
|
||||
=item B<--critical-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (default: '%{alarm} eq "enabled"').
|
||||
You can use the following variables: %{alarm}, %{alarmName}, %{deviceName}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,180 @@
|
|||
#
|
||||
# Copyright 2023 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::camera::optelecom::snmp::mode::interfaces;
|
||||
|
||||
use base qw(snmp_standard::mode::interfaces);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check interfaces.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--add-global>
|
||||
|
||||
Check global port statistics (By default if no --add-* option is set).
|
||||
|
||||
=item B<--add-status>
|
||||
|
||||
Check interface status.
|
||||
|
||||
=item B<--add-duplex-status>
|
||||
|
||||
Check duplex status (with --warning-status and --critical-status).
|
||||
|
||||
=item B<--add-traffic>
|
||||
|
||||
Check interface traffic.
|
||||
|
||||
=item B<--add-errors>
|
||||
|
||||
Check interface errors.
|
||||
|
||||
=item B<--add-cast>
|
||||
|
||||
Check interface cast.
|
||||
|
||||
=item B<--add-speed>
|
||||
|
||||
Check interface speed.
|
||||
|
||||
=item B<--add-volume>
|
||||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Define the conditions to match for the status to be WARNING.
|
||||
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (Default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
|
||||
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
||||
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
||||
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
|
||||
'speed' (b/s).
|
||||
|
||||
=item B<--units-traffic>
|
||||
|
||||
Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta', 'bps', 'counter').
|
||||
|
||||
=item B<--units-errors>
|
||||
|
||||
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
|
||||
|
||||
=item B<--units-cast>
|
||||
|
||||
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
|
||||
|
||||
=item B<--nagvis-perfdata>
|
||||
|
||||
Display traffic perfdata to be compatible with nagvis widget.
|
||||
|
||||
=item B<--interface>
|
||||
|
||||
Set the interface (number expected) ex: 1,2,... (empty means 'check all interfaces').
|
||||
|
||||
=item B<--name>
|
||||
|
||||
Allows you to define the interface (in option --interface) by name instead of OID index. The name matching mode supports regular expressions.
|
||||
|
||||
=item B<--speed>
|
||||
|
||||
Set interface speed for incoming/outgoing traffic (in Mb).
|
||||
|
||||
=item B<--speed-in>
|
||||
|
||||
Set interface speed for incoming traffic (in Mb).
|
||||
|
||||
=item B<--speed-out>
|
||||
|
||||
Set interface speed for outgoing traffic (in Mb).
|
||||
|
||||
=item B<--map-speed-dsl>
|
||||
|
||||
Get interface speed configuration for interface type 'adsl' and 'vdsl2'.
|
||||
|
||||
Syntax: --map-speed-dsl=interface-src-name,interface-dsl-name
|
||||
|
||||
E.g: --map-speed-dsl=Et0.835,Et0-vdsl2
|
||||
|
||||
=item B<--force-counters64>
|
||||
|
||||
Force to use 64 bits counters only. Can be used to improve performance.
|
||||
|
||||
=item B<--force-counters32>
|
||||
|
||||
Force to use 32 bits counters (even in snmp v2c and v3). Should be used when 64 bits counters are buggy.
|
||||
|
||||
=item B<--reload-cache-time>
|
||||
|
||||
Time in minutes before reloading cache file (default: 180).
|
||||
|
||||
=item B<--oid-filter>
|
||||
|
||||
Define the OID to be used to filter interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
|
||||
|
||||
=item B<--oid-display>
|
||||
|
||||
Define the OID that will be used to name the interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
|
||||
|
||||
=item B<--oid-extra-display>
|
||||
|
||||
Add an OID to display.
|
||||
|
||||
=item B<--display-transform-src> B<--display-transform-dst>
|
||||
|
||||
Modify the interface name displayed by using a regular expression.
|
||||
|
||||
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
|
||||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,201 @@
|
|||
#
|
||||
# Copyright 2023 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::camera::optelecom::snmp::mode::networks;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub device_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"checking device '%s'",
|
||||
$options{instance_value}->{deviceName}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_device_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"device '%s' ",
|
||||
$options{instance_value}->{deviceName}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_network_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"network '%s' ",
|
||||
$options{instance_value}->{ipAddress}
|
||||
);
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'devices', type => 3, cb_prefix_output => 'prefix_device_output', cb_long_output => 'device_long_output',
|
||||
indent_long_output => ' ', message_multiple => 'All devices are ok',
|
||||
group => [
|
||||
{ name => 'networks', type => 1, cb_prefix_output => 'prefix_network_output', message_multiple => 'all networks are ok', skipped_code => { -10 => 1 } }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{networks} = [
|
||||
{ label => 'traffic-in', nlabel => 'network.traffic.in.bitspersecond', set => {
|
||||
key_values => [ { name => 'trafficIn' }, { name => 'deviceName' }, { name => 'ipAddress' } ],
|
||||
output_template => 'in: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
closure_custom_perfdata => sub {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => $self->{nlabel},
|
||||
unit => 'b/s',
|
||||
instances => [$self->{result_values}->{deviceName}, $self->{result_values}->{ipAddress}],
|
||||
value => $self->{result_values}->{trafficIn},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
{ label => 'traffic-out', nlabel => 'network.traffic.out.bitspersecond', set => {
|
||||
key_values => [ { name => 'trafficOut' }, { name => 'deviceName' }, { name => 'ipAddress' } ],
|
||||
output_template => 'out: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
closure_custom_perfdata => sub {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => $self->{nlabel},
|
||||
unit => 'b/s',
|
||||
instances => [$self->{result_values}->{deviceName}, $self->{result_values}->{ipAddress}],
|
||||
value => $self->{result_values}->{trafficOut},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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 => {
|
||||
'filter-device-name:s' => { name => 'filter_device_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my $mapping_device = {
|
||||
serial => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.6' }, # optcSerialNumber
|
||||
userLabel1 => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.8' }, # optcUserLabel1
|
||||
userLabel2 => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.9' } # optcUserLabel2
|
||||
};
|
||||
|
||||
my $mapping_network = {
|
||||
ipAddress => { oid => '.1.3.6.1.4.1.17534.2.2.1.4.1.4' }, # optcIPAddress
|
||||
trafficOut => { oid => '.1.3.6.1.4.1.17534.2.2.1.5.1.1' }, # optcTotalTxBitrate
|
||||
trafficIn => { oid => '.1.3.6.1.4.1.17534.2.2.1.5.1.2' } # optcTotalRxBitrate
|
||||
};
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_deviceTable = '.1.3.6.1.4.1.17534.2.2.1.1.1'; # optcSysInfoEntry
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_deviceTable,
|
||||
start => $mapping_device->{serial}->{oid},
|
||||
end => $mapping_device->{userLabel2}->{oid},
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{devices} = {};
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /^$mapping_device->{serial}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_device, results => $snmp_result, instance => $instance);
|
||||
|
||||
my $name = defined($result->{userLabel1}) && $result->{userLabel1} ne '' ? $result->{userLabel1} : $result->{serial};
|
||||
next if (defined($self->{option_results}->{filter_device_name}) && $self->{option_results}->{filter_device_name} ne '' &&
|
||||
$name !~ /$self->{option_results}->{filter_device_name}/);
|
||||
|
||||
$self->{devices}->{$instance} = { deviceName => $name, networks => {} };
|
||||
}
|
||||
|
||||
my $oid_networkTable = '.1.3.6.1.4.1.17534.2.2.1.4.1'; # optcNetworkSettingsEntry
|
||||
my $oid_networkStatsTable = '.1.3.6.1.4.1.17534.2.2.1.5.1'; # optcNetworkStatisticsEntry
|
||||
$snmp_result = $options{snmp}->get_multiple_table(
|
||||
oids => [ { oid => $oid_networkTable }, { oid => $oid_networkStatsTable } ],
|
||||
return_type => 1
|
||||
);
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /^$mapping_network->{ipAddress}->{oid}\.(\d+).(\d+)$/);
|
||||
my ($deviceIndex, $netIndex) = ($1, $2);
|
||||
|
||||
next if (!defined($self->{devices}->{$deviceIndex}));
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_network, results => $snmp_result, instance => $deviceIndex . '.' . $netIndex);
|
||||
|
||||
$self->{devices}->{$deviceIndex}->{networks}->{$netIndex} = {
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
ipAddress => $result->{ipAddress},
|
||||
trafficIn => $result->{trafficIn} * 1000,
|
||||
trafficOut => $result->{trafficOut} * 1000
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check networks traffic.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-device-name>
|
||||
|
||||
Filter devices by name (can be a regexp).
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'traffic-in', 'traffic-out'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,219 @@
|
|||
#
|
||||
# Copyright 2023 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::camera::optelecom::snmp::mode::temperatures;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub custom_alarm_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"alarm: %s",
|
||||
$self->{result_values}->{alarm}
|
||||
);
|
||||
}
|
||||
|
||||
sub device_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"checking device '%s'",
|
||||
$options{instance_value}->{deviceName}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_device_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"device '%s' ",
|
||||
$options{instance_value}->{deviceName}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_temperature_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "temperature probe '" . $options{instance_value}->{probeIndex} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'devices', type => 3, cb_prefix_output => 'prefix_device_output', cb_long_output => 'device_long_output',
|
||||
indent_long_output => ' ', message_multiple => 'All devices are ok',
|
||||
group => [
|
||||
{ name => 'temperatures', type => 1, cb_prefix_output => 'prefix_temperature_output', message_multiple => 'all temperatures are ok', skipped_code => { -10 => 1 } }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{temperatures} = [
|
||||
{ label => 'probe-temperature', nlabel => 'probe.temperature.celsius', set => {
|
||||
key_values => [ { name => 'actual' }, { name => 'probeIndex' }, { name => 'deviceName' } ],
|
||||
output_template => 'temperature: %.2f C',
|
||||
closure_custom_perfdata => sub {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => $self->{nlabel},
|
||||
unit => 'C',
|
||||
instances => [$self->{result_values}->{deviceName}, $self->{result_values}->{probeIndex}],
|
||||
value => sprintf('%.2f', $self->{result_values}->{actual}),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel})
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'alarm-status',
|
||||
type => 2,
|
||||
critical_default => '%{alarm} eq "enabled"',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'alarm' }, { name => 'alarmValue' }, { name => 'probeIndex' }, { name => 'deviceName' }
|
||||
],
|
||||
closure_custom_output => $self->can('custom_alarm_output'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_perfdata => sub {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => 'probe.temperature.alarm.enabled.count',
|
||||
instances => [$self->{result_values}->{deviceName}, $self->{result_values}->{probeIndex}],
|
||||
value => sprintf('%s', $self->{result_values}->{alarmValue})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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 => {
|
||||
'filter-device-name:s' => { name => 'filter_device_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my $mapping_device = {
|
||||
serial => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.6' }, # optcSerialNumber
|
||||
userLabel1 => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.8' }, # optcUserLabel1
|
||||
userLabel2 => { oid => '.1.3.6.1.4.1.17534.2.2.1.1.1.9' } # optcUserLabel2
|
||||
};
|
||||
|
||||
my $mapping_temperature = {
|
||||
actual => { oid => '.1.3.6.1.4.1.17534.2.2.1.3.1.1.2' }, # optcActualTemperature
|
||||
alarm => { oid => '.1.3.6.1.4.1.17534.2.2.1.3.1.1.5' }, # optcTemperatureAlarm
|
||||
};
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_deviceTable = '.1.3.6.1.4.1.17534.2.2.1.1.1'; # optcSysInfoEntry
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_deviceTable,
|
||||
start => $mapping_device->{serial}->{oid},
|
||||
end => $mapping_device->{userLabel2}->{oid},
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{devices} = {};
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /^$mapping_device->{serial}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_device, results => $snmp_result, instance => $instance);
|
||||
|
||||
my $name = defined($result->{userLabel1}) && $result->{userLabel1} ne '' ? $result->{userLabel1} : $result->{serial};
|
||||
next if (defined($self->{option_results}->{filter_device_name}) && $self->{option_results}->{filter_device_name} ne '' &&
|
||||
$name !~ /$self->{option_results}->{filter_device_name}/);
|
||||
|
||||
$self->{devices}->{$instance} = { deviceName => $name, temperatures => {} };
|
||||
}
|
||||
|
||||
my $oid_temperatureTable = '.1.3.6.1.4.1.17534.2.2.1.3.1.1'; # optcTemperatureEntry
|
||||
$snmp_result = $options{snmp}->get_table(oid => $oid_temperatureTable);
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /^$mapping_temperature->{actual}->{oid}\.(\d+).(\d+)$/);
|
||||
my ($deviceIndex, $probeIndex) = ($1, $2);
|
||||
|
||||
next if (!defined($self->{devices}->{$deviceIndex}));
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_temperature, results => $snmp_result, instance => $deviceIndex . '.' . $probeIndex);
|
||||
|
||||
$self->{devices}->{$deviceIndex}->{temperatures}->{$probeIndex} = {
|
||||
probeIndex => $probeIndex,
|
||||
deviceName => $self->{devices}->{$deviceIndex}->{deviceName},
|
||||
actual => $result->{actual},
|
||||
alarmValue => $result->{alarm} =~ /1|true/i ? 1 : 0,
|
||||
alarm => $result->{alarm} =~ /1|true/i ? 'enabled' : 'disabled'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check temperatures.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-device-name>
|
||||
|
||||
Filter devices by name (can be a regexp).
|
||||
|
||||
=item B<--unknown-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be UNKNOWN.
|
||||
You can use the following variables: %{alarm}, %{probeIndex}, %{deviceName}
|
||||
|
||||
=item B<--warning-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be WARNING.
|
||||
You can use the following variables: %{alarm}, %{probeIndex}, %{deviceName}
|
||||
|
||||
=item B<--critical-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (default: '%{alarm} eq "enabled"').
|
||||
You can use the following variables: %{alarm}, %{probeIndex}, %{deviceName}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'probe-temperature'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,77 @@
|
|||
#
|
||||
# Copyright 2023 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::camera::optelecom::snmp::mode::uptime;
|
||||
|
||||
use base qw(snmp_standard::mode::uptime);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check system uptime.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-uptime>
|
||||
|
||||
Warning threshold.
|
||||
|
||||
=item B<--critical-uptime>
|
||||
|
||||
Critical threshold.
|
||||
|
||||
=item B<--add-sysdesc>
|
||||
|
||||
Display system description.
|
||||
|
||||
=item B<--force-oid>
|
||||
|
||||
Can choose your oid (numeric format only).
|
||||
|
||||
=item B<--check-overload>
|
||||
|
||||
Uptime counter limit is 4294967296 and overflow.
|
||||
With that option, we manage the counter going back. But there is a few chance we can miss a reboot.
|
||||
|
||||
=item B<--reboot-window>
|
||||
|
||||
To be used with check-overload option. Time in milliseconds (Default: 5000)
|
||||
You increase the chance of not missing a reboot if you decrease that value.
|
||||
|
||||
=item B<--unit>
|
||||
|
||||
Select the unit for performance data and thresholds. May be 's' for seconds, 'm' for minutes,
|
||||
'h' for hours, 'd' for days, 'w' for weeks. Default is seconds
|
||||
|
||||
=back
|
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# Copyright 2023 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::camera::optelecom::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->{modes} = {
|
||||
'alarms' => 'hardware::devices::camera::optelecom::snmp::mode::alarms',
|
||||
'interfaces' => 'hardware::devices::camera::optelecom::snmp::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'networks' => 'hardware::devices::camera::optelecom::snmp::mode::networks',
|
||||
'temperatures' => 'hardware::devices::camera::optelecom::snmp::mode::temperatures',
|
||||
'uptime' => 'hardware::devices::camera::optelecom::snmp::mode::uptime'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Optelecom camera (TKH Group siqura) in SNMP.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue