Beginning
This commit is contained in:
Quentin Garnier 2014-02-07 12:05:21 +01:00
parent e77249516d
commit ff77edb043
7 changed files with 715 additions and 0 deletions

View File

@ -0,0 +1,78 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::fan;
use strict;
use warnings;
use centreon::plugins::misc;
sub check {
my ($self) = @_;
$self->{components}->{fans} = {name => 'fans', total => 0};
$self->{output}->output_add(long_msg => "Checking fans");
return if ($self->check_exclude('fans'));
my $oid_fanEntry = '.1.3.6.1.4.1.2.3.51.3.1.3.2.1';
my $oid_fanDescr = '.1.3.6.1.4.1.2.3.51.3.1.3.2.1.2';
my $oid_fanSpeed = '.1.3.6.1.4.1.2.3.51.3.1.3.2.1.3';
my $result = $self->{snmp}->get_table(oid => $oid_fanEntry);
return if (scalar(keys %$result) <= 0);
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
next if ($key !~ /^$oid_fanDescr\.(\d+)$/;
my $instance = $1;
my $fan_descr = centreon::plugins::misc($result->{$oid_fanDescr . '.' . $instance});
my $fan_speed = centreon::plugins::misc($result->{$oid_fanSpeed . '.' . $instance});
$self->{components}->{fans}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Fan '%s' speed is %s.",
$fan_descr, $fan_speed));
if ($fan_speed =~ /offline/i) {
$self->{output}->output_add(severity => 'WARNING',
short_msg => sprintf("Fan '%s' is offline", $fan_descr));
} else {
$fan_speed =~ /(\d+)/;
$self->{output}->perfdata_add(label => 'fan_' . $fan_descr, unit => '%',
value => $1,
min => 0, max => 100);
}
}
}
1;

View File

@ -0,0 +1,69 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::globalstatus;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
my %states = (
0 => ['non recoverable', 'CRITICAL'],
2 => ['critical', 'CRITICAL'],
4 => ['non critical', 'WARNING'],
255 => ['nominal', 'OK'],
);
sub check {
my ($self) = @_;
my $oid_systemHealthStat = '.1.3.6.1.4.1.2.3.51.3.1.4.1.0';
my $result = $self->{snmp}->get_leef(oids => [$oid_systemHealthStat], nothing_quit => 1);
$self->{components}->{global} = {name => 'system health', total => 1};
$self->{output}->output_add(long_msg => sprintf("System health status is '%s'.",
${$states{$result->{$oid_systemHealthStat}}}[0]));
if (${$states{$result->{$oid_systemHealthStat}}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$states{$result->{$oid_systemHealthStat}}}[1],
short_msg => sprintf("System health status is '%s'.",
${$states{$result->{$oid_systemHealthStat}}}[0]));
}
$self->{output}->display();
$self->{output}->exit();
}
1;

View File

@ -0,0 +1,97 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::temperature;
use strict;
use warnings;
use centreon::plugins::misc;
sub check {
my ($self) = @_;
$self->{components}->{temperatures} = {name => 'temperatures', total => 0};
$self->{output}->output_add(long_msg => "Checking temperatures");
return if ($self->check_exclude('temperatures'));
my $oid_tempEntry = '.1.3.6.1.4.1.2.3.51.3.1.1.2.1';
my $oid_tempDescr = '.1.3.6.1.4.1.2.3.51.3.1.1.2.1.2';
my $oid_tempReading = '.1.3.6.1.4.1.2.3.51.3.1.1.2.1.3';
my $oid_tempCritLimitHigh = '.1.3.6.1.4.1.2.3.51.3.1.1.2.1.6';
my $oid_tempNonCritLimitHigh = '.1.3.6.1.4.1.2.3.51.3.1.1.2.1.7';
my $oid_tempCritLimitLow = '.1.3.6.1.4.1.2.3.51.3.1.1.2.1.9';
my $oid_tempNonCritLimitLow = '.1.3.6.1.4.1.2.3.51.3.1.1.2.1.10';
my $result = $self->{snmp}->get_table(oid => $oid_tempEntry);
return if (scalar(keys %$result) <= 0);
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
next if ($key !~ /^$oid_tempDescr\.(\d+)$/;
my $instance = $1;
my $temp_descr = centreon::plugins::misc($result->{$oid_tempDescr . '.' . $instance});
my $temp_value = $result->{$oid_tempReading . '.' . $instance};
my $temp_crit_high = $result->{$oid_tempCritLimitHigh . '.' . $instance};
my $temp_warn_high = $result->{$oid_tempNonCritLimitHigh . '.' . $instance};
my $temp_crit_low = $result->{$oid_tempCritLimitLow . '.' . $instance};
my $temp_warn_low = $result->{$oid_tempNonCritLimitLow . '.' . $instance};
my $warn_threshold = '';
$warn_threshold = $temp_warn_low . ':' . $temp_warn_high;
my $crit_threshold = '';
$crit_threshold = $temp_crit_low . ':' . $temp_crit_high;
$self->{perfdata}->threshold_validate(label => 'warning_' . $instance, value => $warn_threshold);
$self->{perfdata}->threshold_validate(label => 'critical_' . $instance, value => $crit_threshold);
my $exit = $self->{perfdata}->threshold_check(value => $temp_value, threshold => [ { label => 'critical_' . $instance, 'exit_litteral' => 'critical' }, { label => 'warning_' . $instance, exit_litteral => 'warning' } ]);
$self->{components}->{temperatures}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' value is %s C.",
$temp_descr, $temp_value));
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Temperature '%s' value is %s C", $temp_descr, $temp_value));
}
$self->{output}->perfdata_add(label => 'temp_' . $temp_descr, unit => 'C',
value => $temp_value,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_' . $instance),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_' . $instance),
);
}
}
1;

View File

@ -0,0 +1,97 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::voltage;
use strict;
use warnings;
use centreon::plugins::misc;
sub check {
my ($self) = @_;
$self->{components}->{voltages} = {name => 'voltages', total => 0};
$self->{output}->output_add(long_msg => "Checking voltages");
return if ($self->check_exclude('voltages'));
my $oid_voltEntry = '.1.3.6.1.4.1.2.3.51.3.1.1.2.1';
my $oid_voltDescr = '.1.3.6.1.4.1.2.3.51.3.1.2.2.1.2';
my $oid_voltReading = '.1.3.6.1.4.1.2.3.51.3.1.2.2.1.3';
my $oid_voltCritLimitHigh = '.1.3.6.1.4.1.2.3.51.3.1.2.2.1.6';
my $oid_voltNonCritLimitHigh = '.1.3.6.1.4.1.2.3.51.3.1.2.2.1.7';
my $oid_voltCritLimitLow = '.1.3.6.1.4.1.2.3.51.3.1.2.2.1.9';
my $oid_voltNonCritLimitLow = '.1.3.6.1.4.1.2.3.51.3.1.2.2.1.10';
my $result = $self->{snmp}->get_table(oid => $oid_voltEntry);
return if (scalar(keys %$result) <= 0);
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
next if ($key !~ /^$oid_voltDescr\.(\d+)$/;
my $instance = $1;
my $volt_descr = centreon::plugins::misc($result->{$oid_voltDescr . '.' . $instance});
my $volt_value = $result->{$oid_voltReading . '.' . $instance};
my $volt_crit_high = $result->{$oid_voltCritLimitHigh . '.' . $instance};
my $volt_warn_high = $result->{$oid_voltNonCritLimitHigh . '.' . $instance};
my $volt_crit_low = $result->{$oid_voltCritLimitLow . '.' . $instance};
my $volt_warn_low = $result->{$oid_voltNonCritLimitLow . '.' . $instance};
my $warn_threshold = '';
$warn_threshold = $volt_warn_low . ':' . $volt_warn_high;
my $crit_threshold = '';
$crit_threshold = $volt_crit_low . ':' . $volt_crit_high;
$self->{perfdata}->threshold_validate(label => 'warning_' . $instance, value => $warn_threshold);
$self->{perfdata}->threshold_validate(label => 'critical_' . $instance, value => $crit_threshold);
my $exit = $self->{perfdata}->threshold_check(value => $temp_value, threshold => [ { label => 'critical_' . $instance, 'exit_litteral' => 'critical' }, { label => 'warning_' . $instance, exit_litteral => 'warning' } ]);
$self->{components}->{temperatures}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Voltage '%s' value is %s.",
$volt_descr, $volt_value));
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Voltage '%s' value is %s", $volt_descr, $volt_value));
}
$self->{output}->perfdata_add(label => 'volt_' . $volt_descr,
value => $volt_value,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_' . $instance),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_' . $instance),
);
}
}
1;

View File

@ -0,0 +1,158 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::ibm::mgmt_cards::imm::snmp::mode::eventlog;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::misc;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-severity:s" => { name => 'filter_severity', default => 'error' },
"filter-message:s" => { name => 'filter_message' },
"memory" => { name => 'memory' },
});
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{memory})) {
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
}
}
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
$self->{hostname} = $self->{snmp}->get_hostname();
$self->{snmp_port} = $self->{snmp}->get_port();
my $datas = {};
if (defined($self->{option_results}->{memory})) {
$self->{statefile_cache}->read(statefile => "cache_imm_" . $self->{hostname} . '_' . $self->{snmp_port} . '_' . $self->{mode});
$self->{output}->output_add(severity => 'OK',
short_msg => "No new problems on system.");
} else {
$self->{output}->output_add(severity => 'OK',
short_msg => "No problems on system.");
}
#### Get OIDS
## Not need to check from an index point (not so much values. and can clear)
my $oid_eventLogEntry = '.1.3.6.1.4.1.2.3.51.3.2.1.1.1';
my $oid_eventLogString = '.1.3.6.1.4.1.2.3.51.3.2.1.1.1.2';
my $oid_eventLogSeverity = '.1.3.6.1.4.1.2.3.51.3.2.1.1.1.3';
my $oid_eventLogDate = '.1.3.6.1.4.1.2.3.51.3.2.1.1.1.4'; # Month/Day/YEAR
my $oid_eventLogTime = '.1.3.6.1.4.1.2.3.51.3.2.1.1.1.5'; # Hour::Min::Sec
my $result = $self->{snmp}->get_table(oid => $oid_eventLogEntry);
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
next if ($key !~ /^$oid_eventLogString\.(\d+)$/;
my $instance = $1;
my $message = centreon::plugins::misc($result->{$oid_eventLogString . '.' . $instance});
my $severity = $result->{$oid_eventLogSeverity . '.' . $instance};
my $date = $result->{$oid_eventLogDate . '.' . $instance};
my $time = $result->{$oid_eventLogTime . '.' . $instance};
my $date_compare = '';
$date =~ {(\d+)/(\d+)/(\d+)};
$date_compare = $3 . $1 . $2;
$time =~ {(\d+)::(\d+)::(\d+)};
$date_compare .= $1 . $2 . $3
}
$self->{output}->output_add(severity => 'OK',
short_msg => sprintf("All %s components [%s] are ok.",
$total_components,
$display_by_component
)
);
if (defined($self->{option_results}->{memory})) {
$self->{statefile_cache}->write(data => $datas);
}
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check eventlogs.
=over 8
=item B<--memory>
Only check new eventlogs.
=item B<--filter-severity>
Filter on severity. (Default: error)
Can be: error, warning, information, other.
=item B<--filter-message>
Filter on event message. (Default: none)
=back
=cut

View File

@ -0,0 +1,151 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::ibm::mgmt_cards::imm::snmp::mode::environment;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::globalstatus;
use hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::temperature;
use hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::voltage;
use hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::fan;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"exclude:s" => { name => 'exclude' },
"component:s" => { name => 'component', default => 'all' },
});
$self->{components} = {};
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub global {
my ($self, %options) = @_;
hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::globalstatus::check($self);
hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::temperature::check($self);
hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::voltage::check($self);
hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::fan::check($self);
}
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
if ($self->{option_results}->{component} eq 'all') {
$self->global();
} elsif ($self->{option_results}->{component} eq 'globalstatus') {
hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::globalstatus::check($self);
} elsif ($self->{option_results}->{component} eq 'temperature') {
hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::temperature::check($self);
} elsif ($self->{option_results}->{component} eq 'voltage') {
hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::voltage::check($self);
} elsif ($self->{option_results}->{component} eq 'fan') {
hardware::server::ibm::mgmt_cards::imm::snmp::mode::components::fan::check($self);
} else {
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
$self->{output}->option_exit();
}
my $total_components = 0;
my $display_by_component = '';
my $display_by_component_append = '';
foreach my $comp (sort(keys %{$self->{components}})) {
# Skipping short msg when no components
next if ($self->{components}->{$comp}->{total} == 0);
$total_components += $self->{components}->{$comp}->{total};
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . ' ' . $self->{components}->{$comp}->{name};
$display_by_component_append = ', ';
}
$self->{output}->output_add(severity => 'OK',
short_msg => sprintf("All %s components [%s] are ok.",
$total_components,
$display_by_component
)
);
$self->{output}->display();
$self->{output}->exit();
}
sub check_exclude {
my ($self, $section) = @_;
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$section(\s|,|$)/) {
$self->{output}->output_add(long_msg => sprintf("Skipping $section section."));
return 1;
}
return 0;
}
1;
__END__
=head1 MODE
Check sensors (Fans, Temperatures, Voltages).
=over 8
=item B<--component>
Which component to check (Default: 'all').
Can be: 'globalstatus', 'fan', 'temperature', 'voltage'.
=item B<--exclude>
Exclude some parts (comma seperated list) (Example: --exclude=temperatures,fans).
=back
=cut

View File

@ -0,0 +1,65 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package network::cisco::asa::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;
# $options->{options} = options object
$self->{version} = '1.0';
%{$self->{modes}} = (
'environment' => 'hardware::server::ibm::mgmt_cards::imm::snmp::mode::environment',
'eventlog' => 'hardware::server::ibm::mgmt_cards::imm::snmp::mode::eventlog',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check IBM IMM Card in SNMP.
=cut