This commit is contained in:
garnier-quentin 2020-05-05 11:39:02 +02:00
parent 1330090b05
commit 78d1f592fc
9 changed files with 806 additions and 0 deletions

View File

@ -0,0 +1,85 @@
#
# Copyright 2020 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 centreon::common::foundry::snmp::mode::components::board;
use strict;
use warnings;
my $mapping_board_status = {
0 => 'moduleEmpty', 2 => 'moduleGoingDown', 3 => 'moduleRejected',
4 => 'moduleBad', 8 => 'moduleConfigured', 9 => 'moduleComingUp',
10 => 'moduleRunning'
};
my $mapping = {
snAgentBrdMainBrdDescription => { oid => '.1.3.6.1.4.1.1991.1.1.2.2.1.1.2' },
snAgentBrdModuleStatus => { oid => '.1.3.6.1.4.1.1991.1.1.2.2.1.1.12', map => $mapping_board_status }
};
sub load {
my ($self) = @_;
push @{$self->{request}},
{ oid => $mapping->{snAgentBrdMainBrdDescription}->{oid} },
{ oid => $mapping->{snAgentBrdModuleStatus}->{oid} };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => 'checking boards');
$self->{components}->{board} = { name => 'boards', total => 0, skip => 0 };
return if ($self->check_filter(section => 'board'));
my $result = {
%{$self->{results}->{ $mapping->{snAgentBrdMainBrdDescription}->{oid} }},
%{$self->{results}->{ $mapping->{snAgentBrdModuleStatus}->{oid} }}
};
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %$result)) {
next if ($oid !~ /^$mapping->{snAgentBrdModuleStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $result, instance => $instance);
next if ($self->check_filter(section => 'board', instance => $instance));
$self->{components}->{board}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"board '%s' status is '%s' [instance: %s].",
$result->{snAgentBrdMainBrdDescription},
$result->{snAgentBrdModuleStatus},
$instance
)
);
my $exit = $self->get_severity(section => 'board', value => $result->{snAgentBrdModuleStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"board '%s' status is '%s'",
$result->{snAgentBrdMainBrdDescription},
$result->{snAgentBrdModuleStatus}
)
);
}
}
}
1;

View File

@ -0,0 +1,77 @@
#
# Copyright 2020 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 centreon::common::foundry::snmp::mode::components::fan;
use strict;
use warnings;
use centreon::common::foundry::snmp::mode::components::resources qw($map_status);
my $mapping = {
snChasFan2Description => { oid => '.1.3.6.1.4.1.1991.1.1.1.3.2.1.3' },
snChasFan2OperStatus => { oid => '.1.3.6.1.4.1.1991.1.1.1.3.2.1.4', map => $map_status }
};
my $oid_snChasFan2Entry = '.1.3.6.1.4.1.1991.1.1.1.3.2.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_snChasFan2Entry,
start => $mapping->{snChasFan2Description}->{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_snChasFan2Entry}})) {
next if ($oid !~ /^$mapping->{snChasFan2OperStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_snChasFan2Entry}, 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]",
$result->{snChasFan2Description}, $result->{snChasFan2OperStatus}, $instance
)
);
my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{snChasFan2OperStatus});
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->{snChasFan2Description}, $result->{snChasFan2OperStatus}
)
);
}
}
}
1;

View File

@ -0,0 +1,79 @@
#
# Copyright 2020 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 centreon::common::foundry::snmp::mode::components::psu;
use strict;
use warnings;
use centreon::common::foundry::snmp::mode::components::resources qw($map_status);
my $mapping = {
snChasPwrSupply2Description => { oid => '.1.3.6.1.4.1.1991.1.1.1.2.2.1.3' },
snChasPwrSupply2OperStatus => { oid => '.1.3.6.1.4.1.1991.1.1.1.2.2.1.4', map => $map_status }
};
my $oid_snChasPwrSupply2Entry = '.1.3.6.1.4.1.1991.1.1.1.2.2.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_snChasPwrSupply2Entry,
start => $mapping->{snChasPwrSupply2Description}->{oid}
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => 'checking power supplies');
$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}->{$oid_snChasPwrSupply2Entry}})) {
next if ($oid !~ /^$mapping->{snChasPwrSupply2OperStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_snChasPwrSupply2Entry}, 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].",
$result->{snChasPwrSupply2Description},
$result->{snChasPwrSupply2OperStatus},
$instance
)
);
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{snChasPwrSupply2OperStatus});
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->{snChasPwrSupply2Description},
$result->{snChasPwrSupply2OperStatus}
)
);
}
}
}
1;

View File

@ -0,0 +1,36 @@
#
# Copyright 2020 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 centreon::common::foundry::snmp::mode::components::resources;
use strict;
use warnings;
use Exporter;
our $map_status;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw($map_status);
$map_status = {
1 => 'other', 2 => 'normal', 3 => 'failure'
};
1;

View File

@ -0,0 +1,105 @@
#
# Copyright 2020 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 centreon::common::foundry::snmp::mode::components::temperature;
use strict;
use warnings;
my $mapping = {
snChasActualTemperature => { oid => '.1.3.6.1.4.1.1991.1.1.1.1.18' },
snChasWarningTemperature => { oid => '.1.3.6.1.4.1.1991.1.1.1.1.19' },
snChasShutdownTemperature => { oid => '.1.3.6.1.4.1.1991.1.1.1.1.20' }
};
my $oid_snChasGen = '.1.3.6.1.4.1.1991.1.1.1.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_snChasGen,
start => $mapping->{snChasActualTemperature}->{oid},
end => $mapping->{snChasShutdownTemperature}->{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'));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_snChasGen}, instance => '0');
my ($name, $instance) = ('chassi', 1);
next if ($self->check_filter(section => 'temperature', instance => $instance));
$self->{components}->{temperature}->{total}++;
$result->{snChasActualTemperature} *= 0.5;
$result->{snChasWarningTemperature} *= 0.5;
$result->{snChasShutdownTemperature} *= 0.5;
$self->{output}->output_add(
long_msg => sprintf(
"temperature '%s' is %s celsius [instance = %s]",
$name, $result->{snChasActualTemperature}, $instance
)
);
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{snChasActualTemperature});
if ($checked == 0) {
my $warn_th = defined($result->{snChasWarningTemperature}) ? $result->{snChasWarningTemperature} : '';
my $crit_th = defined($result->{snChasShutdownTemperature}) ? $result->{snChasShutdownTemperature} : '';
$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->{snChasActualTemperature},
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 => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"temperature '%s' is %s celsius",
$name,
$result->{snChasActualTemperature}
)
);
}
$self->{output}->perfdata_add(
nlabel => 'hardware.temperature.celsius',
unit => 'C',
instances => $name,
value => $result->{snChasActualTemperature},
warning => $warn,
critical => $crit
);
}
1;

View File

@ -0,0 +1,120 @@
#
# Copyright 2020 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 centreon::common::foundry::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 => 'cpu', type => 1, cb_prefix_output => 'prefix_cpu_output', message_multiple => 'All CPUs are ok' }
];
$self->{maps_counters}->{cpu} = [
{ label => 'utilization-5s', nlabel => 'cpu.utilization.5s.percentage', set => {
key_values => [ { name => 'cpu_5s' }, { name => 'display' } ],
output_template => '%.2f %% (5s)',
perfdatas => [
{ value => 'cpu_5s_absolute', template => '%.2f',
unit => '%', min => 0, max => 100, label_extra_instance => 1 }
]
}
},
{ label => 'utilization-1m', nlabel => 'cpu.utilization.1m.percentage', set => {
key_values => [ { name => 'cpu_1m' }, { name => 'display' } ],
output_template => '%.2f %% (1m)',
perfdatas => [
{ value => 'cpu_1m_absolute', template => '%.2f',
unit => '%', min => 0, max => 100, label_extra_instance => 1 }
]
}
},
{ label => 'utilization-5m', nlabel => 'cpu.utilization.5m.percentage', set => {
key_values => [ { name => 'cpu_5m' }, { name => 'display' } ],
output_template => '%.2f %% (5m)',
perfdatas => [
{ value => 'cpu_5m_absolute', template => '%.2f',
unit => '%', min => 0, max => 100, label_extra_instance => 1 }
]
}
}
];
}
sub prefix_cpu_output {
my ($self, %options) = @_;
return "CPU '" . $options{instance_value}->{display} . "' usage: ";
}
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_snAgentCpuUtilPercent = '.1.3.6.1.4.1.1991.1.1.2.11.1.1.5';
my $snmp_result = $options{snmp}->get_table(oid => $oid_snAgentCpuUtilPercent, nothing_quit => 1);
$self->{cpu} = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$oid_snAgentCpuUtilPercent\.(.*?)\.(.*?)\.60/);
my $instance = "slot$1:cpu$2";
$self->{cpu}->{$instance} = {
display => $instance,
cpu_5s => $snmp_result->{ $oid_snAgentCpuUtilPercent . '.' . $1 . '.' . $2 . '.5' },
cpu_1m => $snmp_result->{ $oid_snAgentCpuUtilPercent . '.' . $1 . '.' . $2 . '.60' },
cpu_5m => $snmp_result->{ $oid_snAgentCpuUtilPercent . '.' . $1 . '.' . $2 . '.300' }
};
}
}
1;
__END__
=head1 MODE
Check CPU usage.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'utilization-5s', 'utilization-1m', 'utilization-5m'.
=back
=cut

View File

@ -0,0 +1,119 @@
#
# Copyright 2020 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 centreon::common::foundry::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} = '^(?:board|fan|psu|temperature)$';
$self->{regexp_threshold_numeric_check_section_option} = '^(?:temperature)$';
$self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = {
default => [
['other', 'UNKNOWN'],
['normal', 'OK'],
['failure', 'CRITICAL']
],
board => [
['moduleEmpty', 'OK'],
['moduleGoingDown', 'WARNING'],
['moduleRejected', 'CRITICAL'],
['moduleBad', 'CRITICAL'],
['moduleConfigured', 'OK'],
['moduleComingUp', 'OK'],
['moduleRunning', 'OK']
]
};
$self->{components_path} = 'centreon::common::foundry::snmp::mode::components';
$self->{components_module} = ['board', 'fan', 'psu', 'temperature'];
}
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: 'board', 'fan', 'temperature', 'psu'.
=item B<--filter>
Exclude some parts (comma seperated list) (Example: --filter=fan --filter=psu)
Can also exclude specific instance: --filter=fan,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,[instance,]status,regexp)
It used before default thresholds (order stays).
Example: --threshold-overload='psu,CRITICAL,fail'
=item B<--warning>
Set warning threshold for 'temperature' (syntax: type,regexp,threshold)
Example: --warning='temperature,.*,30'
=item B<--critical>
Set critical threshold for 'temperature' (syntax: type,regexp,threshold)
Example: --critical='temperature,.*,50'
=back
=cut

View File

@ -0,0 +1,133 @@
#
# Copyright 2020 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 centreon::common::foundry::snmp::mode::memory;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_usage_output {
my ($self, %options) = @_;
return sprintf(
'Ram total: %s %s used: %s %s (%.2f%%) free: %s %s (%.2f%%)',
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total_absolute}),
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used_absolute}),
$self->{result_values}->{prct_used_absolute},
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free_absolute}),
$self->{result_values}->{prct_free_absolute}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'memory', type => 0 }
];
$self->{maps_counters}->{memory} = [
{ label => 'usage', nlabel => 'memory.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ value => 'used_absolute', template => '%d', min => 0, max => 'total_absolute',
unit => 'B', cast_int => 1 }
]
}
},
{ label => 'usage-free', display_ok => 0, nlabel => 'memory.free.bytes', set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ value => 'free_absolute', template => '%d', min => 0, max => 'total_absolute',
unit => 'B', cast_int => 1 }
]
}
},
{ label => 'usage-prct', display_ok => 0, nlabel => 'memory.usage.percentage', set => {
key_values => [ { name => 'prct_used' } ],
output_template => 'Ram used: %.2f %%',
perfdatas => [
{ value => 'prct_used_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;
}
my $mapping = {
total => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.12.9.1.1.3' }, # totalMemoryStatsRev
free => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.12.9.1.1.4' } # memoryFreeStatsRev
};
my $oid_memoryStatsEntry = '.1.3.6.1.4.1.20301.2.5.1.2.12.9.1.1';
sub manage_selection {
my ($self, %options) = @_;
my $oid_snAgGblDynMemUtil = '.1.3.6.1.4.1.1991.1.1.2.1.53.0'; # %
my $oid_snAgGblDynMemTotal = '.1.3.6.1.4.1.1991.1.1.2.1.54.0'; # Bytes
my $snmp_result = $options{snmp}->get_leef(
oids => [$oid_snAgGblDynMemUtil, $oid_snAgGblDynMemTotal],
nothing_quit => 1
);
my $used = $snmp_result->{$oid_snAgGblDynMemUtil} * $snmp_result->{$oid_snAgGblDynMemTotal} / 100;
$self->{memory} = {
prct_used => $snmp_result->{$oid_snAgGblDynMemUtil},
prct_free => 100 - $snmp_result->{$oid_snAgGblDynMemUtil},
total => $snmp_result->{$oid_snAgGblDynMemTotal},
used => $used,
free => $snmp_result->{$oid_snAgGblDynMemTotal} - $used
};
}
1;
__END__
=head1 MODE
Check memory usage.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%).
=back
=cut

View File

@ -0,0 +1,52 @@
#
# Copyright 2020 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::ruckus::icx::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} = '0.5';
%{$self->{modes}} = (
'cpu' => 'centreon::common::foundry::snmp::mode::cpu',
'hardware' => 'centreon::common::foundry::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'memory' => 'centreon::common::foundry::snmp::mode::memory'
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Ruckus ICX series in SNMP.
=cut