add allied telesis snmp plugin

This commit is contained in:
garnier-quentin 2019-12-24 14:39:14 +01:00
parent 813f5b7ea3
commit b3c128a071
8 changed files with 823 additions and 0 deletions

View File

@ -0,0 +1,123 @@
#
# Copyright 2019 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 network::allied::snmp::mode::components::fan;
use strict;
use warnings;
my $map_status = {
1 => 'failed', 2 => 'good',
};
my $mapping = {
atEnvMonv2FanDescription => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.1.1.4' },
atEnvMonv2FanCurrentSpeed => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.1.1.5' },
atEnvMonv2FanLowerThreshold => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.1.1.6' },
atEnvMonv2FanStatus => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.1.1.7', map => $map_status },
};
my $oid_atEnvMonv2FanEntry = '.1.3.6.1.4.1.207.8.4.4.3.12.1.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_atEnvMonv2FanEntry, start => $mapping->{atEnvMonv2FanDescription}->{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}->{$oid_atEnvMonv2FanEntry}})) {
next if ($oid !~ /^$mapping->{atEnvMonv2FanStatus}->{oid}\.(\d+)\.(\d+)\.(\d+)$/);
my ($stack_id, $board_index, $fan_index) = ($1, $2, $3);
my $instance = $stack_id . '.' . $board_index . '.' . $fan_index;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_atEnvMonv2FanEntry}, instance => $instance);
next if ($self->check_filter(section => 'fan', instance => $instance));
$self->{components}->{fan}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"fan '%s' status is %s [instance: %s, speed: %s, stack: %s, board: %s]",
$result->{atEnvMonv2FanDescription},
$result->{atEnvMonv2FanStatus},
$instance,
$result->{atEnvMonv2FanCurrentSpeed},
$stack_id,
$board_index
)
);
my $exit = $self->get_severity(section => 'fan', value => $result->{atEnvMonv2FanStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"fan '%s' status is %s",
$result->{atEnvMonv2FanDescription},
$result->{atEnvMonv2FanStatus}
)
);
}
next if (!defined($result->{atEnvMonv2FanCurrentSpeed}));
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{atEnvMonv2FanCurrentSpeed});
if ($checked == 0) {
my $warn_th = '';
my $crit_th = $result->{atEnvMonv2FanLowerThreshold} . ':';
$self->{perfdata}->threshold_validate(label => 'warning-fan-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-fan-instance-' . $instance, value => $crit_th);
$exit = $self->{perfdata}->threshold_check(
value => $result->{atEnvMonv2FanCurrentSpeed},
threshold => [
{ label => 'critical-fan-instance-' . $instance, exit_litteral => 'critical' },
{ label => 'warning-fan-instance-' . $instance, exit_litteral => 'warning' }
]
);
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-fan-instance-' . $instance);
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-fan-instance-' . $instance)
}
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit2,
short_msg => sprintf(
"fan '%s' speed is %s rpm",
$result->{atEnvMonv2FanDescription},
$result->{atEnvMonv2FanCurrentSpeed}
)
);
}
$self->{output}->perfdata_add(
nlabel => 'hardware.fan.speed.rpm', unit => 'rpm',
instances => ['stack=' . $stack_id, 'board=' . $board_index, 'description=' . $result->{atEnvMonv2FanDescription}],
value => $result->{atEnvMonv2FanCurrentSpeed},
warning => $warn,
critical => $crit, min => 0
);
}
}
1;

View File

@ -0,0 +1,86 @@
#
# Copyright 2019 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 network::allied::snmp::mode::components::psu;
use strict;
use warnings;
my $map_status = {
1 => 'failed', 2 => 'good', 3 => 'notPowered'
};
my $mapping = {
atEnvMonv2PsbSensorDescription => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.4.2.1.5' },
atEnvMonv2PsbSensorStatus => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.4.2.1.6', map => $map_status },
};
my $oid_atEnvMonv2PsbSensorEntry = '.1.3.6.1.4.1.207.8.4.4.3.12.4.2.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_atEnvMonv2PsbSensorEntry,
start => $mapping->{atEnvMonv2PsbSensorDescription}->{oid},
end => $mapping->{atEnvMonv2PsbSensorStatus}->{oid}
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "checking power supplies");
$self->{components}->{psu} = { name => 'psus', total => 0, skip => 0 };
return if ($self->check_filter(section => 'psu'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_atEnvMonv2PsbSensorEntry}})) {
next if ($oid !~ /^$mapping->{atEnvMonv2PsbSensorStatus}->{oid}\.(\d+)\.(\d+)\.(\d+)$/);
my ($stack_id, $board_index, $psu_index) = ($1, $2, $3);
my $instance = $stack_id . '.' . $board_index . '.' . $psu_index;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_atEnvMonv2PsbSensorEntry}, 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' status is %s [instance: %s, stack: %s, board: %s]",
$result->{atEnvMonv2PsbSensorDescription},
$result->{atEnvMonv2PsbSensorStatus},
$instance,
$stack_id,
$board_index
)
);
my $exit = $self->get_severity(section => 'psu', value => $result->{atEnvMonv2PsbSensorStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"power supply '%s' status is %s",
$result->{atEnvMonv2PsbSensorDescription},
$result->{atEnvMonv2PsbSensorStatus}
)
);
}
}
}
1;

View File

@ -0,0 +1,123 @@
#
# Copyright 2019 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 network::allied::snmp::mode::components::temperature;
use strict;
use warnings;
my $map_status = {
1 => 'outOfRange', 2 => 'inRange',
};
my $mapping = {
atEnvMonv2TemperatureDescription => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.3.1.4' },
atEnvMonv2TemperatureCurrent => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.3.1.5' },
atEnvMonv2TemperatureUpperThreshold => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.3.1.6' },
atEnvMonv2TemperatureStatus => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.3.1.7', map => $map_status },
};
my $oid_atEnvMonv2TemperatureEntry = '.1.3.6.1.4.1.207.8.4.4.3.12.3.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_atEnvMonv2TemperatureEntry, start => $mapping->{atEnvMonv2TemperatureDescription}->{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_atEnvMonv2TemperatureEntry}})) {
next if ($oid !~ /^$mapping->{atEnvMonv2TemperatureStatus}->{oid}\.(\d+)\.(\d+)\.(\d+)$/);
my ($stack_id, $board_index, $temp_index) = ($1, $2, $3);
my $instance = $stack_id . '.' . $board_index . '.' . $temp_index;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_atEnvMonv2TemperatureEntry}, 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 [instance: %s, speed: %s, stack: %s, board: %s]",
$result->{atEnvMonv2TemperatureDescription},
$result->{atEnvMonv2TemperatureStatus},
$instance,
$result->{atEnvMonv2TemperatureCurrent},
$stack_id,
$board_index
)
);
my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $result->{atEnvMonv2TemperatureStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"temperature '%s' status is %s",
$result->{atEnvMonv2TemperatureDescription},
$result->{atEnvMonv2TemperatureStatus}
)
);
}
next if (!defined($result->{atEnvMonv2TemperatureCurrent}));
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{atEnvMonv2TemperatureCurrent});
if ($checked == 0) {
my $warn_th = '';
my $crit_th = ':' . $result->{atEnvMonv2TemperatureUpperThreshold};
$self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th);
$exit = $self->{perfdata}->threshold_check(
value => $result->{atEnvMonv2TemperatureCurrent},
threshold => [
{ label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' },
{ label => 'warning-temperature-instance-' . $instance, exit_litteral => 'warning' }
]
);
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance);
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance)
}
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit2,
short_msg => sprintf(
"temperture '%s' is %s C",
$result->{atEnvMonv2TemperatureDescription},
$result->{atEnvMonv2TemperatureCurrent}
)
);
}
$self->{output}->perfdata_add(
nlabel => 'hardware.temperature.celsius', unit => 'C',
instances => ['stack=' . $stack_id, 'board=' . $board_index, 'description=' . $result->{atEnvMonv2TemperatureDescription}],
value => $result->{atEnvMonv2TemperatureCurrent},
warning => $warn,
critical => $crit
);
}
}
1;

View File

@ -0,0 +1,124 @@
#
# Copyright 2019 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 network::allied::snmp::mode::components::voltage;
use strict;
use warnings;
my $map_status = {
1 => 'outOfRange', 2 => 'inRange',
};
my $mapping = {
atEnvMonv2VoltageDescription => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.2.1.4' },
atEnvMonv2VoltageCurrent => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.2.1.5' },
atEnvMonv2VoltageUpperThreshold => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.2.1.6' },
atEnvMonv2VoltageLowerThreshold => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.2.1.7' },
atEnvMonv2VoltageStatus => { oid => '.1.3.6.1.4.1.207.8.4.4.3.12.2.1.8', map => $map_status },
};
my $oid_atEnvMonv2VoltageEntry = '.1.3.6.1.4.1.207.8.4.4.3.12.2.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_atEnvMonv2VoltageEntry, start => $mapping->{atEnvMonv2VoltageDescription}->{oid} };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "checking voltages");
$self->{components}->{voltage} = { name => 'voltages', total => 0, skip => 0 };
return if ($self->check_filter(section => 'voltage'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_atEnvMonv2VoltageEntry}})) {
next if ($oid !~ /^$mapping->{atEnvMonv2VoltageStatus}->{oid}\.(\d+)\.(\d+)\.(\d+)$/);
my ($stack_id, $board_index, $voltage_index) = ($1, $2, $3);
my $instance = $stack_id . '.' . $board_index . '.' . $voltage_index;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_atEnvMonv2VoltageEntry}, instance => $instance);
next if ($self->check_filter(section => 'voltage', instance => $instance));
$self->{components}->{voltage}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"voltage '%s' status is %s [instance: %s, value: %s mV, stack: %s, board: %s]",
$result->{atEnvMonv2VoltageDescription},
$result->{atEnvMonv2VoltageStatus},
$instance,
$result->{atEnvMonv2VoltageCurrent},
$stack_id,
$board_index
)
);
my $exit = $self->get_severity(label => 'default', section => 'voltage', value => $result->{atEnvMonv2VoltageStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"voltage '%s' status is %s",
$result->{atEnvMonv2VoltageDescription},
$result->{atEnvMonv2VoltageStatus}
)
);
}
next if (!defined($result->{atEnvMonv2VoltageCurrent}));
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{atEnvMonv2VoltageCurrent});
if ($checked == 0) {
my $warn_th = '';
my $crit_th = $result->{atEnvMonv2VoltageLowerThreshold} . ':' . $result->{atEnvMonv2VoltageUpperThreshold};
$self->{perfdata}->threshold_validate(label => 'warning-voltage-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-voltage-instance-' . $instance, value => $crit_th);
$exit = $self->{perfdata}->threshold_check(
value => $result->{atEnvMonv2VoltageCurrent},
threshold => [
{ label => 'critical-voltage-instance-' . $instance, exit_litteral => 'critical' },
{ label => 'warning-voltage-instance-' . $instance, exit_litteral => 'warning' }
]
);
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-voltage-instance-' . $instance);
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-voltage-instance-' . $instance)
}
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit2,
short_msg => sprintf(
"voltage '%s' is %s mv",
$result->{atEnvMonv2VoltageDescription},
$result->{atEnvMonv2VoltageCurrent}
)
);
}
$self->{output}->perfdata_add(
nlabel => 'hardware.voltage.millivolt', unit => 'mV',
instances => ['stack=' . $stack_id, 'board=' . $board_index, 'index=' . $voltage_index, 'description=' . $result->{atEnvMonv2VoltageDescription}],
value => $result->{atEnvMonv2VoltageCurrent},
warning => $warn,
critical => $crit
);
}
}
1;

View File

@ -0,0 +1,109 @@
#
# Copyright 2019 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 network::allied::snmp::mode::cpu;
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_cpu_avg_output', message_separator => ' ', skipped_code => { -10 => 1 } },
];
$self->{maps_counters}->{global} = [
{ label => 'average-1m', nlabel => 'cpu.utilization.1m.percentage', set => {
key_values => [ { name => 'average_1m' } ],
output_template => '%.2f %% (1m)',
perfdatas => [
{ value => 'average_1m_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
{ label => 'average-5m', nlabel => 'cpu.utilization.5m.percentage', set => {
key_values => [ { name => 'average_5m' } ],
output_template => '%.2f %% (5m)',
perfdatas => [
{ value => 'average_5m_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
];
}
sub prefix_cpu_avg_output {
my ($self, %options) = @_;
return 'CPU(s) average usage is ';
}
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 manage_selection {
my ($self, %options) = @_;
my $oid_cpuUtilisationAvgLast5Minutes = '.1.3.6.1.4.1.207.8.4.4.3.3.7.0';
my $oid_cpuUtilisationAvgLastMinute = '.1.3.6.1.4.1.207.8.4.4.3.3.3.0';
my $snmp_result = $options{snmp}->get_leef(
oids => [
$oid_cpuUtilisationAvgLast5Minutes, $oid_cpuUtilisationAvgLastMinute
],
nothing_quit => 1
);
$self->{global} = {
average_1m => $snmp_result->{$oid_cpuUtilisationAvgLastMinute},
average_5m => $snmp_result->{$oid_cpuUtilisationAvgLast5Minutes}
};
}
1;
__END__
=head1 MODE
Check cpu usage.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'average-1m', 'average-5m'.
=back
=cut

View File

@ -0,0 +1,117 @@
#
# Copyright 2019 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 network::allied::snmp::mode::hardware;
use base qw(centreon::plugins::templates::hardware);
use strict;
use warnings;
sub set_system {
my ($self, %options) = @_;
$self->{regexp_threshold_overload_check_section_option} = '^(?:fan|voltage|temperature|psu)$';
$self->{regexp_threshold_numeric_check_section_option} = '^(?:fan|voltage|temperature)$';
$self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = {
psu => [
['good', 'OK'],
['failed', 'CRITICAL'],
['notPowered', 'WARNING'],
],
fan => [
['good', 'OK'],
['failed', 'CRITICAL'],
],
default => [
['inRange', 'OK'],
['outOfRange', 'CRITICAL'],
],
};
$self->{components_path} = 'network::allied::snmp::mode::components';
$self->{components_module} = ['fan', 'psu', 'temperature', 'voltage'];
}
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, no_absent => 1, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
});
return $self;
}
1;
__END__
=head1 MODE
Check hardware.
=over 8
=item B<--component>
Which component to check (Default: '.*').
Can be: 'voltage', 'fan', 'temperature', 'psu'.
=item B<--filter>
Exclude some parts (comma seperated list) (Example: --filter=psu)
Can also exclude specific instance: --filter=fan,1.1.1
=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,status,regexp)
It used before default thresholds (order stays).
Example: --threshold-overload='fan,WARNING,failed'
=item B<--warning>
Set warning threshold for 'temperatures', 'fan', 'voltage' (syntax: section,[instance,]status,regexp)
Example: --warning='temperature,.*,30' --warning='fan,.*,1000'
=item B<--critical>
Set critical threshold for 'temperatures', 'fan', 'voltage' (syntax: section,[instance,]status,regexp)
Example: --critical='temperature,.*,40'
=back
=cut

View File

@ -0,0 +1,89 @@
#
# Copyright 2019 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 network::allied::snmp::mode::memory;
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, message_separator => ' - ' },
];
$self->{maps_counters}->{global} = [
{ label => 'usage', nlabel => 'memory.usage.percentage', set => {
key_values => [ { name => 'used_prct' } ],
output_template => 'memory used: %.2f %%',
perfdatas => [
{ value => 'used_prct_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
];
}
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 manage_selection {
my ($self, %options) = @_;
my $oid_freeMemory = '.1.3.6.1.4.1.207.8.4.4.3.7.1.0';
my $snmp_result = $options{snmp}->get_leef(
oids => [ $oid_freeMemory ],
nothing_quit => 1
);
$self->{global} = {
used_prct => 100 - $snmp_result->{$oid_freeMemory}
};
}
1;
__END__
=head1 MODE
Check memory usage.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'usage' (%).
=back
=cut

View File

@ -0,0 +1,52 @@
#
# Copyright 2019 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 network::allied::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}} = (
'cpu' => 'network::allied::snmp::mode::cpu',
'hardware' => 'network::allied::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'memory' => 'network::allied::snmp::mode::memory',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Allied Telesis equipments in SNMP.
=cut