mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
Merge branch 'master' of http://git.centreon.com/centreon-plugins
This commit is contained in:
commit
004b4f7d0c
@ -194,7 +194,7 @@ Set hba uid to check (not set, means 'all').
|
|||||||
|
|
||||||
Set how much path must be connected (Can be multiple).
|
Set how much path must be connected (Can be multiple).
|
||||||
Syntax: [WARNING],[CRITICAL],filter_uid,filter_server
|
Syntax: [WARNING],[CRITICAL],filter_uid,filter_server
|
||||||
Example: ,,@0:1,.* - Means all server must have at least two paths connected.
|
Example: ,@0:1,.*,.* - Means all server must have at least two paths connected.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
@ -61,12 +61,6 @@ sub check_options {
|
|||||||
$self->SUPER::init(%options);
|
$self->SUPER::init(%options);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_logged {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sub check_port {
|
sub check_port {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@ use warnings;
|
|||||||
use centreon::common::emc::navisphere::mode::spcomponents::fan;
|
use centreon::common::emc::navisphere::mode::spcomponents::fan;
|
||||||
use centreon::common::emc::navisphere::mode::spcomponents::lcc;
|
use centreon::common::emc::navisphere::mode::spcomponents::lcc;
|
||||||
use centreon::common::emc::navisphere::mode::spcomponents::psu;
|
use centreon::common::emc::navisphere::mode::spcomponents::psu;
|
||||||
use centreon::common::emc::navisphere::spcomponents::battery;
|
use centreon::common::emc::navisphere::mode::spcomponents::battery;
|
||||||
use centreon::common::emc::navisphere::spcomponents::memory;
|
use centreon::common::emc::navisphere::mode::spcomponents::memory;
|
||||||
use centreon::common::emc::navisphere::spcomponents::cpu;
|
use centreon::common::emc::navisphere::mode::spcomponents::cpu;
|
||||||
use centreon::common::emc::navisphere::spcomponents::iomodule;
|
use centreon::common::emc::navisphere::mode::spcomponents::iomodule;
|
||||||
use centreon::common::emc::navisphere::spcomponents::cable;
|
use centreon::common::emc::navisphere::mode::spcomponents::cable;
|
||||||
use centreon::common::emc::navisphere::spcomponents::sp;
|
use centreon::common::emc::navisphere::mode::spcomponents::sp;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::battery;
|
package centreon::common::emc::navisphere::mode::spcomponents::battery;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::cable;
|
package centreon::common::emc::navisphere::mode::spcomponents::cable;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::cpu;
|
package centreon::common::emc::navisphere::mode::spcomponents::cpu;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::fan;
|
package centreon::common::emc::navisphere::mode::spcomponents::fan;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::iomodule;
|
package centreon::common::emc::navisphere::mode::spcomponents::iomodule;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::lcc;
|
package centreon::common::emc::navisphere::mode::spcomponents::lcc;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::memory;
|
package centreon::common::emc::navisphere::mode::spcomponents::memory;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::psu;
|
package centreon::common::emc::navisphere::mode::spcomponents::psu;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package storage::emc::clariion::mode::spcomponents::sp;
|
package centreon::common::emc::navisphere::mode::spcomponents::sp;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -159,6 +159,8 @@ sub run {
|
|||||||
$self->check_fan();
|
$self->check_fan();
|
||||||
} elsif ($self->{option_results}->{component} eq 'psu') {
|
} elsif ($self->{option_results}->{component} eq 'psu') {
|
||||||
$self->check_psu();
|
$self->check_psu();
|
||||||
|
} elsif ($self->{option_results}->{component} eq 'temperature') {
|
||||||
|
$self->check_temperature();
|
||||||
} else {
|
} else {
|
||||||
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
|
77
centreon/common/violin/snmp/mode/components/ca.pm
Normal file
77
centreon/common/violin/snmp/mode/components/ca.pm
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 centreon::common::violin::snmp::mode::components::ca;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_chassisSystemLedAlarm = '.1.3.6.1.4.1.35897.1.2.2.3.17.1.7';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_chassisSystemLedAlarm };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking chassis alarm");
|
||||||
|
$self->{components}->{ca} = {name => 'chassis alarm', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'ca'));
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_chassisSystemLedAlarm}}) {
|
||||||
|
$oid =~ /^$oid_chassisSystemLedAlarm\.(.*)$/;
|
||||||
|
my ($dummy, $array_name) = $self->convert_index(value => $1);
|
||||||
|
my $instance = $array_name;
|
||||||
|
my $ca_state = $self->{results}->{$oid_chassisSystemLedAlarm}->{$oid};
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'ca', instance => $instance));
|
||||||
|
|
||||||
|
$self->{components}->{ca}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Chassis alarm '%s' is %s.",
|
||||||
|
$instance, $ca_state));
|
||||||
|
my $exit = $self->get_severity(section => 'ca', value => $ca_state);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Chassis alarm '%s' is %s", $instance, $ca_state));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
79
centreon/common/violin/snmp/mode/components/fan.pm
Normal file
79
centreon/common/violin/snmp/mode/components/fan.pm
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 centreon::common::violin::snmp::mode::components::fan;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_arrayFanEntry_speed = '.1.3.6.1.4.1.35897.1.2.2.3.18.1.3';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_arrayFanEntry_speed };
|
||||||
|
}
|
||||||
|
|
||||||
|
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_exclude(section => 'fan'));
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_arrayFanEntry_speed}}) {
|
||||||
|
$oid =~ /^$oid_arrayFanEntry_speed\.(.*)$/;
|
||||||
|
my ($dummy, $array_name, $fan_name) = $self->convert_index(value => $1);
|
||||||
|
my $instance = $array_name . '-' . $fan_name;
|
||||||
|
my $fan_state = $self->{results}->{$oid_arrayFanEntry_speed}->{$oid};
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'fan', instance => $instance));
|
||||||
|
next if ($fan_state =~ /Absent/i &&
|
||||||
|
$self->absent_problem(section => 'fan', instance => $instance));
|
||||||
|
|
||||||
|
$self->{components}->{fan}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Fan '%s' state is %s.",
|
||||||
|
$instance, $fan_state));
|
||||||
|
my $exit = $self->get_severity(section => 'fan', value => $fan_state);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Fan '%s' state is %s", $instance, $fan_state));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
84
centreon/common/violin/snmp/mode/components/gfc.pm
Normal file
84
centreon/common/violin/snmp/mode/components/gfc.pm
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 centreon::common::violin::snmp::mode::components::gfc;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_globalTargetFcEntry = '.1.3.6.1.4.1.35897.1.2.1.10.1';
|
||||||
|
my $oid_wwn = '.1.3.6.1.4.1.35897.1.2.1.10.1.3';
|
||||||
|
my $oid_enable = '.1.3.6.1.4.1.35897.1.2.1.10.1.4';
|
||||||
|
my $oid_portState = '.1.3.6.1.4.1.35897.1.2.1.10.1.8';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_globalTargetFcEntry };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking global fc");
|
||||||
|
$self->{components}->{gfc} = {name => 'global fc', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'gfc'));
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_globalTargetFcEntry}}) {
|
||||||
|
next if ($oid !~ /^$oid_wwn\.(.*)$/);
|
||||||
|
my $wwn = $self->{results}->{$oid_globalTargetFcEntry}->{$oid};
|
||||||
|
my $enable = $self->{results}->{$oid_globalTargetFcEntry}->{$oid_enable . '.' .$1};
|
||||||
|
my $state = $self->{results}->{$oid_globalTargetFcEntry}->{$oid_portState . '.' .$1};
|
||||||
|
|
||||||
|
if ($enable == 2) {
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping instance '$wwn' (not enable)"));
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
next if ($self->check_exclude(section => 'gfc', instance => $wwn));
|
||||||
|
|
||||||
|
$self->{components}->{gfc}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Global FC '%s' is %s.",
|
||||||
|
$wwn, $state));
|
||||||
|
my $exit = $self->get_severity(section => 'gfc', value => $state);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Global FC '%s' is %s", $wwn, $state));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
84
centreon/common/violin/snmp/mode/components/lfc.pm
Normal file
84
centreon/common/violin/snmp/mode/components/lfc.pm
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 centreon::common::violin::snmp::mode::components::lfc;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_localTargetFcEntry = '.1.3.6.1.4.1.35897.1.2.1.6.1';
|
||||||
|
my $oid_wwn = '.1.3.6.1.4.1.35897.1.2.1.6.1.2';
|
||||||
|
my $oid_enable = '.1.3.6.1.4.1.35897.1.2.1.6.1.3';
|
||||||
|
my $oid_portState = '.1.3.6.1.4.1.35897.1.2.1.6.1.7';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_localTargetFcEntry };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking local fc");
|
||||||
|
$self->{components}->{lfc} = {name => 'local fc', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'lfc'));
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_localTargetFcEntry}}) {
|
||||||
|
next if ($oid !~ /^$oid_wwn\.(.*)$/);
|
||||||
|
my $wwn = $self->{results}->{$oid_localTargetFcEntry}->{$oid};
|
||||||
|
my $enable = $self->{results}->{$oid_localTargetFcEntry}->{$oid_enable . '.' .$1};
|
||||||
|
my $state = $self->{results}->{$oid_localTargetFcEntry}->{$oid_portState . '.' .$1};
|
||||||
|
|
||||||
|
if ($enable == 2) {
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping instance '$wwn' (not enable)"));
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
next if ($self->check_exclude(section => 'lfc', instance => $wwn));
|
||||||
|
|
||||||
|
$self->{components}->{lfc}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Local FC '%s' is %s.",
|
||||||
|
$wwn, $state));
|
||||||
|
my $exit = $self->get_severity(section => 'lfc', value => $state);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Local FC '%s' is %s", $wwn, $state));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
94
centreon/common/violin/snmp/mode/components/psu.pm
Normal file
94
centreon/common/violin/snmp/mode/components/psu.pm
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 centreon::common::violin::snmp::mode::components::psu;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_chassisSystemPowerPSUA = '.1.3.6.1.4.1.35897.1.2.2.3.17.1.17';
|
||||||
|
my $oid_chassisSystemPowerPSUB = '.1.3.6.1.4.1.35897.1.2.2.3.17.1.18';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_chassisSystemPowerPSUA };
|
||||||
|
push @{$options{request}}, { oid => $oid_chassisSystemPowerPSUB };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub psu {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $oid = $options{oid};
|
||||||
|
|
||||||
|
$options{oid} =~ /^$options{oid_short}\.(.*)$/;
|
||||||
|
my ($dummy, $array_name) = $self->convert_index(value => $1);
|
||||||
|
my $instance = $array_name . '-' . $options{extra_instance};
|
||||||
|
|
||||||
|
my $psu_state = $options{value};
|
||||||
|
|
||||||
|
return if ($self->check_exclude(section => 'psu', instance => $instance));
|
||||||
|
return if ($psu_state =~ /Absent/i &&
|
||||||
|
$self->absent_problem(section => 'psu', instance => $instance));
|
||||||
|
|
||||||
|
$self->{components}->{psu}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Power Supply '%s' status is %s.",
|
||||||
|
$instance, $psu_state));
|
||||||
|
my $exit = $self->get_severity(section => 'psu', value => $psu_state);
|
||||||
|
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", $instance, $psu_state));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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_exclude(section => 'psu'));
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_chassisSystemPowerPSUA}}) {
|
||||||
|
psu($self, oid => $oid, oid_short => $oid_chassisSystemPowerPSUA, value => $self->{results}->{$oid_chassisSystemPowerPSUA}->{$oid},
|
||||||
|
extra_instance => 'A');
|
||||||
|
}
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_chassisSystemPowerPSUB}}) {
|
||||||
|
psu($self, oid => $oid, oid_short => $oid_chassisSystemPowerPSUB, value => $self->{results}->{$oid_chassisSystemPowerPSUB}->{$oid},
|
||||||
|
extra_instance => 'B');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
101
centreon/common/violin/snmp/mode/components/temperature.pm
Normal file
101
centreon/common/violin/snmp/mode/components/temperature.pm
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 centreon::common::violin::snmp::mode::components::temperature;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_chassisSystemTempAmbient = '.1.3.6.1.4.1.35897.1.2.2.3.17.1.21';
|
||||||
|
my $oid_chassisSystemTempController = '.1.3.6.1.4.1.35897.1.2.2.3.17.1.21';
|
||||||
|
my $oid_arrayVimmEntry_temp = '.1.3.6.1.4.1.35897.1.2.2.3.16.1.12';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_arrayVimmEntry_temp };
|
||||||
|
push @{$options{request}}, { oid => $oid_chassisSystemTempAmbient };
|
||||||
|
push @{$options{request}}, { oid => $oid_chassisSystemTempController };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub temperature {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $oid = $options{oid};
|
||||||
|
|
||||||
|
$options{oid} =~ /^$options{oid_short}\.(.*)$/;
|
||||||
|
my ($dummy, $array_name, $extra_name) = $self->convert_index(value => $1);
|
||||||
|
my $instance = $array_name . '-' . (defined($extra_name) ? $extra_name : $options{extra_instance});
|
||||||
|
|
||||||
|
my $temperature = $options{value};
|
||||||
|
|
||||||
|
return if ($self->check_exclude(section => 'temperature', instance => $instance));
|
||||||
|
|
||||||
|
$self->{components}->{temperature}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' is %s degree centigrade.",
|
||||||
|
$instance, $temperature));
|
||||||
|
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $temperature);
|
||||||
|
$self->{output}->perfdata_add(label => 'temp_' . $instance, unit => 'C',
|
||||||
|
value => $temperature,
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $instance, $temperature));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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_exclude(section => 'temperature'));
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_chassisSystemTempAmbient}}) {
|
||||||
|
temperature($self, oid => $oid, oid_short => $oid_chassisSystemTempAmbient, value => $self->{results}->{$oid_chassisSystemTempAmbient}->{$oid},
|
||||||
|
extra_instance => 'ambient');
|
||||||
|
}
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_chassisSystemTempController}}) {
|
||||||
|
temperature($self, oid => $oid, oid_short => $oid_chassisSystemTempController, value => $self->{results}->{$oid_chassisSystemTempController}->{$oid},
|
||||||
|
extra_instance => 'controller');
|
||||||
|
}
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_arrayVimmEntry_temp}}) {
|
||||||
|
temperature($self, oid => $oid, oid_short => $oid_arrayVimmEntry_temp, value => $self->{results}->{$oid_arrayVimmEntry_temp}->{$oid});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
92
centreon/common/violin/snmp/mode/components/vimm.pm
Normal file
92
centreon/common/violin/snmp/mode/components/vimm.pm
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 centreon::common::violin::snmp::mode::components::vimm;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_arrayVimmEntry_present = '.1.3.6.1.4.1.35897.1.2.2.3.16.1.4';
|
||||||
|
my $oid_arrayVimmEntry_failed = '.1.3.6.1.4.1.35897.1.2.2.3.16.1.10';
|
||||||
|
|
||||||
|
my %map_vimm_state = (
|
||||||
|
1 => 'failed',
|
||||||
|
2 => 'not failed',
|
||||||
|
);
|
||||||
|
|
||||||
|
my %map_vimm_present = (
|
||||||
|
1 => 'present',
|
||||||
|
2 => 'absent',
|
||||||
|
);
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_arrayVimmEntry_present };
|
||||||
|
push @{$options{request}}, { oid => $oid_arrayVimmEntry_failed };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking vimms");
|
||||||
|
$self->{components}->{vimm} = {name => 'vimms', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'vimm'));
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_arrayVimmEntry_present}}) {
|
||||||
|
next if ($oid !~ /^$oid_arrayVimmEntry_present\.(.*)$/);
|
||||||
|
my $state = $self->{results}->{$oid_arrayVimmEntry_failed}->{$oid_arrayVimmEntry_failed . '.' . $1};
|
||||||
|
my $present = $self->{results}->{$oid_arrayVimmEntry_present}->{$oid};
|
||||||
|
my ($dummy, $array_name, $vimm_name) = $self->convert_index(value => $1);
|
||||||
|
my $instance = $array_name . '-' . $vimm_name;
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'vimm', instance => $instance));
|
||||||
|
next if ($map_vimm_present{$present} =~ /Absent/i &&
|
||||||
|
$self->absent_problem(section => 'vimm', instance => $instance));
|
||||||
|
|
||||||
|
$self->{components}->{vimm}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Vimm '%s' is %s.",
|
||||||
|
$instance, $map_vimm_state{$state}));
|
||||||
|
my $exit = $self->get_severity(section => 'vimm', value => $map_vimm_state{$state});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Vimm '%s' is %s", $instance, $map_vimm_state{$state}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
358
centreon/common/violin/snmp/mode/hardware.pm
Normal file
358
centreon/common/violin/snmp/mode/hardware.pm
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 centreon::common::violin::snmp::mode::hardware;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
|
my $thresholds = {
|
||||||
|
vimm => [
|
||||||
|
['not failed', 'OK'],
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
ca => [
|
||||||
|
['ON', 'CRITICAL'],
|
||||||
|
['OFF', 'OK'],
|
||||||
|
],
|
||||||
|
psu => [
|
||||||
|
['OFF', 'CRITICAL'],
|
||||||
|
['Absent', 'OK'],
|
||||||
|
['ON', 'OK'],
|
||||||
|
],
|
||||||
|
fan => [
|
||||||
|
['OFF', 'CRITICAL'],
|
||||||
|
['Absent', 'OK'],
|
||||||
|
['Low', 'OK'],
|
||||||
|
['Medium', 'OK'],
|
||||||
|
['High', 'WARNING'],
|
||||||
|
],
|
||||||
|
gfc => [
|
||||||
|
['Online', 'OK'],
|
||||||
|
['Unconfigured', 'OK'],
|
||||||
|
['Unknown', 'UNKNOWN'],
|
||||||
|
['Not\s*Supported', 'WARNING'],
|
||||||
|
['Dead', 'CRITICAL'],
|
||||||
|
['Lost', 'CRITICAL'],
|
||||||
|
['Failover\s*Failed', 'CRITICAL'],
|
||||||
|
['Failover', 'WARNING'],
|
||||||
|
],
|
||||||
|
lfc => [
|
||||||
|
['Online', 'OK'],
|
||||||
|
['Unconfigured', 'OK'],
|
||||||
|
['Unknown', 'UNKNOWN'],
|
||||||
|
['Not\s*Supported', 'WARNING'],
|
||||||
|
['Dead', 'CRITICAL'],
|
||||||
|
['Lost', 'CRITICAL'],
|
||||||
|
['Failover\s*Failed', 'CRITICAL'],
|
||||||
|
['Failover', 'WARNING'],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
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 => '.*' },
|
||||||
|
"absent-problem:s" => { name => 'absent' },
|
||||||
|
"no-component:s" => { name => 'no_component' },
|
||||||
|
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||||
|
"warning:s@" => { name => 'warning' },
|
||||||
|
"critical:s@" => { name => 'critical' },
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->{components} = {};
|
||||||
|
$self->{no_components} = undef;
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{no_component})) {
|
||||||
|
if ($self->{option_results}->{no_component} ne '') {
|
||||||
|
$self->{no_components} = $self->{option_results}->{no_component};
|
||||||
|
} else {
|
||||||
|
$self->{no_components} = 'critical';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{overload_th} = {};
|
||||||
|
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||||
|
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my ($section, $status, $filter) = ($1, $2, $3);
|
||||||
|
if ($self->{output}->is_litteral_status(status => $status) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
|
||||||
|
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{numeric_threshold} = {};
|
||||||
|
foreach my $option (('warning', 'critical')) {
|
||||||
|
foreach my $val (@{$self->{option_results}->{$option}}) {
|
||||||
|
if ($val !~ /^(.*?),(.*)$/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my ($section, $regexp, $value) = ('temperature', $1, $2);
|
||||||
|
my $position = 0;
|
||||||
|
if (defined($self->{numeric_threshold}->{$section})) {
|
||||||
|
$position = scalar(@{$self->{numeric_threshold}->{$section}});
|
||||||
|
}
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section}));
|
||||||
|
push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
# $options{snmp} = snmp object
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
|
my $snmp_request = [];
|
||||||
|
my @components = ('ca', 'psu', 'fan', 'vimm', 'temperature', 'gfc', 'lfc');
|
||||||
|
foreach (@components) {
|
||||||
|
if (/$self->{option_results}->{component}/) {
|
||||||
|
my $mod_name = "centreon::common::violin::snmp::mode::components::$_";
|
||||||
|
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name,
|
||||||
|
error_msg => "Cannot load module '$mod_name'.");
|
||||||
|
my $func = $mod_name->can('load');
|
||||||
|
$func->(request => $snmp_request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(@{$snmp_request}) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => $snmp_request);
|
||||||
|
|
||||||
|
foreach (@components) {
|
||||||
|
if (/$self->{option_results}->{component}/) {
|
||||||
|
my $mod_name = "centreon::common::violin::snmp::mode::components::$_";
|
||||||
|
my $func = $mod_name->can('check');
|
||||||
|
$func->($self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 && $self->{components}->{$comp}->{skip} == 0);
|
||||||
|
$total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||||
|
my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||||
|
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name};
|
||||||
|
$display_by_component_append = ', ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => sprintf("All %s components are ok [%s].",
|
||||||
|
$total_components,
|
||||||
|
$display_by_component)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||||
|
$self->{output}->output_add(severity => $self->{no_components},
|
||||||
|
short_msg => 'No components are checked.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_exclude {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($options{instance})) {
|
||||||
|
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) {
|
||||||
|
$self->{components}->{$options{section}}->{skip}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance."));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) {
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section."));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub absent_problem {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{absent}) &&
|
||||||
|
$self->{option_results}->{absent} =~ /(^|\s|,)($options{section}(\s*,|$)|${options{section}}[^,]*#\Q$options{instance}\E#)/) {
|
||||||
|
$self->{output}->output_add(severity => 'CRITICAL',
|
||||||
|
short_msg => sprintf("Component '%s' instance '%s' is not present",
|
||||||
|
$options{section}, $options{instance}));
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance (not present)"));
|
||||||
|
$self->{components}->{$options{section}}->{skip}++;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_severity_numeric {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'OK'; # default
|
||||||
|
my $thresholds = { warning => undef, critical => undef };
|
||||||
|
|
||||||
|
|
||||||
|
if (defined($self->{numeric_threshold}->{$options{section}})) {
|
||||||
|
my $exits = [];
|
||||||
|
foreach (@{$self->{numeric_threshold}->{$options{section}}}) {
|
||||||
|
if ($options{instance} =~ /$_->{regexp}/) {
|
||||||
|
push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]);
|
||||||
|
$thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($status, $thresholds->{warning}, $thresholds->{critical});
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_severity {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'UNKNOWN'; # default
|
||||||
|
|
||||||
|
if (defined($self->{overload_th}->{$options{section}})) {
|
||||||
|
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||||
|
if ($options{value} =~ /$_->{filter}/i) {
|
||||||
|
$status = $_->{status};
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (@{$thresholds->{$options{section}}}) {
|
||||||
|
if ($options{value} =~ /$$_[0]/i) {
|
||||||
|
$status = $$_[1];
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub convert_index {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my @results = ();
|
||||||
|
my $separator = 32;
|
||||||
|
my $result = '';
|
||||||
|
foreach (split /\./, $options{value}) {
|
||||||
|
if ($_ < $separator) {
|
||||||
|
push @results, $result;
|
||||||
|
$result = '';
|
||||||
|
} else {
|
||||||
|
$result .= chr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
push @results, $result;
|
||||||
|
return @results;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check components (Fans, Power Supplies, Temperatures, Chassis alarm, vimm, global fc, local fc).
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--component>
|
||||||
|
|
||||||
|
Which component to check (Default: '.*').
|
||||||
|
Can be: 'psu', 'fan', 'ca', 'vimm', 'lfc', 'gfc', 'temperature'.
|
||||||
|
|
||||||
|
=item B<--exclude>
|
||||||
|
|
||||||
|
Exclude some parts (comma seperated list) (Example: --exclude=psu)
|
||||||
|
Can also exclude specific instance: --exclude='psu#41239F00647-A#'
|
||||||
|
|
||||||
|
=item B<--absent-problem>
|
||||||
|
|
||||||
|
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
||||||
|
Can be specific or global: --absent-problem=fan#41239F00647-fan02#
|
||||||
|
|
||||||
|
=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='gfc,CRITICAL,^(?!(Online)$)'
|
||||||
|
|
||||||
|
=item B<--warning>
|
||||||
|
|
||||||
|
Set warning threshold for temperatures (syntax: regexp,treshold)
|
||||||
|
Example: --warning='41239F00647-vimm46,20' --warning='41239F00647-vimm5.*,30'
|
||||||
|
|
||||||
|
=item B<--critical>
|
||||||
|
|
||||||
|
Set critical threshold for temperatures (syntax: regexp,treshold)
|
||||||
|
Example: --critical='41239F00647-vimm46,25' --warning='41239F00647-vimm5.*,35'
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
@ -56,6 +56,16 @@ sub new {
|
|||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_sanity {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
Getopt::Long::Configure('no_pass_through');
|
||||||
|
$SIG{__WARN__} = sub {
|
||||||
|
$self->{output}->add_option_msg(short_msg => $_[0]);
|
||||||
|
$self->{output}->option_exit(nolabel => 1);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
sub set_output {
|
sub set_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
@ -71,12 +71,12 @@ sub get_perfdata_for_output {
|
|||||||
if (defined($options{total})) {
|
if (defined($options{total})) {
|
||||||
$perf_value{start} = $perf_value{start} * $options{total} / 100 if ($perf_value{infinite_neg} == 0);
|
$perf_value{start} = $perf_value{start} * $options{total} / 100 if ($perf_value{infinite_neg} == 0);
|
||||||
$perf_value{end} = $perf_value{end} * $options{total} / 100 if ($perf_value{infinite_pos} == 0);
|
$perf_value{end} = $perf_value{end} * $options{total} / 100 if ($perf_value{infinite_pos} == 0);
|
||||||
$perf_value{start} = sprintf("%.2f", $perf_value{start}) if ($perf_value{infinite_neg} == 0 && !defined($options{cast_int}));
|
$perf_value{start} = sprintf("%.2f", $perf_value{start}) if ($perf_value{infinite_neg} == 0 && (!defined($options{cast_int}) || $options{cast_int} != 1));
|
||||||
$perf_value{end} = sprintf("%.2f", $perf_value{end}) if ($perf_value{infinite_pos} == 0 && !defined($options{cast_int}));
|
$perf_value{end} = sprintf("%.2f", $perf_value{end}) if ($perf_value{infinite_pos} == 0 && (!defined($options{cast_int}) || $options{cast_int} != 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
$perf_value{start} = sprintf("%d", $perf_value{start}) if ($perf_value{infinite_neg} == 0 && defined($options{cast_int}));
|
$perf_value{start} = int($perf_value{start}) if ($perf_value{infinite_neg} == 0 && defined($options{cast_int}) && $options{cast_int} == 1);
|
||||||
$perf_value{end} = sprintf("%d", $perf_value{end}) if ($perf_value{infinite_pos} == 0 && defined($options{cast_int}));
|
$perf_value{end} = int($perf_value{end}) if ($perf_value{infinite_pos} == 0 && defined($options{cast_int}) && $options{cast_int} == 1);
|
||||||
|
|
||||||
my $perf_output = ($perf_value{arobase} == 1 ? "@" : "") .
|
my $perf_output = ($perf_value{arobase} == 1 ? "@" : "") .
|
||||||
(($perf_value{infinite_neg} == 0) ? $perf_value{start} : "~") .
|
(($perf_value{infinite_neg} == 0) ? $perf_value{start} : "~") .
|
||||||
|
@ -57,6 +57,7 @@ sub new {
|
|||||||
'custommode:s' => { name => 'custommode_name' },
|
'custommode:s' => { name => 'custommode_name' },
|
||||||
'list-custommode' => { name => 'list_custommode' },
|
'list-custommode' => { name => 'list_custommode' },
|
||||||
'multiple' => { name => 'multiple' },
|
'multiple' => { name => 'multiple' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
@ -98,6 +99,9 @@ sub init {
|
|||||||
if (defined($self->{list_custommode})) {
|
if (defined($self->{list_custommode})) {
|
||||||
$self->list_custommode();
|
$self->list_custommode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
@ -121,7 +125,7 @@ sub init {
|
|||||||
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
||||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
||||||
error_msg => "Cannot load module --dyn-mode.");
|
error_msg => "Cannot load module --dyn-mode.");
|
||||||
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
|
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
|
||||||
} else {
|
} else {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
@ -250,17 +254,25 @@ __END__
|
|||||||
|
|
||||||
Choose a mode.
|
Choose a mode.
|
||||||
|
|
||||||
|
=item B<--dyn-mode>
|
||||||
|
|
||||||
|
Specify a mode with the path (separated by '::').
|
||||||
|
|
||||||
=item B<--list-mode>
|
=item B<--list-mode>
|
||||||
|
|
||||||
List available modes.
|
List available modes.
|
||||||
|
|
||||||
|
=item B<--mode-version>
|
||||||
|
|
||||||
|
Check minimal version of mode. If not, unknown error.
|
||||||
|
|
||||||
=item B<--version>
|
=item B<--version>
|
||||||
|
|
||||||
Display plugin version.
|
Display plugin version.
|
||||||
|
|
||||||
=item B<--dyn-mode>
|
=item B<--sanity-options>
|
||||||
|
|
||||||
Specify a mode with the path (separated by '::').
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=item B<--custommode>
|
=item B<--custommode>
|
||||||
|
|
||||||
|
@ -50,10 +50,11 @@ sub new {
|
|||||||
|
|
||||||
$self->{options}->add_options(
|
$self->{options}->add_options(
|
||||||
arguments => {
|
arguments => {
|
||||||
'mode:s' => { name => 'mode' },
|
'mode:s' => { name => 'mode_name' },
|
||||||
'dyn-mode:s' => { name => 'dynmode_name' },
|
'dyn-mode:s' => { name => 'dynmode_name' },
|
||||||
'list-mode' => { name => 'list_mode' },
|
'list-mode' => { name => 'list_mode' },
|
||||||
'mode-version:s' => { name => 'mode_version' },
|
'mode-version:s' => { name => 'mode_version' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
@ -61,9 +62,10 @@ sub new {
|
|||||||
$self->{default} = undef;
|
$self->{default} = undef;
|
||||||
|
|
||||||
$self->{options}->parse_options();
|
$self->{options}->parse_options();
|
||||||
$self->{mode_name} = $self->{options}->get_option(argument => 'mode');
|
$self->{option_results} = $self->{options}->get_options();
|
||||||
$self->{list_mode} = $self->{options}->get_option(argument => 'list_mode');
|
foreach (keys %{$self->{option_results}}) {
|
||||||
$self->{mode_version} = $self->{options}->get_option(argument => 'mode_version');
|
$self->{$_} = $self->{option_results}->{$_};
|
||||||
|
}
|
||||||
$self->{options}->clean();
|
$self->{options}->clean();
|
||||||
|
|
||||||
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
||||||
@ -87,6 +89,9 @@ sub init {
|
|||||||
if (defined($self->{list_mode})) {
|
if (defined($self->{list_mode})) {
|
||||||
$self->list_mode();
|
$self->list_mode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
@ -100,7 +105,7 @@ sub init {
|
|||||||
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
||||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
||||||
error_msg => "Cannot load module --dyn-mode.");
|
error_msg => "Cannot load module --dyn-mode.");
|
||||||
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
|
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
|
||||||
} else {
|
} else {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
@ -210,6 +215,10 @@ Check minimal version of mode. If not, unknown error.
|
|||||||
|
|
||||||
Display plugin version.
|
Display plugin version.
|
||||||
|
|
||||||
|
=item B<--sanity-options>
|
||||||
|
|
||||||
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
@ -52,10 +52,11 @@ sub new {
|
|||||||
|
|
||||||
$self->{options}->add_options(
|
$self->{options}->add_options(
|
||||||
arguments => {
|
arguments => {
|
||||||
'mode:s' => { name => 'mode' },
|
'mode:s' => { name => 'mode_name' },
|
||||||
'dyn-mode:s' => { name => 'dynmode_name' },
|
'dyn-mode:s' => { name => 'dynmode_name' },
|
||||||
'list-mode' => { name => 'list_mode' },
|
'list-mode' => { name => 'list_mode' },
|
||||||
'mode-version:s' => { name => 'mode_version' },
|
'mode-version:s' => { name => 'mode_version' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
@ -63,9 +64,10 @@ sub new {
|
|||||||
$self->{default} = undef;
|
$self->{default} = undef;
|
||||||
|
|
||||||
$self->{options}->parse_options();
|
$self->{options}->parse_options();
|
||||||
$self->{mode_name} = $self->{options}->get_option(argument => 'mode');
|
$self->{option_results} = $self->{options}->get_options();
|
||||||
$self->{list_mode} = $self->{options}->get_option(argument => 'list_mode');
|
foreach (keys %{$self->{option_results}}) {
|
||||||
$self->{mode_version} = $self->{options}->get_option(argument => 'mode_version');
|
$self->{$_} = $self->{option_results}->{$_};
|
||||||
|
}
|
||||||
$self->{options}->clean();
|
$self->{options}->clean();
|
||||||
|
|
||||||
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
||||||
@ -89,6 +91,9 @@ sub init {
|
|||||||
if (defined($self->{list_mode})) {
|
if (defined($self->{list_mode})) {
|
||||||
$self->list_mode();
|
$self->list_mode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
@ -105,7 +110,7 @@ sub init {
|
|||||||
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
||||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
||||||
error_msg => "Cannot load module --dyn-mode.");
|
error_msg => "Cannot load module --dyn-mode.");
|
||||||
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
|
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
|
||||||
} else {
|
} else {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
@ -218,6 +223,10 @@ Check minimal version of mode. If not, unknown error.
|
|||||||
|
|
||||||
Display plugin version.
|
Display plugin version.
|
||||||
|
|
||||||
|
=item B<--sanity-options>
|
||||||
|
|
||||||
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
@ -58,6 +58,7 @@ sub new {
|
|||||||
'sqlmode:s' => { name => 'sqlmode_name', default => 'dbi' },
|
'sqlmode:s' => { name => 'sqlmode_name', default => 'dbi' },
|
||||||
'list-sqlmode' => { name => 'list_sqlmode' },
|
'list-sqlmode' => { name => 'list_sqlmode' },
|
||||||
'multiple' => { name => 'multiple' },
|
'multiple' => { name => 'multiple' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
@ -99,6 +100,9 @@ sub init {
|
|||||||
if (defined($self->{list_sqlmode})) {
|
if (defined($self->{list_sqlmode})) {
|
||||||
$self->list_sqlmode();
|
$self->list_sqlmode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
@ -122,7 +126,7 @@ sub init {
|
|||||||
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
||||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
||||||
error_msg => "Cannot load module --dyn-mode.");
|
error_msg => "Cannot load module --dyn-mode.");
|
||||||
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
|
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
|
||||||
} else {
|
} else {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
@ -256,21 +260,25 @@ __END__
|
|||||||
|
|
||||||
Choose a mode.
|
Choose a mode.
|
||||||
|
|
||||||
|
=item B<--dyn-mode>
|
||||||
|
|
||||||
|
Specify a mode with the path (separated by '::').
|
||||||
|
|
||||||
=item B<--list-mode>
|
=item B<--list-mode>
|
||||||
|
|
||||||
List available modes.
|
List available modes.
|
||||||
|
|
||||||
=item B<--version>
|
|
||||||
|
|
||||||
Display plugin version.
|
|
||||||
|
|
||||||
=item B<--mode-version>
|
=item B<--mode-version>
|
||||||
|
|
||||||
Check minimal version of mode. If not, unknown error.
|
Check minimal version of mode. If not, unknown error.
|
||||||
|
|
||||||
=item B<--dyn-mode>
|
=item B<--version>
|
||||||
|
|
||||||
Specify a mode with the path (separated by '::').
|
Display plugin version.
|
||||||
|
|
||||||
|
=item B<--sanity-options>
|
||||||
|
|
||||||
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=item B<--sqlmode>
|
=item B<--sqlmode>
|
||||||
|
|
||||||
|
@ -52,10 +52,11 @@ sub new {
|
|||||||
|
|
||||||
$self->{options}->add_options(
|
$self->{options}->add_options(
|
||||||
arguments => {
|
arguments => {
|
||||||
'mode:s' => { name => 'mode' },
|
'mode:s' => { name => 'mode_name' },
|
||||||
'dyn-mode:s' => { name => 'dynmode_name' },
|
'dyn-mode:s' => { name => 'dynmode_name' },
|
||||||
'list-mode' => { name => 'list_mode' },
|
'list-mode' => { name => 'list_mode' },
|
||||||
'mode-version:s' => { name => 'mode_version' },
|
'mode-version:s' => { name => 'mode_version' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
@ -63,9 +64,10 @@ sub new {
|
|||||||
$self->{default} = undef;
|
$self->{default} = undef;
|
||||||
|
|
||||||
$self->{options}->parse_options();
|
$self->{options}->parse_options();
|
||||||
$self->{mode_name} = $self->{options}->get_option(argument => 'mode');
|
$self->{option_results} = $self->{options}->get_options();
|
||||||
$self->{list_mode} = $self->{options}->get_option(argument => 'list_mode');
|
foreach (keys %{$self->{option_results}}) {
|
||||||
$self->{mode_version} = $self->{options}->get_option(argument => 'mode_version');
|
$self->{$_} = $self->{option_results}->{$_};
|
||||||
|
}
|
||||||
$self->{options}->clean();
|
$self->{options}->clean();
|
||||||
|
|
||||||
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
||||||
@ -89,6 +91,9 @@ sub init {
|
|||||||
if (defined($self->{list_mode})) {
|
if (defined($self->{list_mode})) {
|
||||||
$self->list_mode();
|
$self->list_mode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
@ -105,7 +110,7 @@ sub init {
|
|||||||
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
|
||||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
|
||||||
error_msg => "Cannot load module --dyn-mode.");
|
error_msg => "Cannot load module --dyn-mode.");
|
||||||
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
|
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
|
||||||
} else {
|
} else {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
@ -206,13 +211,17 @@ Specify a mode with the path (separated by '::').
|
|||||||
|
|
||||||
List available modes.
|
List available modes.
|
||||||
|
|
||||||
|
=item B<--mode-version>
|
||||||
|
|
||||||
|
Check minimal version of mode. If not, unknown error.
|
||||||
|
|
||||||
=item B<--version>
|
=item B<--version>
|
||||||
|
|
||||||
Display plugin version.
|
Display plugin version.
|
||||||
|
|
||||||
=item B<--mode-version>
|
=item B<--sanity-options>
|
||||||
|
|
||||||
Check minimal version of mode. If not, unknown error.
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
@ -765,6 +765,31 @@ sub get_port {
|
|||||||
return $self->{snmp_params}->{RemotePort};
|
return $self->{snmp_params}->{RemotePort};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub map_instance {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $results = {};
|
||||||
|
foreach my $name (keys %{$options{mapping}}) {
|
||||||
|
my $entry = $options{mapping}->{$name}->{oid} . '.' . $options{instance};
|
||||||
|
if (defined($options{results}->{$entry})) {
|
||||||
|
$results->{$name} = $options{results}->{$entry};
|
||||||
|
} elsif (defined($options{results}->{$options{mapping}->{$name}->{oid}}->{$entry})) {
|
||||||
|
$results->{$name} = $options{results}->{$options{mapping}->{$name}->{oid}}->{$entry};
|
||||||
|
} elsif (defined($options{mapping}->{$name}->{location}) &&
|
||||||
|
defined($options{results}->{$options{mapping}->{$name}->{location}}->{$entry})) {
|
||||||
|
$results->{$name} = $options{results}->{$options{mapping}->{$name}->{location}}->{$entry};
|
||||||
|
} else {
|
||||||
|
$results->{$name} = defined($options{default}) ? $options{default} : undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined($options{mapping}->{$name}->{map})) {
|
||||||
|
$results->{$name} = defined($options{mapping}->{$name}->{map}->{$results->{$name}}) ? $options{mapping}->{$name}->{map}->{$results->{$name}} : (defined($options{default}) ? $options{default} : 'unknown');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
sub oid_lex_sort {
|
sub oid_lex_sort {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
|
@ -181,6 +181,7 @@ sub perfdata {
|
|||||||
|
|
||||||
my $warn = defined($self->{threshold_warn}) ? $self->{threshold_warn} : 'warning-' . $self->{label};
|
my $warn = defined($self->{threshold_warn}) ? $self->{threshold_warn} : 'warning-' . $self->{label};
|
||||||
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{label};
|
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{label};
|
||||||
|
my $cast_int = defined($options{cast_int}) ? $options{cast_int} : 0;
|
||||||
|
|
||||||
foreach my $perf (@{$self->{perfdatas}}) {
|
foreach my $perf (@{$self->{perfdatas}}) {
|
||||||
my ($label, $extra_label, $min, $max, $th_total) = ($self->{label}, '');
|
my ($label, $extra_label, $min, $max, $th_total) = ($self->{label}, '');
|
||||||
@ -209,9 +210,9 @@ sub perfdata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => $label . $extra_label, unit => $perf->{unit},
|
$self->{output}->perfdata_add(label => $label . $extra_label, unit => $perf->{unit},
|
||||||
value => sprintf($template, $self->{result_values}->{$perf->{value}}),
|
value => $cast_int == 1 ? int($self->{result_values}->{$perf->{value}}) : sprintf($template, $self->{result_values}->{$perf->{value}}),
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => $warn, total => $th_total),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => $warn, total => $th_total, cast_int => $cast_int),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => $crit, total => $th_total),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => $crit, total => $th_total, cast_int => $cast_int),
|
||||||
min => $min, max => $max);
|
min => $min, max => $max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,18 +104,18 @@ sub run {
|
|||||||
my ($use_value, $use_unit) = $self->{perfdata}->change_bytes(value => $use);
|
my ($use_value, $use_unit) = $self->{perfdata}->change_bytes(value => $use);
|
||||||
$self->{output}->output_add(long_msg => sprintf("DB '%s' Size: %s Used: %.2f %s (%.2f%%) Free: %s (%.2f%%)", $database, $size_brut, $use_value, $use_unit, $percent_use, $free_brut, $percent_free));
|
$self->{output}->output_add(long_msg => sprintf("DB '%s' Size: %s Used: %.2f %s (%.2f%%) Free: %s (%.2f%%)", $database, $size_brut, $use_value, $use_unit, $percent_use, $free_brut, $percent_free));
|
||||||
if (defined($self->{option_results}->{free})) {
|
if (defined($self->{option_results}->{free})) {
|
||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $percent_free, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit_code = $self->{perfdata}->threshold_check(value => $percent_free, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
if (!$self->{output}->is_status(value => $exit_code, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit_code, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf("DB '%s' Size: %s Free: %s (%.2f%%)", $database, $size_brut, $free_brut, $percent_use));
|
short_msg => sprintf("DB '%s' Size: %s Free: %s (%.2f%%)", $database, $size_brut, $free_brut, $percent_use));
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(label => sprintf("db_%s_free",$database),
|
$self->{output}->perfdata_add(label => sprintf("db_%s_free",$database),
|
||||||
unit => 'B',
|
unit => 'B',
|
||||||
value => sprintf("%d",$free),
|
value => int($free),
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $size, cast_int => 1),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $size, cast_int => 1),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $size, cast_int => 1),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $size, cast_int => 1),
|
||||||
min => 0,
|
min => 0,
|
||||||
max => sprintf("%d",$size));
|
max => int($size));
|
||||||
} else {
|
} else {
|
||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $percent_use, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit_code = $self->{perfdata}->threshold_check(value => $percent_use, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
if (!$self->{output}->is_status(value => $exit_code, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit_code, compare => 'ok', litteral => 1)) {
|
||||||
@ -124,11 +124,11 @@ sub run {
|
|||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(label => sprintf("db_%s_used",$database),
|
$self->{output}->perfdata_add(label => sprintf("db_%s_used",$database),
|
||||||
unit => 'B',
|
unit => 'B',
|
||||||
value => sprintf("%d",$use),
|
value => int($use),
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $size, cast_int => 1),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $size, cast_int => 1),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $size, cast_int => 1),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $size, cast_int => 1),
|
||||||
min => 0,
|
min => 0,
|
||||||
max => sprintf("%d",$size));
|
max => int($size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,13 +92,13 @@ sub run {
|
|||||||
next if (defined($self->{option_results}->{filter}) &&
|
next if (defined($self->{option_results}->{filter}) &&
|
||||||
$$row[0] !~ /$self->{option_results}->{filter}/);
|
$$row[0] !~ /$self->{option_results}->{filter}/);
|
||||||
|
|
||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $$row[1], threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit_code = $self->{perfdata}->threshold_check(value => $$row[1], threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
|
||||||
my ($value, $value_unit) = $self->{perfdata}->change_bytes(value => $$row[1]);
|
my ($value, $value_unit) = $self->{perfdata}->change_bytes(value => $$row[1]);
|
||||||
$self->{output}->output_add(long_msg => sprintf("DB '" . $$row[0] . "' size: %.3f%s", $value, $value_unit));
|
$self->{output}->output_add(long_msg => sprintf("DB '" . $$row[0] . "' size: %s%s", $value, $value_unit));
|
||||||
if (!$self->{output}->is_status(value => $exit_code, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit_code, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf("DB '" . $$row[0] . "' size: %.3f%s", $value, $value_unit));
|
short_msg => sprintf("DB '" . $$row[0] . "' size: %s%s", $value, $value_unit));
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(label => $$row[0] . '_size',
|
$self->{output}->perfdata_add(label => $$row[0] . '_size',
|
||||||
value => $$row[1],
|
value => $$row[1],
|
||||||
|
@ -114,9 +114,9 @@ sub run {
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $value, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit_code = $self->{perfdata}->threshold_check(value => $value, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf("Total requests = %d.", $value));
|
short_msg => sprintf("Total requests = %s", $value));
|
||||||
$self->{output}->perfdata_add(label => 'total_requests',
|
$self->{output}->perfdata_add(label => 'total_requests',
|
||||||
value => $value,
|
value => $value,
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
|
@ -89,7 +89,7 @@ sub run {
|
|||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $result, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit_code = $self->{perfdata}->threshold_check(value => $result, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
my ($value, $value_unit) = $self->{perfdata}->change_bytes(value => $result);
|
my ($value, $value_unit) = $self->{perfdata}->change_bytes(value => $result);
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf('Tablespace "%s" size is %d %s',$self->{option_results}->{tablespace}, $value, $value_unit));
|
short_msg => sprintf('Tablespace "%s" size is %s %s',$self->{option_results}->{tablespace}, $value, $value_unit));
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => $self->{option_results}->{tablespace},
|
$self->{output}->perfdata_add(label => $self->{option_results}->{tablespace},
|
||||||
value => $result,
|
value => $result,
|
||||||
|
@ -67,6 +67,10 @@ sub check_options {
|
|||||||
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
|
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => 'dbname', value => $self->{option_results}->{dbname})) eq 'postgres') {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Invalid db.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -85,6 +89,9 @@ sub run {
|
|||||||
if ($1 eq 'postgres') {
|
if ($1 eq 'postgres') {
|
||||||
$self->{output}->add_option_msg(short_msg => "Cannot use system 'postgres' database ; you must use a real database.");
|
$self->{output}->add_option_msg(short_msg => "Cannot use system 'postgres' database ; you must use a real database.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
|
} elsif ($1 eq '') {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Database must be specified.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need to specify database argument.");
|
$self->{output}->add_option_msg(short_msg => "Need to specify database argument.");
|
||||||
|
@ -62,6 +62,7 @@ sub new {
|
|||||||
{
|
{
|
||||||
"warning:s" => { name => 'warning' },
|
"warning:s" => { name => 'warning' },
|
||||||
"critical:s" => { name => 'critical' },
|
"critical:s" => { name => 'critical' },
|
||||||
|
"filter:s" => { name => 'filter' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
@ -132,6 +133,11 @@ sub run {
|
|||||||
$self->{output}->output_add(long_msg => "Marker supply '$descr': no level but some space remaining.");
|
$self->{output}->output_add(long_msg => "Marker supply '$descr': no level but some space remaining.");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
if (defined($self->{option_results}->{filter}) && $self->{option_results}->{filter} ne '' &&
|
||||||
|
$instance !~ /$self->{option_results}->{filter}/) {
|
||||||
|
$self->{output}->output_add(long_msg => "Skipping marker supply '$descr' (instance: $instance): filter.");
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
my $prct_value = $current_value;
|
my $prct_value = $current_value;
|
||||||
if ($unit_managed{$unit} == 1) {
|
if ($unit_managed{$unit} == 1) {
|
||||||
@ -139,7 +145,7 @@ sub run {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $prct_value, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit = $self->{perfdata}->threshold_check(value => $prct_value, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
$self->{output}->output_add(long_msg => sprintf("Marker supply '%s': %.2f %%", $descr, $prct_value));
|
$self->{output}->output_add(long_msg => sprintf("Marker supply '%s': %.2f %% [instance: '%s']", $descr, $prct_value, $hrDeviceIndex . '.' . $prtMarkerSuppliesIndex));
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Marker supply '%s': %.2f %%", $descr, $prct_value));
|
short_msg => sprintf("Marker supply '%s': %.2f %%", $descr, $prct_value));
|
||||||
@ -149,7 +155,7 @@ sub run {
|
|||||||
if ($result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance} != 0) {
|
if ($result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance} != 0) {
|
||||||
$label = $result2->{$oid_prtMarkerColorantValue . '.' . $hrDeviceIndex . '.' . $result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance}};
|
$label = $result2->{$oid_prtMarkerColorantValue . '.' . $hrDeviceIndex . '.' . $result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance}};
|
||||||
if (defined($perf_label->{$label})) {
|
if (defined($perf_label->{$label})) {
|
||||||
$label .= '#' . $hrDeviceIndex . '#' . $result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance};
|
$label .= '#' . $hrDeviceIndex . '#' . $prtMarkerSuppliesIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$perf_label->{$label} = 1;
|
$perf_label->{$label} = 1;
|
||||||
@ -183,6 +189,10 @@ Threshold warning in percent.
|
|||||||
|
|
||||||
Threshold critical in percent.
|
Threshold critical in percent.
|
||||||
|
|
||||||
|
=item B<--filter>
|
||||||
|
|
||||||
|
Filter maker supply instance.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
132
hardware/sensors/sensorip/snmp/mode/components/humidity.pm
Normal file
132
hardware/sensors/sensorip/snmp/mode/components/humidity.pm
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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::sensors::sensorip::snmp::mode::components::humidity;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_hum_status = (
|
||||||
|
1 => 'noStatus',
|
||||||
|
2 => 'normal',
|
||||||
|
3 => 'highWarning',
|
||||||
|
4 => 'highCritical',
|
||||||
|
5 => 'lowWarning',
|
||||||
|
6 => 'lowCritical',
|
||||||
|
7 => 'sensorError',
|
||||||
|
);
|
||||||
|
my %map_hum_online = (
|
||||||
|
1 => 'online',
|
||||||
|
2 => 'offline',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
sensorProbeHumidityDescription => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.17.1.1' },
|
||||||
|
sensorProbeHumidityPercent => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.17.1.3' },
|
||||||
|
sensorProbeHumidityStatus => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.17.1.4', map => \%map_hum_status },
|
||||||
|
sensorProbeHumidityOnline => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.17.1.5', map => \%map_hum_online },
|
||||||
|
sensorProbeHumidityHighWarning => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.17.1.7' },
|
||||||
|
sensorProbeHumidityHighCritical => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.17.1.8' },
|
||||||
|
sensorProbeHumidityLowWarning => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.17.1.9' },
|
||||||
|
sensorProbeHumidityLowCritical => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.17.1.10' },
|
||||||
|
};
|
||||||
|
my $oid_sensorProbeHumidityEntry = '.1.3.6.1.4.1.3854.1.2.2.1.17.1';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_sensorProbeHumidityEntry, end => $mapping->{sensorProbeHumidityLowCritical}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking humidity");
|
||||||
|
$self->{components}->{humidity} = {name => 'humidity', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'humidity'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_sensorProbeHumidityEntry}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{sensorProbeHumidityPercent}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_sensorProbeHumidityEntry}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'humidity', instance => $instance));
|
||||||
|
if ($result->{sensorProbeHumidityOnline} =~ /Offline/i) {
|
||||||
|
$self->absent_problem(section => 'humidity', instance => $instance);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{components}->{humidity}->{total}++;
|
||||||
|
if ($result->{sensorProbeHumidityStatus} =~ /sensorError/i) {
|
||||||
|
my $exit = $self->get_severity(section => 'humidity', value => $result->{sensorProbeHumidityStatus});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Humidity sensor '%s' status is '%s'", $result->{sensorProbeHumidityDescription}, $result->{sensorProbeTempStatus}));
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Humidity sensor '%s' status is '%s' [instance = %s, value = %s %%]",
|
||||||
|
$result->{sensorProbeHumidityDescription}, $result->{sensorProbeHumidityStatus}, $instance, $result->{sensorProbeHumidityPercent}));
|
||||||
|
|
||||||
|
if (defined($result->{sensorProbeHumidityPercent}) && $result->{sensorProbeHumidityPercent} =~ /[0-9]/) {
|
||||||
|
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'humidity', instance => $instance, value => $result->{sensorProbeHumidityPercent});
|
||||||
|
if ($checked == 0) {
|
||||||
|
my $warn_th = $result->{sensorProbeHumidityLowWarning} . ':' . $result->{sensorProbeHumidityHighWarning};
|
||||||
|
my $crit_th = $result->{sensorProbeHumidityLowCritical} . ':' . $result->{sensorProbeHumidityHighCritical};
|
||||||
|
$self->{perfdata}->threshold_validate(label => 'warning-humidity-instance-' . $instance, value => $warn_th);
|
||||||
|
$self->{perfdata}->threshold_validate(label => 'critical-humidity-instance-' . $instance, value => $crit_th);
|
||||||
|
|
||||||
|
$exit = $self->{perfdata}->threshold_check(value => $result->{sensorProbeHumidityPercent}, threshold => [ { label => 'critical-humidity-instance-' . $instance, exit_litteral => 'critical' },
|
||||||
|
{ label => 'warning-humidity-instance-' . $instance, exit_litteral => 'warning' } ]);
|
||||||
|
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-humidity-instance-' . $instance);
|
||||||
|
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-humidity-instance-' . $instance)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Humidity sensor '%s' is %s %%", $result->{sensorProbeHumidityDescription}, $result->{sensorProbeHumidityPercent}));
|
||||||
|
}
|
||||||
|
$self->{output}->perfdata_add(label => 'humdity_' . $instance, unit => '%',
|
||||||
|
value => $result->{sensorProbeHumidityPercent},
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit,
|
||||||
|
min => 0, max => 100
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
81
hardware/sensors/sensorip/snmp/mode/components/sp.pm
Normal file
81
hardware/sensors/sensorip/snmp/mode/components/sp.pm
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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::sensors::sensorip::snmp::mode::components::sp;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_sp_status = (
|
||||||
|
1 => 'noStatus',
|
||||||
|
2 => 'normal',
|
||||||
|
3 => 'warning',
|
||||||
|
4 => 'critical',
|
||||||
|
5 => 'sensorError',
|
||||||
|
);
|
||||||
|
my $oid_spStatus = '.1.3.6.1.4.1.3854.1.1.2';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_spStatus };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking sp");
|
||||||
|
$self->{components}->{sp} = {name => 'sp', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'sp'));
|
||||||
|
|
||||||
|
my $instance = 0;
|
||||||
|
my $sp_status = defined($map_sp_status{$self->{results}->{$oid_spStatus}->{$oid_spStatus . '.' . $instance}}) ?
|
||||||
|
$map_sp_status{$self->{results}->{$oid_spStatus}->{$oid_spStatus . '.' . $instance}} : 'unknown';
|
||||||
|
|
||||||
|
return if ($self->check_exclude(section => 'sp', instance => $instance));
|
||||||
|
return if ($sp_status =~ /noStatus/i &&
|
||||||
|
$self->absent_problem(section => 'sp', instance => $instance));
|
||||||
|
|
||||||
|
$self->{components}->{sp}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Sensor probe '%s' status is '%s'",
|
||||||
|
$instance, $sp_status));
|
||||||
|
my $exit = $self->get_severity(section => 'sp', value => $sp_status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Sensor probe '%s' status is '%s'", $instance, $sp_status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
97
hardware/sensors/sensorip/snmp/mode/components/switch.pm
Normal file
97
hardware/sensors/sensorip/snmp/mode/components/switch.pm
Normal 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::sensors::sensorip::snmp::mode::components::switch;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_sw_status = (
|
||||||
|
1 => 'noStatus',
|
||||||
|
2 => 'normal',
|
||||||
|
4 => 'highCritical',
|
||||||
|
6 => 'lowCritical',
|
||||||
|
7 => 'sensorError',
|
||||||
|
8 => 'relayOn',
|
||||||
|
9 => 'relayOff',
|
||||||
|
);
|
||||||
|
my %map_sw_online = (
|
||||||
|
1 => 'online',
|
||||||
|
2 => 'offline',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
sensorProbeSwitchDescription => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.18.1.1' },
|
||||||
|
sensorProbeSwitchStatus => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.18.1.3', map => \%map_sw_status },
|
||||||
|
sensorProbeSwitchOnline => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.18.1.4', map => \%map_sw_online },
|
||||||
|
};
|
||||||
|
my $oid_sensorProbeSwitchEntry = '.1.3.6.1.4.1.3854.1.2.2.1.18.1';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_sensorProbeSwitchEntry, end => $mapping->{sensorProbeSwitchOnline}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking switch");
|
||||||
|
$self->{components}->{switch} = {name => 'switch', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'switch'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_sensorProbeSwitchEntry}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{sensorProbeSwitchStatus}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_sensorProbeSwitchEntry}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'switch', instance => $instance));
|
||||||
|
if ($result->{sensorProbeSwitchOnline} =~ /Offline/i) {
|
||||||
|
$self->absent_problem(section => 'switch', instance => $instance);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{components}->{switch}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Switch sensor '%s' status is '%s' [instance : %s]",
|
||||||
|
$result->{sensorProbeSwitchDescription}, $result->{sensorProbeSwitchStatus}, $instance));
|
||||||
|
my $exit = $self->get_severity(section => 'switch', value => $result->{sensorProbeSwitchStatus});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Switch sensor '%s' status is '%s'", $result->{sensorProbeSwitchDescription}, $result->{sensorProbeSwitchStatus}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
131
hardware/sensors/sensorip/snmp/mode/components/temperature.pm
Normal file
131
hardware/sensors/sensorip/snmp/mode/components/temperature.pm
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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::sensors::sensorip::snmp::mode::components::temperature;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_temp_status = (
|
||||||
|
1 => 'noStatus',
|
||||||
|
2 => 'normal',
|
||||||
|
3 => 'highWarning',
|
||||||
|
4 => 'highCritical',
|
||||||
|
5 => 'lowWarning',
|
||||||
|
6 => 'lowCritical',
|
||||||
|
7 => 'sensorError',
|
||||||
|
);
|
||||||
|
my %map_temp_online = (
|
||||||
|
1 => 'online',
|
||||||
|
2 => 'offline',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
sensorProbeTempDescription => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.1' },
|
||||||
|
sensorProbeTempDegree => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.3' },
|
||||||
|
sensorProbeTempStatus => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.4', map => \%map_temp_status },
|
||||||
|
sensorProbeTempOnline => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.5', map => \%map_temp_online },
|
||||||
|
sensorProbeTempHighWarning => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.7' },
|
||||||
|
sensorProbeTempHighCritical => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.8' },
|
||||||
|
sensorProbeTempLowWarning => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.9' },
|
||||||
|
sensorProbeTempLowCritical => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.10' },
|
||||||
|
};
|
||||||
|
my $oid_sensorProbeTempEntry = '.1.3.6.1.4.1.3854.1.2.2.1.16.1';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_sensorProbeTempEntry, end => $mapping->{sensorProbeTempLowCritical}->{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_exclude(section => 'temperature'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_sensorProbeTempEntry}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{sensorProbeTempDegree}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_sensorProbeTempEntry}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'temperature', instance => $instance));
|
||||||
|
if ($result->{sensorProbeTempOnline} =~ /Offline/i) {
|
||||||
|
$self->absent_problem(section => 'temperature', instance => $instance);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{components}->{temperature}->{total}++;
|
||||||
|
if ($result->{sensorProbeTempStatus} =~ /sensorError/i) {
|
||||||
|
my $exit = $self->get_severity(section => 'temperature', value => $result->{sensorProbeTempStatus});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Temperature sensor '%s' status is '%s'", $result->{sensorProbeTempDescription}, $result->{sensorProbeTempStatus}));
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Temperature sensor '%s' status is '%s' [instance = %s, value = %s]",
|
||||||
|
$result->{sensorProbeTempDescription}, $result->{sensorProbeTempStatus}, $instance, $result->{sensorProbeTempDegree}));
|
||||||
|
|
||||||
|
if (defined($result->{sensorProbeTempDegree}) && $result->{sensorProbeTempDegree} =~ /[0-9]/) {
|
||||||
|
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{sensorProbeTempDegree});
|
||||||
|
if ($checked == 0) {
|
||||||
|
my $warn_th = $result->{sensorProbeTempLowWarning} . ':' . $result->{sensorProbeTempHighWarning};
|
||||||
|
my $crit_th = $result->{sensorProbeTempLowCritical} . ':' . $result->{sensorProbeTempHighCritical};
|
||||||
|
$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->{sensorProbeTempDegree}, 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 sensor '%s' is %s degree centigrade", $result->{sensorProbeTempDescription}, $result->{sensorProbeTempDegree}));
|
||||||
|
}
|
||||||
|
$self->{output}->perfdata_add(label => 'temp_' . $instance, unit => 'C',
|
||||||
|
value => $result->{sensorProbeTempDegree},
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
319
hardware/sensors/sensorip/snmp/mode/sensors.pm
Normal file
319
hardware/sensors/sensorip/snmp/mode/sensors.pm
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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::sensors::sensorip::snmp::mode::sensors;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
|
my $thresholds = {
|
||||||
|
sp => [
|
||||||
|
['noStatus', 'UNKNOWN'],
|
||||||
|
['normal', 'OK'],
|
||||||
|
['warning', 'WARNING'],
|
||||||
|
['critical', 'CRITICAL'],
|
||||||
|
['sensorError', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
switch => [
|
||||||
|
['noStatus', 'UNKNOWN'],
|
||||||
|
['normal', 'OK'],
|
||||||
|
['highCritical', 'CRITICAL'],
|
||||||
|
['lowCritical', 'CRITICAL'],
|
||||||
|
['sensorError', 'CRITICAL'],
|
||||||
|
['relayOn', 'OK'],
|
||||||
|
['relayOff', 'OK'],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
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 => '.*' },
|
||||||
|
"absent-problem:s" => { name => 'absent' },
|
||||||
|
"no-component:s" => { name => 'no_component' },
|
||||||
|
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||||
|
"warning:s@" => { name => 'warning' },
|
||||||
|
"critical:s@" => { name => 'critical' },
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->{components} = {};
|
||||||
|
$self->{no_components} = undef;
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{no_component})) {
|
||||||
|
if ($self->{option_results}->{no_component} ne '') {
|
||||||
|
$self->{no_components} = $self->{option_results}->{no_component};
|
||||||
|
} else {
|
||||||
|
$self->{no_components} = 'critical';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{overload_th} = {};
|
||||||
|
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||||
|
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my ($section, $status, $filter) = ($1, $2, $3);
|
||||||
|
if ($self->{output}->is_litteral_status(status => $status) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
|
||||||
|
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{numeric_threshold} = {};
|
||||||
|
foreach my $option (('warning', 'critical')) {
|
||||||
|
foreach my $val (@{$self->{option_results}->{$option}}) {
|
||||||
|
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my ($section, $regexp, $value) = ($1, $2, $3);
|
||||||
|
if ($section !~ /(humidity|temperature)/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: battery or temperature).");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my $position = 0;
|
||||||
|
if (defined($self->{numeric_threshold}->{$section})) {
|
||||||
|
$position = scalar(@{$self->{numeric_threshold}->{$section}});
|
||||||
|
}
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section}));
|
||||||
|
push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
# $options{snmp} = snmp object
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
|
my $snmp_request = [];
|
||||||
|
my @components = ('sp', 'temperature', 'humidity', 'switch');
|
||||||
|
foreach (@components) {
|
||||||
|
if (/$self->{option_results}->{component}/) {
|
||||||
|
my $mod_name = "hardware::sensors::sensorip::snmp::mode::components::$_";
|
||||||
|
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name,
|
||||||
|
error_msg => "Cannot load module '$mod_name'.");
|
||||||
|
my $func = $mod_name->can('load');
|
||||||
|
$func->(request => $snmp_request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(@{$snmp_request}) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => $snmp_request);
|
||||||
|
|
||||||
|
foreach (@components) {
|
||||||
|
if (/$self->{option_results}->{component}/) {
|
||||||
|
my $mod_name = "hardware::sensors::sensorip::snmp::mode::components::$_";
|
||||||
|
my $func = $mod_name->can('check');
|
||||||
|
$func->($self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 && $self->{components}->{$comp}->{skip} == 0);
|
||||||
|
$total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||||
|
my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||||
|
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name};
|
||||||
|
$display_by_component_append = ', ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => sprintf("All %s components are ok [%s].",
|
||||||
|
$total_components,
|
||||||
|
$display_by_component)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||||
|
$self->{output}->output_add(severity => $self->{no_components},
|
||||||
|
short_msg => 'No components are checked.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_exclude {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($options{instance})) {
|
||||||
|
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) {
|
||||||
|
$self->{components}->{$options{section}}->{skip}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance."));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) {
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section."));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub absent_problem {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{absent}) &&
|
||||||
|
$self->{option_results}->{absent} =~ /(^|\s|,)($options{section}(\s*,|$)|${options{section}}[^,]*#\Q$options{instance}\E#)/) {
|
||||||
|
$self->{output}->output_add(severity => 'CRITICAL',
|
||||||
|
short_msg => sprintf("Component '%s' instance '%s' is not present",
|
||||||
|
$options{section}, $options{instance}));
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance (not present)"));
|
||||||
|
$self->{components}->{$options{section}}->{skip}++;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_severity_numeric {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'OK'; # default
|
||||||
|
my $thresholds = { warning => undef, critical => undef };
|
||||||
|
my $checked = 0;
|
||||||
|
|
||||||
|
if (defined($self->{numeric_threshold}->{$options{section}})) {
|
||||||
|
my $exits = [];
|
||||||
|
foreach (@{$self->{numeric_threshold}->{$options{section}}}) {
|
||||||
|
if ($options{instance} =~ /$_->{regexp}/) {
|
||||||
|
push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]);
|
||||||
|
$thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label});
|
||||||
|
$checked = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($status, $thresholds->{warning}, $thresholds->{critical}, $checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_severity {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'UNKNOWN'; # default
|
||||||
|
|
||||||
|
if (defined($self->{overload_th}->{$options{section}})) {
|
||||||
|
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||||
|
if ($options{value} =~ /$_->{filter}/i) {
|
||||||
|
$status = $_->{status};
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (@{$thresholds->{$options{section}}}) {
|
||||||
|
if ($options{value} =~ /$$_[0]/i) {
|
||||||
|
$status = $$_[1];
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check sensor components (Sensor Probe status, Temperatures, Humidity, Switch).
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--component>
|
||||||
|
|
||||||
|
Which component to check (Default: '.*').
|
||||||
|
Can be: 'sp', 'temperature', 'humidity', 'switch'.
|
||||||
|
|
||||||
|
=item B<--exclude>
|
||||||
|
|
||||||
|
Exclude some parts (comma seperated list) (Example: --exclude=psu)
|
||||||
|
Can also exclude specific instance: --exclude='humidty#0#'
|
||||||
|
|
||||||
|
=item B<--absent-problem>
|
||||||
|
|
||||||
|
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
||||||
|
Can be specific or global: --absent-problem=temperature#2#
|
||||||
|
|
||||||
|
=item B<--no-component>
|
||||||
|
|
||||||
|
Return an error if no compenents are checked.
|
||||||
|
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||||
|
|
||||||
|
=item B<--threshold-overload>
|
||||||
|
|
||||||
|
Set to overload default threshold values (syntax: section,status,regexp)
|
||||||
|
It used before default thresholds (order stays).
|
||||||
|
Example: --threshold-overload='temperature,CRITICAL,^(?!(normal)$)'
|
||||||
|
|
||||||
|
=item B<--warning>
|
||||||
|
|
||||||
|
Set warning threshold for temperatures and humidity (syntax: type,regexp,treshold)
|
||||||
|
Example: --warning='temperature,.*,30' --warning='humidity,.*,90'
|
||||||
|
|
||||||
|
=item B<--critical>
|
||||||
|
|
||||||
|
Set critical threshold for temperature and humidity (syntax: type,regexp,treshold)
|
||||||
|
Example: --critical='temperature,.*,40'
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
64
hardware/sensors/sensorip/snmp/plugin.pm
Normal file
64
hardware/sensors/sensorip/snmp/plugin.pm
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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::sensors::sensorip::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;
|
||||||
|
# $options->{options} = options object
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
%{$self->{modes}} = (
|
||||||
|
'sensors' => 'hardware::sensors::sensorip::snmp::mode::sensors',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 PLUGIN DESCRIPTION
|
||||||
|
|
||||||
|
Check Sensor-IP sensors in SNMP.
|
||||||
|
|
||||||
|
=cut
|
@ -74,7 +74,7 @@ sub check {
|
|||||||
my $exit = $self->get_severity(section => 'temperature', value => $map_states_temperature{$temperature_state});
|
my $exit = $self->get_severity(section => 'temperature', value => $map_states_temperature{$temperature_state});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Temperature '%s' sensor out of range status is '%s'", $voltage_name, $map_states_temperature{$temperature_state}));
|
short_msg => sprintf("Temperature '%s' sensor out of range status is '%s'", $temperature_name, $map_states_temperature{$temperature_state}));
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => $temperature_name , unit => 'C',
|
$self->{output}->perfdata_add(label => $temperature_name , unit => 'C',
|
||||||
|
@ -83,7 +83,7 @@ sub run {
|
|||||||
my $free = $total_size - $used;
|
my $free = $total_size - $used;
|
||||||
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_resMemUsage},
|
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_resMemUsage},
|
||||||
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
|
||||||
my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
||||||
my ($used_value, $used_unit) = $self->{perfdata}->change_bytes(value => $used);
|
my ($used_value, $used_unit) = $self->{perfdata}->change_bytes(value => $used);
|
||||||
@ -96,7 +96,7 @@ sub run {
|
|||||||
$free_value . " " . $free_unit, (100 - $result->{$oid_resMemUsage})));
|
$free_value . " " . $free_unit, (100 - $result->{$oid_resMemUsage})));
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => "used", unit => 'B',
|
$self->{output}->perfdata_add(label => "used", unit => 'B',
|
||||||
value => sprintf("%d", $used),
|
value => int($used),
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),
|
||||||
min => 0, max => $total_size);
|
min => 0, max => $total_size);
|
||||||
|
@ -91,7 +91,7 @@ sub run {
|
|||||||
my $prct_used = $total_used * 100 / $total_size;
|
my $prct_used = $total_used * 100 / $total_size;
|
||||||
my $prct_free = 100 - $prct_used;
|
my $prct_free = 100 - $prct_used;
|
||||||
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
||||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $total_used);
|
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $total_used);
|
||||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $total_free);
|
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $total_free);
|
||||||
|
@ -120,7 +120,7 @@ sub disco_show {
|
|||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
$self->manage_selection();
|
$self->manage_selection(disco => 1);
|
||||||
foreach my $instance (sort @{$self->{node_id_selected}}) {
|
foreach my $instance (sort @{$self->{node_id_selected}}) {
|
||||||
my $name = $self->{result_names}->{$oid_ltmNodeAddrStatusName . '.' . $instance};
|
my $name = $self->{result_names}->{$oid_ltmNodeAddrStatusName . '.' . $instance};
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ sub disco_show {
|
|||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
$self->manage_selection();
|
$self->manage_selection(disco => 1);
|
||||||
foreach my $instance (sort @{$self->{pool_id_selected}}) {
|
foreach my $instance (sort @{$self->{pool_id_selected}}) {
|
||||||
my $name = $self->{result_names}->{$oid_ltmPoolStatusName . '.' . $instance};
|
my $name = $self->{result_names}->{$oid_ltmPoolStatusName . '.' . $instance};
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ sub disco_show {
|
|||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
$self->manage_selection();
|
$self->manage_selection(disco => 1);
|
||||||
foreach my $instance (sort @{$self->{vs_id_selected}}) {
|
foreach my $instance (sort @{$self->{vs_id_selected}}) {
|
||||||
my $name = $self->{result_names}->{$oid_ltmVsStatusName . '.' . $instance};
|
my $name = $self->{result_names}->{$oid_ltmVsStatusName . '.' . $instance};
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ sub run {
|
|||||||
my $mem_usage = $result2->{$oid_jnxJsSPUMonitoringMemoryUsage . '.' . $instance};
|
my $mem_usage = $result2->{$oid_jnxJsSPUMonitoringMemoryUsage . '.' . $instance};
|
||||||
|
|
||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $mem_usage,
|
my $exit_code = $self->{perfdata}->threshold_check(value => $mem_usage,
|
||||||
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf("Memory '%d' usage is: %s%%", $instance, $mem_usage));
|
short_msg => sprintf("Memory '%d' usage is: %s%%", $instance, $mem_usage));
|
||||||
$self->{output}->perfdata_add(label => 'mem_' . $instance, unit => '%',
|
$self->{output}->perfdata_add(label => 'mem_' . $instance, unit => '%',
|
||||||
|
@ -132,16 +132,16 @@ sub run {
|
|||||||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $swap_total);
|
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $swap_total);
|
||||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $total_used);
|
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $total_used);
|
||||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $swap_total - $total_used);
|
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $swap_total - $total_used);
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Page space '%s' Total: %s Used: %s (%.2f%%) Free: %s (%d%%)", $swap_name,
|
short_msg => sprintf("Page space '%s' Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $swap_name,
|
||||||
$total_size_value . " " . $total_size_unit,
|
$total_size_value . " " . $total_size_unit,
|
||||||
$total_used_value . " " . $total_used_unit, $total_used * 100 / $swap_total,
|
$total_used_value . " " . $total_used_unit, $total_used * 100 / $swap_total,
|
||||||
$total_free_value . " " . $total_free_unit, 100 - ($total_used * 100 / $results->{$aix_swap_pool}->{$aix_swap_total . "." . $_})));
|
$total_free_value . " " . $total_free_unit, 100 - ($total_used * 100 / $results->{$aix_swap_pool}->{$aix_swap_total . "." . $_})));
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Page space '%s' Total: %s Used: %s (%.2f%%) Free: %s (%d%%)", $swap_name,
|
$self->{output}->output_add(long_msg => sprintf("Page space '%s' Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $swap_name,
|
||||||
$total_size_value . " " . $total_size_unit,
|
$total_size_value . " " . $total_size_unit,
|
||||||
$total_used_value . " " . $total_used_unit, $total_used * 100 / $swap_total,
|
$total_used_value . " " . $total_used_unit, $total_used * 100 / $swap_total,
|
||||||
$total_free_value . " " . $total_free_unit, 100 - ($total_used * 100 / $swap_total)));
|
$total_free_value . " " . $total_free_unit, 100 - ($total_used * 100 / $swap_total)));
|
||||||
|
@ -138,12 +138,12 @@ sub run {
|
|||||||
|
|
||||||
$total_size += $size;
|
$total_size += $size;
|
||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $size,
|
my $exit_code = $self->{perfdata}->threshold_check(value => $size,
|
||||||
threshold => [ { label => 'critical_one', 'exit_litteral' => 'critical' }, { label => 'warning_one', exit_litteral => 'warning' } ]);
|
threshold => [ { label => 'critical_one', exit_litteral => 'critical' }, { label => 'warning_one', exit_litteral => 'warning' } ]);
|
||||||
my ($size_value, $size_unit) = $self->{perfdata}->change_bytes(value => $size);
|
my ($size_value, $size_unit) = $self->{perfdata}->change_bytes(value => $size);
|
||||||
$self->{output}->output_add(long_msg => sprintf("%s: %s", $name, $size_value . ' ' . $size_unit));
|
$self->{output}->output_add(long_msg => sprintf("%s: %s", $name, $size_value . ' ' . $size_unit));
|
||||||
if (!$self->{output}->is_status(litteral => 1, value => $exit_code, compare => 'ok')) {
|
if (!$self->{output}->is_status(litteral => 1, value => $exit_code, compare => 'ok')) {
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf("'%d' size is %s", $name, $size_value . ' ' . $size_unit));
|
short_msg => sprintf("'%s' size is %s", $name, $size_value . ' ' . $size_unit));
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(label => $name, unit => 'B',
|
$self->{output}->perfdata_add(label => $name, unit => 'B',
|
||||||
value => $size,
|
value => $size,
|
||||||
@ -154,7 +154,7 @@ sub run {
|
|||||||
|
|
||||||
# Total Size
|
# Total Size
|
||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $total_size,
|
my $exit_code = $self->{perfdata}->threshold_check(value => $total_size,
|
||||||
threshold => [ { label => 'critical_total', 'exit_litteral' => 'critical' }, { label => 'warning_total', exit_litteral => 'warning' } ]);
|
threshold => [ { label => 'critical_total', exit_litteral => 'critical' }, { label => 'warning_total', exit_litteral => 'warning' } ]);
|
||||||
my ($size_value, $size_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
my ($size_value, $size_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
||||||
$self->{output}->output_add(long_msg => sprintf("Total: %s", $size_value . ' ' . $size_unit));
|
$self->{output}->output_add(long_msg => sprintf("Total: %s", $size_value . ' ' . $size_unit));
|
||||||
if (!$self->{output}->is_status(litteral => 1, value => $exit_code, compare => 'ok')) {
|
if (!$self->{output}->is_status(litteral => 1, value => $exit_code, compare => 'ok')) {
|
||||||
|
@ -279,7 +279,7 @@ sub manage_selection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(keys %{$self->{device_id_selected}}) <= 0) {
|
if (scalar(keys %{$self->{device_id_selected}}) <= 0 && !defined($options{disco})) {
|
||||||
if (defined($self->{option_results}->{device})) {
|
if (defined($self->{option_results}->{device})) {
|
||||||
$self->{output}->add_option_msg(short_msg => "No device found '" . $self->{option_results}->{device} . "' (or counter values are 0).");
|
$self->{output}->add_option_msg(short_msg => "No device found '" . $self->{option_results}->{device} . "' (or counter values are 0).");
|
||||||
} else {
|
} else {
|
||||||
@ -301,7 +301,7 @@ sub disco_show {
|
|||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
$self->{hostname} = $self->{snmp}->get_hostname();
|
$self->{hostname} = $self->{snmp}->get_hostname();
|
||||||
$self->manage_selection();
|
$self->manage_selection(disco => 1);
|
||||||
foreach (sort keys %{$self->{device_id_selected}}) {
|
foreach (sort keys %{$self->{device_id_selected}}) {
|
||||||
$self->{output}->add_disco_entry(name => $self->{results}->{$oid_diskIODevice}->{$oid_diskIODevice . '.' . $_},
|
$self->{output}->add_disco_entry(name => $self->{results}->{$oid_diskIODevice}->{$oid_diskIODevice . '.' . $_},
|
||||||
deviceid => $_);
|
deviceid => $_);
|
||||||
|
@ -166,7 +166,7 @@ sub manage_selection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(@{$self->{diskpath_id_selected}}) <= 0) {
|
if (scalar(@{$self->{diskpath_id_selected}}) <= 0 && !defined($options{disco})) {
|
||||||
if (defined($self->{option_results}->{diskpath})) {
|
if (defined($self->{option_results}->{diskpath})) {
|
||||||
$self->{output}->add_option_msg(short_msg => "No disk path found for name '" . $self->{option_results}->{diskpath} . "'.");
|
$self->{output}->add_option_msg(short_msg => "No disk path found for name '" . $self->{option_results}->{diskpath} . "'.");
|
||||||
} else {
|
} else {
|
||||||
@ -188,7 +188,7 @@ sub disco_show {
|
|||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
$self->manage_selection();
|
$self->manage_selection(disco => 1);
|
||||||
my $result = $self->get_additional_information();
|
my $result = $self->get_additional_information();
|
||||||
foreach (sort @{$self->{diskpath_id_selected}}) {
|
foreach (sort @{$self->{diskpath_id_selected}}) {
|
||||||
if (defined($result)) {
|
if (defined($result)) {
|
||||||
|
@ -210,7 +210,7 @@ sub manage_selection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(@{$self->{interface_id_selected}}) <= 0) {
|
if (scalar(@{$self->{interface_id_selected}}) <= 0 && !defined($options{disco})) {
|
||||||
if (defined($self->{option_results}->{interface})) {
|
if (defined($self->{option_results}->{interface})) {
|
||||||
$self->{output}->add_option_msg(short_msg => "No interface found for name '" . $self->{option_results}->{interface} . "'.");
|
$self->{output}->add_option_msg(short_msg => "No interface found for name '" . $self->{option_results}->{interface} . "'.");
|
||||||
} else {
|
} else {
|
||||||
@ -232,7 +232,7 @@ sub disco_show {
|
|||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
$self->manage_selection();
|
$self->manage_selection(disco => 1);
|
||||||
my $result = $self->get_additional_information();
|
my $result = $self->get_additional_information();
|
||||||
foreach (sort @{$self->{interface_id_selected}}) {
|
foreach (sort @{$self->{interface_id_selected}}) {
|
||||||
my $display_value = $self->get_display_value(id => $_);
|
my $display_value = $self->get_display_value(id => $_);
|
||||||
|
@ -224,7 +224,7 @@ sub manage_selection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(@{$self->{storage_id_selected}}) <= 0) {
|
if (scalar(@{$self->{storage_id_selected}}) <= 0 && !defined($options{disco})) {
|
||||||
if (defined($self->{option_results}->{storage})) {
|
if (defined($self->{option_results}->{storage})) {
|
||||||
$self->{output}->add_option_msg(short_msg => "No storage found for name '" . $self->{option_results}->{storage} . "'.");
|
$self->{output}->add_option_msg(short_msg => "No storage found for name '" . $self->{option_results}->{storage} . "'.");
|
||||||
} else {
|
} else {
|
||||||
@ -246,7 +246,7 @@ sub disco_show {
|
|||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
$self->manage_selection();
|
$self->manage_selection(disco => 1);
|
||||||
my $result = $self->get_additional_information();
|
my $result = $self->get_additional_information();
|
||||||
foreach (sort @{$self->{storage_id_selected}}) {
|
foreach (sort @{$self->{storage_id_selected}}) {
|
||||||
my $display_value = $self->get_display_value(id => $_);
|
my $display_value = $self->get_display_value(id => $_);
|
||||||
|
@ -183,8 +183,8 @@ sub run {
|
|||||||
# in bytes hrStorageAllocationUnits
|
# in bytes hrStorageAllocationUnits
|
||||||
my $total_size = $result->{$oid_hrStorageSize . "." . $_} * $result->{$oid_hrStorageAllocationUnits . "." . $_};
|
my $total_size = $result->{$oid_hrStorageSize . "." . $_} * $result->{$oid_hrStorageAllocationUnits . "." . $_};
|
||||||
if ($total_size <= 0) {
|
if ($total_size <= 0) {
|
||||||
$self->{output}->add_option_msg(long_msg => sprintf("Skipping storage '%d': total size is <= 0 (%d)",
|
$self->{output}->add_option_msg(long_msg => sprintf("Skipping storage '%d': total size is <= 0 (%s)",
|
||||||
$name_storage, $total_size));
|
$name_storage, int($total_size)));
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ sub run {
|
|||||||
value => $value_perf,
|
value => $value_perf,
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options),
|
||||||
min => 0, max => sprintf("%d", $total_size - $reserved_value));
|
min => 0, max => int($total_size - $reserved_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num_disk_check == 0) {
|
if ($num_disk_check == 0) {
|
||||||
|
46
storage/emc/DataDomain/lib/functions.pm
Normal file
46
storage/emc/DataDomain/lib/functions.pm
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::emc::DataDomain::lib::functions;
|
||||||
|
|
||||||
|
sub get_version {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
return $1 if (defined($options{value}) && $options{value} =~ /(\d+\.\d+\.\d+)/);
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
101
storage/emc/DataDomain/mode/components/battery.pm
Normal file
101
storage/emc/DataDomain/mode/components/battery.pm
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::emc::DataDomain::mode::components::battery;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
|
my %map_battery_status = ();
|
||||||
|
my ($oid_nvramBatteryStatus, $oid_nvramBatteryCharge);
|
||||||
|
my $oid_nvramBatteryEntry = '.1.3.6.1.4.1.19746.1.2.3.1.1';
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking nvram batteries");
|
||||||
|
$self->{components}->{battery} = {name => 'nvram batteries', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'battery'));
|
||||||
|
|
||||||
|
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||||
|
$oid_nvramBatteryStatus = '.1.3.6.1.4.1.19746.1.2.3.1.1.3';
|
||||||
|
$oid_nvramBatteryCharge = '.1.3.6.1.4.1.19746.1.2.3.1.1.4';
|
||||||
|
%map_battery_status = (0 => 'ok', 1 => 'disabled', 2 => 'discharged', 4 => 'softdisabled');
|
||||||
|
} else {
|
||||||
|
$oid_nvramBatteryStatus = '.1.3.6.1.4.1.19746.1.2.3.1.1.2';
|
||||||
|
$oid_nvramBatteryCharge = '.1.3.6.1.4.1.19746.1.2.3.1.1.3';
|
||||||
|
%map_battery_status = (1 => 'ok', 2 => 'disabled', 3 => 'discharged', 4 => 'unknown',
|
||||||
|
5 => 'softdisabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_nvramBatteryEntry}}) {
|
||||||
|
next if ($oid !~ /^$oid_nvramBatteryStatus\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $batt_status = defined($map_battery_status{$self->{results}->{$oid_nvramBatteryEntry}->{$oid}}) ?
|
||||||
|
$map_battery_status{$self->{results}->{$oid_nvramBatteryEntry}->{$oid}} : 'unknown';
|
||||||
|
my $batt_value = $self->{results}->{$oid_nvramBatteryEntry}->{$oid_nvramBatteryCharge . '.' . $instance};
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'battery', instance => $instance));
|
||||||
|
next if ($batt_status =~ /disabled/i &&
|
||||||
|
$self->absent_problem(section => 'battery', instance => $instance));
|
||||||
|
|
||||||
|
$self->{components}->{battery}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Nvram battery '%s' status is '%s'",
|
||||||
|
$instance, $batt_status));
|
||||||
|
my $exit = $self->get_severity(section => 'battery', value => $batt_status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Nvram battery '%s' status is '%s'", $instance, $batt_status));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined($batt_value) && $batt_value =~ /[0-9]/) {
|
||||||
|
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'battery', instance => $instance, value => $batt_value);
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Nvram battery '%s' charge is %s %%", $instance, $batt_value));
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Nvram battery '%s' charge is %s %%", $instance, $batt_value));
|
||||||
|
}
|
||||||
|
$self->{output}->perfdata_add(label => 'nvram_battery_' . $instance, unit => '%',
|
||||||
|
value => $batt_value,
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit,
|
||||||
|
min => 0, max => 100
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
88
storage/emc/DataDomain/mode/components/disk.pm
Normal file
88
storage/emc/DataDomain/mode/components/disk.pm
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::emc::DataDomain::mode::components::disk;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
|
my $oid_diskPropState;
|
||||||
|
|
||||||
|
my %map_disk_status = (
|
||||||
|
1 => 'ok',
|
||||||
|
2 => 'unknown',
|
||||||
|
3 => 'absent',
|
||||||
|
4 => 'failed',
|
||||||
|
5 => 'spare', # since OS 5.4
|
||||||
|
6 => 'available', # since OS 5.4
|
||||||
|
);
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking disks");
|
||||||
|
$self->{components}->{disk} = {name => 'disks', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'disk'));
|
||||||
|
|
||||||
|
my $oid_diskPropState;
|
||||||
|
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||||
|
$oid_diskPropState = '.1.3.6.1.4.1.19746.1.6.1.1.1.8';
|
||||||
|
} else {
|
||||||
|
$oid_diskPropState = '.1.3.6.1.4.1.19746.1.6.1.1.1.7';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_diskPropState}})) {
|
||||||
|
$oid =~ /^$oid_diskPropState\.(.*)$/;
|
||||||
|
my $instance = $1;
|
||||||
|
my $disk_status = defined($map_disk_status{$self->{results}->{$oid_diskPropState}->{$oid}}) ?
|
||||||
|
$map_disk_status{$self->{results}->{$oid_diskPropState}->{$oid}} : 'unknown';
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'disk', instance => $instance));
|
||||||
|
next if ($disk_status =~ /absent/i &&
|
||||||
|
$self->absent_problem(section => 'disk', instance => $instance));
|
||||||
|
|
||||||
|
$self->{components}->{disk}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Disk '%s' status is '%s'",
|
||||||
|
$instance, $disk_status));
|
||||||
|
my $exit = $self->get_severity(section => 'disk', value => $disk_status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Disk '%s' status is '%s'", $instance, $disk_status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
@ -39,47 +39,57 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::misc;
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
my %conditions = (
|
my %map_fan_status = (
|
||||||
0 => ['not found', 'UNKNOWN'],
|
0 => 'notfound',
|
||||||
1 => ['ok', 'OK'],
|
1 => 'ok',
|
||||||
2 => ['failed', 'CRITICAL'],
|
2 => 'failed',
|
||||||
);
|
);
|
||||||
my %level_map = (
|
my %level_map = (
|
||||||
0 => 'unknown',
|
0 => 'unknown',
|
||||||
1 => 'low',
|
1 => 'low',
|
||||||
2 => 'normal',
|
2 => 'normal',
|
||||||
3 => 'high',
|
3 => 'high',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my ($oid_fanDescription, $oid_fanLevel, $oid_fanStatus);
|
||||||
|
my $oid_fanPropertiesEntry = '.1.3.6.1.4.1.19746.1.1.3.1.1.1';
|
||||||
|
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{components}->{fans} = {name => 'fans', total => 0};
|
|
||||||
$self->{output}->output_add(long_msg => "Checking fans");
|
$self->{output}->output_add(long_msg => "Checking fans");
|
||||||
return if ($self->check_exclude('fans'));
|
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'fan'));
|
||||||
|
|
||||||
my $oid_fanPropertiesEntry = '.1.3.6.1.4.1.19746.1.1.3.1.1.1';
|
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||||
my $oid_fanDescription = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.3';
|
$oid_fanDescription = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.4';
|
||||||
my $oid_fanLevel = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.4';
|
$oid_fanLevel = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.5';
|
||||||
my $oid_fanStatus = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.5';
|
$oid_fanStatus = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.6';
|
||||||
|
} else {
|
||||||
my $result = $self->{snmp}->get_table(oid => $oid_fanPropertiesEntry);
|
$oid_fanDescription = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.3';
|
||||||
return if (scalar(keys %$result) <= 0);
|
$oid_fanLevel = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.4';
|
||||||
|
$oid_fanStatus = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.5';
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
foreach my $oid (keys %{$self->{results}->{$oid_fanPropertiesEntry}}) {
|
||||||
next if ($key !~ /^$oid_fanStatus\.(\d+)\.(\d+)$/);
|
next if ($oid !~ /^$oid_fanStatus\.(.*)$/);
|
||||||
my ($enclosure_id, $fan_index) = ($1, $2);
|
my $instance = $1;
|
||||||
|
my $fan_descr = centreon::plugins::misc::trim($self->{results}->{$oid_fanPropertiesEntry}->{$oid_fanDescription . '.' . $instance});
|
||||||
my $fan_descr = centreon::plugins::misc::trim($result->{$oid_fanDescription . '.' . $enclosure_id . '.' . $fan_index});
|
my $fan_status = defined($map_fan_status{$self->{results}->{$oid_fanPropertiesEntry}->{$oid}}) ?
|
||||||
my $fan_level = $result->{$oid_fanLevel . '.' . $enclosure_id . '.' . $fan_index};
|
$map_fan_status{$self->{results}->{$oid_fanPropertiesEntry}->{$oid}} : 'unknown';
|
||||||
my $fan_status = $result->{$oid_fanStatus . '.' . $enclosure_id . '.' . $fan_index};
|
my $fan_level = $self->{results}->{$oid_fanPropertiesEntry}->{$oid_fanLevel . '.' . $instance};
|
||||||
|
|
||||||
$self->{components}->{fans}->{total}++;
|
next if ($self->check_exclude(section => 'fan', instance => $instance));
|
||||||
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is %s [enclosure = %d, index = %d, level = %s].",
|
next if ($fan_status =~ /notfound/i &&
|
||||||
$fan_descr, ${$conditions{$fan_status}}[0], $enclosure_id, $fan_index, $level_map{$fan_level}));
|
$self->absent_problem(section => 'fan', instance => $instance));
|
||||||
if (!$self->{output}->is_status(litteral => 1, value => ${$conditions{$fan_status}}[1], compare => 'ok')) {
|
|
||||||
$self->{output}->output_add(severity => ${$conditions{$fan_status}}[1],
|
$self->{components}->{fan}->{total}++;
|
||||||
short_msg => sprintf("Fan '%s' status is %s", $fan_descr, ${$conditions{$fan_status}}[0]));
|
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance = %s, level = %s]",
|
||||||
|
$fan_descr, $fan_status, $instance, $level_map{$fan_level}));
|
||||||
|
my $exit = $self->get_severity(section => 'fan', value => $fan_status);
|
||||||
|
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'", $fan_descr, $fan_status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,37 +38,47 @@ package storage::emc::DataDomain::mode::components::psu;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
my %conditions = (
|
my %map_psu_status = ();
|
||||||
1 => ['ok', 'OK'],
|
my ($oid_powerModuleDescription, $oid_powerModuleStatus);
|
||||||
2 => ['unknown', 'UNKNOWN'],
|
my $oid_powerModuleEntry = '.1.3.6.1.4.1.19746.1.1.1.1.1.1';
|
||||||
3 => ['fail', 'CRITICAL'],
|
|
||||||
);
|
|
||||||
|
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{components}->{psus} = {name => 'power supplies', total => 0};
|
|
||||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||||
return if ($self->check_exclude('psu'));
|
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'psu'));
|
||||||
|
|
||||||
my $oid_powerModuleEntry = '.1.3.6.1.4.1.19746.1.1.1.1.1.1';
|
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||||
my $oid_powerModuleStatus = '.1.3.6.1.4.1.19746.1.1.1.1.1.1.3';
|
$oid_powerModuleDescription = '.1.3.6.1.4.1.19746.1.1.1.1.1.1.3';
|
||||||
|
$oid_powerModuleStatus = '.1.3.6.1.4.1.19746.1.1.1.1.1.1.4';
|
||||||
my $result = $self->{snmp}->get_table(oid => $oid_powerModuleEntry);
|
%map_psu_status = (0 => 'absent', 1 => 'ok', 2 => 'failed', 3 => 'faulty', 4 => 'acnone',
|
||||||
return if (scalar(keys %$result) <= 0);
|
99 => 'unknown');
|
||||||
|
} else {
|
||||||
|
$oid_powerModuleDescription = ''; # none
|
||||||
|
$oid_powerModuleStatus = '.1.3.6.1.4.1.19746.1.1.1.1.1.1.4';
|
||||||
|
%map_psu_status = (1 => 'ok', 2 => 'unknown', 3 => 'failed');
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
foreach my $oid (keys %{$self->{results}->{$oid_powerModuleEntry}}) {
|
||||||
next if ($key !~ /^$oid_powerModuleStatus\.(\d+)\.(\d+)$/);
|
next if ($oid !~ /^$oid_powerModuleStatus\.(.*)$/);
|
||||||
my ($enclosure_id, $module_index) = ($1, $2);
|
my $instance = $1;
|
||||||
|
my $psu_descr = defined($self->{results}->{$oid_powerModuleEntry}->{$oid_powerModuleDescription . '.' . $instance}) ?
|
||||||
my $psu_status = $result->{$oid_powerModuleStatus . '.' . $enclosure_id . '.' . $module_index};
|
centreon::plugins::misc::trim($self->{results}->{$oid_powerModuleEntry}->{$oid_powerModuleDescription . '.' . $instance}) : 'unknown';
|
||||||
|
my $psu_status = defined($map_psu_status{$self->{results}->{$oid_powerModuleEntry}->{$oid}}) ?
|
||||||
|
$map_psu_status{$self->{results}->{$oid_powerModuleEntry}->{$oid}} : 'unknown';
|
||||||
|
|
||||||
$self->{components}->{psus}->{total}++;
|
next if ($self->check_exclude(section => 'psu', instance => $instance));
|
||||||
$self->{output}->output_add(long_msg => sprintf("Power Supply '%s' status is %s.",
|
next if ($psu_status =~ /absent/i &&
|
||||||
$enclosure_id . '/' . $module_index, ${$conditions{$psu_status}}[0]));
|
$self->absent_problem(section => 'psu', instance => $instance));
|
||||||
if (!$self->{output}->is_status(litteral => 1, value => ${$conditions{$psu_status}}[1], compare => 'ok')) {
|
|
||||||
$self->{output}->output_add(severity => ${$conditions{$psu_status}}[1],
|
$self->{components}->{psu}->{total}++;
|
||||||
short_msg => sprintf("Power Supply '%s' status is %s", $enclosure_id . '/' . $module_index, ${$conditions{$psu_status}}[0]));
|
$self->{output}->output_add(long_msg => sprintf("Power Supply '%s' status is '%s' [description = %s]",
|
||||||
|
$instance, $psu_status, $instance));
|
||||||
|
my $exit = $self->get_severity(section => 'psu', value => $psu_status);
|
||||||
|
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'", $instance, $psu_status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,46 +39,65 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::misc;
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
my %conditions = (
|
my %map_temp_status = ();
|
||||||
0 => ['absent', 'CRITICAL'],
|
my ($oid_tempSensorDescription, $oid_tempSensorCurrentValue, $oid_tempSensorStatus);
|
||||||
1 => ['ok', 'OK'],
|
my $oid_temperatureSensorEntry = '.1.3.6.1.4.1.19746.1.1.2.1.1.1';
|
||||||
2 => ['not found', 'UNKNOWN'],
|
|
||||||
);
|
|
||||||
|
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{components}->{temperatures} = {name => 'temperatures', total => 0};
|
|
||||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||||
return if ($self->check_exclude('temperatures'));
|
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'temperature'));
|
||||||
|
|
||||||
my $oid_temperatureSensorEntry = '.1.3.6.1.4.1.19746.1.1.2.1.1.1';
|
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||||
my $oid_tempSensorDescription = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.3';
|
$oid_tempSensorDescription = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.4';
|
||||||
my $oid_tempSensorCurrentValue = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.4';
|
$oid_tempSensorCurrentValue = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.5';
|
||||||
my $oid_tempSensorStatus = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.5';
|
$oid_tempSensorStatus = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.6';
|
||||||
|
%map_temp_status = (0 => 'failed', 1 => 'ok', 2 => 'notfound', 3 => 'overheatWarning',
|
||||||
my $result = $self->{snmp}->get_table(oid => $oid_temperatureSensorEntry);
|
4 => 'overheatCritical');
|
||||||
return if (scalar(keys %$result) <= 0);
|
} else {
|
||||||
|
$oid_tempSensorDescription = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.3';
|
||||||
|
$oid_tempSensorCurrentValue = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.4';
|
||||||
|
$oid_tempSensorStatus = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.5';
|
||||||
|
%map_temp_status = (0 => 'absent', 1 => 'ok', 2 => 'notfound');
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
foreach my $oid (keys %{$self->{results}->{$oid_temperatureSensorEntry}}) {
|
||||||
next if ($key !~ /^$oid_tempSensorCurrentValue\.(\d+)\.(\d+)$/);
|
next if ($oid !~ /^$oid_tempSensorStatus\.(.*)$/);
|
||||||
my ($enclosure_id, $sensor_index) = ($1, $2);
|
my $instance = $1;
|
||||||
|
my $temp_descr = defined($self->{results}->{$oid_temperatureSensorEntry}->{$oid_tempSensorDescription . '.' . $instance}) ?
|
||||||
my $temp_descr = centreon::plugins::misc::trim($result->{$oid_tempSensorDescription . '.' . $enclosure_id . '.' . $sensor_index});
|
centreon::plugins::misc::trim($self->{results}->{$oid_temperatureSensorEntry}->{$oid_tempSensorDescription . '.' . $instance}) : 'unknown';
|
||||||
my $temp_value = $result->{$oid_tempSensorCurrentValue . '.' . $enclosure_id . '.' . $sensor_index};
|
my $temp_status = defined($map_temp_status{$self->{results}->{$oid_temperatureSensorEntry}->{$oid}}) ?
|
||||||
my $temp_status = $result->{$oid_tempSensorStatus . '.' . $enclosure_id . '.' . $sensor_index};
|
$map_temp_status{$self->{results}->{$oid_temperatureSensorEntry}->{$oid}} : 'unknown';
|
||||||
|
my $temp_value = $self->{results}->{$oid_temperatureSensorEntry}->{$oid_tempSensorCurrentValue . '.' . $instance};
|
||||||
|
|
||||||
$self->{components}->{temperatures}->{total}++;
|
next if ($self->check_exclude(section => 'temperature', instance => $instance));
|
||||||
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' status is %s [enclosure = %d, sensor = %d, current_value = %s].",
|
next if ($temp_status =~ /absent|notfound/i &&
|
||||||
$temp_descr, ${$conditions{$temp_status}}[0], $enclosure_id, $sensor_index, $temp_value));
|
$self->absent_problem(section => 'temperature', instance => $instance));
|
||||||
if (!$self->{output}->is_status(litteral => 1, value => ${$conditions{$temp_status}}[1], compare => 'ok')) {
|
|
||||||
$self->{output}->output_add(severity => ${$conditions{$temp_status}}[1],
|
|
||||||
short_msg => sprintf("Temperature '%s' status is %s", $temp_descr, ${$conditions{$temp_status}}[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => 'temp_' . $enclosure_id . '_' . $sensor_index, unit => 'C',
|
$self->{components}->{temperature}->{total}++;
|
||||||
value => $temp_value,
|
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' status is '%s' [instance = %s]",
|
||||||
);
|
$temp_descr, $temp_status, $instance));
|
||||||
|
my $exit = $self->get_severity(section => 'temperature', value => $temp_status);
|
||||||
|
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'", $temp_descr, $temp_status));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined($temp_value) && $temp_value =~ /[0-9]/) {
|
||||||
|
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $temp_value);
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' is %s degree centigrade", $temp_descr, $temp_value));
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $temp_descr, $temp_value));
|
||||||
|
}
|
||||||
|
$self->{output}->perfdata_add(label => 'temp_' . $instance, unit => 'C',
|
||||||
|
value => $temp_value,
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,147 +0,0 @@
|
|||||||
################################################################################
|
|
||||||
# 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 storage::emc::DataDomain::mode::environment;
|
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
use storage::emc::DataDomain::mode::components::psu;
|
|
||||||
use storage::emc::DataDomain::mode::components::temperature;
|
|
||||||
use storage::emc::DataDomain::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) = @_;
|
|
||||||
|
|
||||||
storage::emc::DataDomain::mode::components::psu::check($self);
|
|
||||||
storage::emc::DataDomain::mode::components::temperature::check($self);
|
|
||||||
storage::emc::DataDomain::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 'psu') {
|
|
||||||
storage::emc::DataDomain::mode::components::psu::check($self);
|
|
||||||
} elsif ($self->{option_results}->{component} eq 'temperature') {
|
|
||||||
storage::emc::DataDomain::mode::components::temperature::check($self);
|
|
||||||
} elsif ($self->{option_results}->{component} eq 'fan') {
|
|
||||||
storage::emc::DataDomain::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 environments (Fans, Temperatures, Power Supplies) (DATA-DOMAIN-MIB).
|
|
||||||
|
|
||||||
=over 8
|
|
||||||
|
|
||||||
=item B<--component>
|
|
||||||
|
|
||||||
Which component to check (Default: 'all').
|
|
||||||
Can be: 'fan', 'temperature', 'psu'.
|
|
||||||
|
|
||||||
=item B<--exclude>
|
|
||||||
|
|
||||||
Exclude some parts (comma seperated list) (Example: --exclude=temperatures,fans).
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
320
storage/emc/DataDomain/mode/filesystem.pm
Normal file
320
storage/emc/DataDomain/mode/filesystem.pm
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::emc::DataDomain::mode::filesystem;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use storage::emc::DataDomain::lib::functions;
|
||||||
|
use centreon::plugins::values;
|
||||||
|
|
||||||
|
my $oid_fileSystemSpaceEntry = '.1.3.6.1.4.1.19746.1.3.2.1.1';
|
||||||
|
my $oid_sysDescr = '.1.3.6.1.2.1.1.1'; # 'Data Domain OS 5.4.1.1-411752'
|
||||||
|
my ($oid_fileSystemResourceName, $oid_fileSystemSpaceUsed, $oid_fileSystemSpaceAvail);
|
||||||
|
|
||||||
|
my $maps_counters = {
|
||||||
|
usage => { class => 'centreon::plugins::values', obj => undef,
|
||||||
|
set => {
|
||||||
|
key_values => [
|
||||||
|
{ name => 'free' }, { name => 'used' }, { name => 'display' },
|
||||||
|
],
|
||||||
|
closure_custom_calc => \&custom_used_calc,
|
||||||
|
closure_custom_output => \&custom_used_output,
|
||||||
|
threshold_use => 'used_prct',
|
||||||
|
output_error_template => '%s',
|
||||||
|
perfdatas => [
|
||||||
|
{ value => 'used', label => 'used', cast_int => 1,
|
||||||
|
unit => 'B', min => 0, max => 'total', threshold_total => 'total',
|
||||||
|
label_extra_instance => 1, instance_use => 'display' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
sub custom_used_calc {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||||
|
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_free'} + $options{new_datas}->{$self->{instance} . '_used'};
|
||||||
|
$self->{result_values}->{free} = $options{new_datas}->{$self->{instance} . '_free'};
|
||||||
|
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_used'};
|
||||||
|
$self->{result_values}->{free_prct} = $self->{result_values}->{free} * 100 / $self->{result_values}->{total};
|
||||||
|
$self->{result_values}->{used_prct} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_used_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||||
|
my ($used_value, $used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||||
|
my ($free_value, $free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||||
|
|
||||||
|
return sprintf("Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||||
|
$total_value . " " . $total_unit,
|
||||||
|
$used_value . " " . $used_unit, $self->{result_values}->{used_prct},
|
||||||
|
$free_value . " " . $free_unit, $self->{result_values}->{free_prct});
|
||||||
|
}
|
||||||
|
|
||||||
|
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 =>
|
||||||
|
{
|
||||||
|
"name" => { name => 'use_name' },
|
||||||
|
"filesystem:s" => { name => 'filesystem' },
|
||||||
|
"regexp" => { name => 'use_regexp' },
|
||||||
|
"regexp-isensitive" => { name => 'use_regexpi' },
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->{filesystem_id_selected} = {};
|
||||||
|
|
||||||
|
foreach (keys %{$maps_counters}) {
|
||||||
|
$options{options}->add_options(arguments => {
|
||||||
|
'warning-' . $_ . ':s' => { name => 'warning-' . $_ },
|
||||||
|
'critical-' . $_ . ':s' => { name => 'critical-' . $_ },
|
||||||
|
});
|
||||||
|
my $class = $maps_counters->{$_}->{class};
|
||||||
|
$maps_counters->{$_}->{obj} = $class->new(statefile => $self->{statefile_value},
|
||||||
|
output => $self->{output}, perfdata => $self->{perfdata},
|
||||||
|
label => $_);
|
||||||
|
$maps_counters->{$_}->{obj}->set(%{$maps_counters->{$_}->{set}});
|
||||||
|
}
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
foreach (keys %{$maps_counters}) {
|
||||||
|
$maps_counters->{$_}->{obj}->init(option_results => $self->{option_results});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
# $options{snmp} = snmp object
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
|
$self->manage_selection();
|
||||||
|
|
||||||
|
my $multiple = 1;
|
||||||
|
if (scalar(keys %{$self->{filesystem_id_selected}}) == 1) {
|
||||||
|
$multiple = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($multiple == 1) {
|
||||||
|
$self->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => 'All filesystems are ok.');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$self->{filesystem_id_selected}}) {
|
||||||
|
my ($short_msg, $short_msg_append, $long_msg, $long_msg_append) = ('', '', '', '');
|
||||||
|
my @exits;
|
||||||
|
foreach (sort keys %{$maps_counters}) {
|
||||||
|
$maps_counters->{$_}->{obj}->set(instance => $id);
|
||||||
|
|
||||||
|
my ($value_check) = $maps_counters->{$_}->{obj}->execute(values => $self->{filesystem_id_selected}->{$id});
|
||||||
|
|
||||||
|
if ($value_check != 0) {
|
||||||
|
$long_msg .= $long_msg_append . $maps_counters->{$_}->{obj}->output_error();
|
||||||
|
$long_msg_append = ', ';
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
my $exit2 = $maps_counters->{$_}->{obj}->threshold_check();
|
||||||
|
push @exits, $exit2;
|
||||||
|
|
||||||
|
my $output = $maps_counters->{$_}->{obj}->output();
|
||||||
|
$long_msg .= $long_msg_append . $output;
|
||||||
|
$long_msg_append = ', ';
|
||||||
|
|
||||||
|
if (!$self->{output}->is_status(litteral => 1, value => $exit2, compare => 'ok')) {
|
||||||
|
$short_msg .= $short_msg_append . $output;
|
||||||
|
$short_msg_append = ', ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$maps_counters->{$_}->{obj}->perfdata(extra_instance => $multiple);
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Filesystem '" . $self->{filesystem_id_selected}->{$id}->{display} . "' $long_msg");
|
||||||
|
my $exit = $self->{output}->get_most_critical(status => [ @exits ]);
|
||||||
|
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => "Filesystem '" . $self->{filesystem_id_selected}->{$id}->{display} . "' $short_msg"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($multiple == 0) {
|
||||||
|
$self->{output}->output_add(short_msg => "Filesystem '" . $self->{filesystem_id_selected}->{$id}->{display} . "' $long_msg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub add_result {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{filesystem_id_selected}->{$options{instance}} = {};
|
||||||
|
$self->{filesystem_id_selected}->{$options{instance}}->{display} = $self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemResourceName . '.' . $options{instance}};
|
||||||
|
$self->{filesystem_id_selected}->{$options{instance}}->{free} = int($self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemSpaceAvail . '.' . $options{instance}} * 1024 * 1024 * 1024);
|
||||||
|
$self->{filesystem_id_selected}->{$options{instance}}->{used} = int($self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemSpaceUsed . '.' . $options{instance}} * 1024 * 1024 * 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => [
|
||||||
|
{ oid => $oid_sysDescr },
|
||||||
|
{ oid => $oid_fileSystemSpaceEntry },
|
||||||
|
],
|
||||||
|
, nothing_quit => 1);
|
||||||
|
if (!($self->{os_version} = storage::emc::DataDomain::lib::functions::get_version(value => $self->{results}->{$oid_sysDescr}->{$oid_sysDescr . '.0'}))) {
|
||||||
|
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => 'Cannot get DataDomain OS version.');
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||||
|
$oid_fileSystemResourceName = '.1.3.6.1.4.1.19746.1.3.2.1.1.3';
|
||||||
|
$oid_fileSystemSpaceUsed = '.1.3.6.1.4.1.19746.1.3.2.1.1.5';
|
||||||
|
$oid_fileSystemSpaceAvail = '.1.3.6.1.4.1.19746.1.3.2.1.1.6';
|
||||||
|
} else {
|
||||||
|
$oid_fileSystemResourceName = '.1.3.6.1.4.1.19746.1.3.2.1.1.2';
|
||||||
|
$oid_fileSystemSpaceUsed = '.1.3.6.1.4.1.19746.1.3.2.1.1.4';
|
||||||
|
$oid_fileSystemSpaceAvail = '.1.3.6.1.4.1.19746.1.3.2.1.1.5';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{filesystem})) {
|
||||||
|
if (!defined($self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemResourceName . '.' . $self->{option_results}->{filesystem}})) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No filesystem found for id '" . $self->{option_results}->{filesystem} . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->add_result(instance => $self->{option_results}->{filesystem});
|
||||||
|
} else {
|
||||||
|
foreach my $oid (keys %{$self->{results}->{$oid_fileSystemSpaceEntry}}) {
|
||||||
|
next if ($oid !~ /^$oid_fileSystemResourceName\.(\d+)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $filter_name = $self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemResourceName . '.' . $instance};
|
||||||
|
if (!defined($self->{option_results}->{filesystem})) {
|
||||||
|
$self->add_result(instance => $instance);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if (defined($self->{option_results}->{use_regexp}) && defined($self->{option_results}->{use_regexpi}) && $filter_name =~ /$self->{option_results}->{filesystem}/i) {
|
||||||
|
$self->add_result(instance => $instance);
|
||||||
|
}
|
||||||
|
if (defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) && $filter_name =~ /$self->{option_results}->{filesystem}/) {
|
||||||
|
$self->add_result(instance => $instance);
|
||||||
|
}
|
||||||
|
if (!defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) && $filter_name eq $self->{option_results}->{filesystem}) {
|
||||||
|
$self->add_result(instance => $instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(keys %{$self->{filesystem_id_selected}}) <= 0 && !defined($options{disco})) {
|
||||||
|
if (defined($self->{option_results}->{device})) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No filesystem found '" . $self->{option_results}->{filesystem} . "'.");
|
||||||
|
} else {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No filesystem found.");
|
||||||
|
}
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub disco_format {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{output}->add_disco_format(elements => ['name', 'deviceid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub disco_show {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
# $options{snmp} = snmp object
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
$self->manage_selection(disco => 1);
|
||||||
|
foreach (sort keys %{$self->{filesystem_id_selected}}) {
|
||||||
|
$self->{output}->add_disco_entry(name => $self->{filesystem_id_selected}->{$_}->{display},
|
||||||
|
deviceid => $_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check filesystem usages.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--warning-usage>
|
||||||
|
|
||||||
|
Threshold warning in percent.
|
||||||
|
|
||||||
|
=item B<--critical-usage>
|
||||||
|
|
||||||
|
Threshold critical in percent
|
||||||
|
|
||||||
|
=item B<--filesystem>
|
||||||
|
|
||||||
|
Set the filesystem (number expected) ex: 1, 2,... (empty means 'check all filesystems').
|
||||||
|
|
||||||
|
=item B<--name>
|
||||||
|
|
||||||
|
Allows to use filesystem name with option --filesystem instead of devoce oid index.
|
||||||
|
|
||||||
|
=item B<--regexp>
|
||||||
|
|
||||||
|
Allows to use regexp to filter filesystems (with option --name).
|
||||||
|
|
||||||
|
=item B<--regexp-isensitive>
|
||||||
|
|
||||||
|
Allows to use regexp non case-sensitive to filter filesystems (with option --name).
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
369
storage/emc/DataDomain/mode/hardware.pm
Normal file
369
storage/emc/DataDomain/mode/hardware.pm
Normal file
@ -0,0 +1,369 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::emc::DataDomain::mode::hardware;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use storage::emc::DataDomain::lib::functions;
|
||||||
|
use storage::emc::DataDomain::mode::components::temperature;
|
||||||
|
use storage::emc::DataDomain::mode::components::psu;
|
||||||
|
use storage::emc::DataDomain::mode::components::fan;
|
||||||
|
use storage::emc::DataDomain::mode::components::disk;
|
||||||
|
use storage::emc::DataDomain::mode::components::battery;
|
||||||
|
|
||||||
|
my $oid_sysDescr = '.1.3.6.1.2.1.1.1'; # 'Data Domain OS 5.4.1.1-411752'
|
||||||
|
my $oid_powerModuleEntry = '.1.3.6.1.4.1.19746.1.1.1.1.1.1';
|
||||||
|
my $oid_temperatureSensorEntry = '.1.3.6.1.4.1.19746.1.1.2.1.1.1';
|
||||||
|
my $oid_fanPropertiesEntry = '.1.3.6.1.4.1.19746.1.1.3.1.1.1';
|
||||||
|
my $oid_nvramBatteryEntry = '.1.3.6.1.4.1.19746.1.2.3.1.1';
|
||||||
|
|
||||||
|
my $thresholds = {
|
||||||
|
fan => [
|
||||||
|
['notfound', 'OK'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
temperature => [
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
['notfound', 'OK'],
|
||||||
|
['absent', 'OK'],
|
||||||
|
['overheatWarning', 'WARNING'],
|
||||||
|
['overheatCritical', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
psu => [
|
||||||
|
['absent', 'OK'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
['faulty', 'WARNING'],
|
||||||
|
['acnone', 'WARNING'],
|
||||||
|
['unknown', 'UNKNOWN'],
|
||||||
|
],
|
||||||
|
disk => [
|
||||||
|
['ok', 'OK'],
|
||||||
|
['spare', 'OK'],
|
||||||
|
['available', 'OK'],
|
||||||
|
['unknown', 'UNKNOWN'],
|
||||||
|
['absent', 'OK'],
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
battery => [
|
||||||
|
['ok', 'OK'],
|
||||||
|
['disabled', 'OK'],
|
||||||
|
['discharged', 'WARNING'],
|
||||||
|
['softdisabled', 'OK'],
|
||||||
|
['UNKNOWN', 'UNKNOWN'],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
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' },
|
||||||
|
"absent-problem:s" => { name => 'absent' },
|
||||||
|
"no-component:s" => { name => 'no_component' },
|
||||||
|
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||||
|
"warning:s@" => { name => 'warning' },
|
||||||
|
"critical:s@" => { name => 'critical' },
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->{components} = {};
|
||||||
|
$self->{no_components} = undef;
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{no_component})) {
|
||||||
|
if ($self->{option_results}->{no_component} ne '') {
|
||||||
|
$self->{no_components} = $self->{option_results}->{no_component};
|
||||||
|
} else {
|
||||||
|
$self->{no_components} = 'critical';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{overload_th} = {};
|
||||||
|
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||||
|
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my ($section, $status, $filter) = ($1, $2, $3);
|
||||||
|
if ($self->{output}->is_litteral_status(status => $status) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
|
||||||
|
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{numeric_threshold} = {};
|
||||||
|
foreach my $option (('warning', 'critical')) {
|
||||||
|
foreach my $val (@{$self->{option_results}->{$option}}) {
|
||||||
|
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my ($section, $regexp, $value) = ($1, $2, $3);
|
||||||
|
if ($section !~ /(battery|temperature)/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: battery or temperature).");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my $position = 0;
|
||||||
|
if (defined($self->{numeric_threshold}->{$section})) {
|
||||||
|
$position = scalar(@{$self->{numeric_threshold}->{$section}});
|
||||||
|
}
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section}));
|
||||||
|
push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
# $options{snmp} = snmp object
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
|
$self->{results_leef} = $self->{snmp}->get_leef(oids => [ $oid_sysDescr . '.0' ]);
|
||||||
|
if (!($self->{os_version} = storage::emc::DataDomain::lib::functions::get_version(value => $self->{results_leef}->{$oid_sysDescr . '.0'}))) {
|
||||||
|
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => 'Cannot get DataDomain OS version.');
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
my $oid_diskPropState;
|
||||||
|
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||||
|
$oid_diskPropState = '.1.3.6.1.4.1.19746.1.6.1.1.1.8';
|
||||||
|
} else {
|
||||||
|
$oid_diskPropState = '.1.3.6.1.4.1.19746.1.6.1.1.1.7';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => [
|
||||||
|
{ oid => $oid_powerModuleEntry },
|
||||||
|
{ oid => $oid_temperatureSensorEntry },
|
||||||
|
{ oid => $oid_fanPropertiesEntry },
|
||||||
|
{ oid => $oid_diskPropState },
|
||||||
|
{ oid => $oid_nvramBatteryEntry },
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => 'DataDomain OS version: ' . $self->{os_version} . '.');
|
||||||
|
if ($self->{option_results}->{component} eq 'all') {
|
||||||
|
storage::emc::DataDomain::mode::components::psu::check($self);
|
||||||
|
storage::emc::DataDomain::mode::components::fan::check($self);
|
||||||
|
storage::emc::DataDomain::mode::components::disk::check($self);
|
||||||
|
storage::emc::DataDomain::mode::components::temperature::check($self);
|
||||||
|
storage::emc::DataDomain::mode::components::battery::check($self);
|
||||||
|
} elsif ($self->{option_results}->{component} eq 'fan') {
|
||||||
|
storage::emc::DataDomain::mode::components::fan::check($self);
|
||||||
|
} elsif ($self->{option_results}->{component} eq 'psu') {
|
||||||
|
storage::emc::DataDomain::mode::components::psu::check($self);
|
||||||
|
} elsif ($self->{option_results}->{component} eq 'disk') {
|
||||||
|
storage::emc::DataDomain::mode::components::disk::check($self);
|
||||||
|
} elsif ($self->{option_results}->{component} eq 'temperature') {
|
||||||
|
storage::emc::DataDomain::mode::components::temperature::check($self);
|
||||||
|
} elsif ($self->{option_results}->{component} eq 'battery') {
|
||||||
|
storage::emc::DataDomain::mode::components::battery::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 && $self->{components}->{$comp}->{skip} == 0);
|
||||||
|
$total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||||
|
my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||||
|
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name};
|
||||||
|
$display_by_component_append = ', ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => sprintf("All %s components are ok [%s].",
|
||||||
|
$total_components,
|
||||||
|
$display_by_component)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||||
|
$self->{output}->output_add(severity => $self->{no_components},
|
||||||
|
short_msg => 'No components are checked.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_exclude {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($options{instance})) {
|
||||||
|
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) {
|
||||||
|
$self->{components}->{$options{section}}->{skip}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance."));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) {
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section."));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub absent_problem {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{absent}) &&
|
||||||
|
$self->{option_results}->{absent} =~ /(^|\s|,)($options{section}(\s*,|$)|${options{section}}[^,]*#\Q$options{instance}\E#)/) {
|
||||||
|
$self->{output}->output_add(severity => 'CRITICAL',
|
||||||
|
short_msg => sprintf("Component '%s' instance '%s' is not present",
|
||||||
|
$options{section}, $options{instance}));
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance (not present)"));
|
||||||
|
$self->{components}->{$options{section}}->{skip}++;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_severity_numeric {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'OK'; # default
|
||||||
|
my $thresholds = { warning => undef, critical => undef };
|
||||||
|
|
||||||
|
if (defined($self->{numeric_threshold}->{$options{section}})) {
|
||||||
|
my $exits = [];
|
||||||
|
foreach (@{$self->{numeric_threshold}->{$options{section}}}) {
|
||||||
|
if ($options{instance} =~ /$_->{regexp}/) {
|
||||||
|
push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]);
|
||||||
|
$thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($status, $thresholds->{warning}, $thresholds->{critical});
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_severity {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'UNKNOWN'; # default
|
||||||
|
|
||||||
|
if (defined($self->{overload_th}->{$options{section}})) {
|
||||||
|
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||||
|
if ($options{value} =~ /$_->{filter}/i) {
|
||||||
|
$status = $_->{status};
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (@{$thresholds->{$options{section}}}) {
|
||||||
|
if ($options{value} =~ /$$_[0]/i) {
|
||||||
|
$status = $$_[1];
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check components (Fans, Power Supplies, Temperatures, Disks, Nvram Batteries).
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--component>
|
||||||
|
|
||||||
|
Which component to check (Default: 'all').
|
||||||
|
Can be: 'psu', 'fan', 'disk', 'temperature', 'battery'.
|
||||||
|
|
||||||
|
=item B<--exclude>
|
||||||
|
|
||||||
|
Exclude some parts (comma seperated list) (Example: --exclude=psu)
|
||||||
|
Can also exclude specific instance: --exclude='psu#3.3#'
|
||||||
|
|
||||||
|
=item B<--absent-problem>
|
||||||
|
|
||||||
|
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
||||||
|
Can be specific or global: --absent-problem=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,status,regexp)
|
||||||
|
It used before default thresholds (order stays).
|
||||||
|
Example: --threshold-overload='fan,CRITICAL,^(?!(ok)$)'
|
||||||
|
|
||||||
|
=item B<--warning>
|
||||||
|
|
||||||
|
Set warning threshold for temperatures (syntax: regexp,treshold)
|
||||||
|
Example: --warning='.*,20'
|
||||||
|
|
||||||
|
=item B<--critical>
|
||||||
|
|
||||||
|
Set critical threshold for temperatures and battery charge (syntax: type,regexp,treshold)
|
||||||
|
Example: --critical='temperature,1.1,25' --critical='battery,.*,20:'
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
@ -1,153 +0,0 @@
|
|||||||
################################################################################
|
|
||||||
# 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 storage::emc::DataDomain::mode::nvrambattery;
|
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
my %conditions = (
|
|
||||||
1 => ['ok', 'OK'],
|
|
||||||
2 => ['disabled', 'OK'],
|
|
||||||
3 => ['discharged', 'WARNING'],
|
|
||||||
4 => ['unknown', 'UNKNOWN'],
|
|
||||||
5 => ['soft disabled', 'OK'],
|
|
||||||
);
|
|
||||||
|
|
||||||
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 =>
|
|
||||||
{
|
|
||||||
"warning:s" => { name => 'warning', },
|
|
||||||
"critical:s" => { name => 'critical', },
|
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub check_options {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
$self->SUPER::init(%options);
|
|
||||||
|
|
||||||
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
|
|
||||||
$self->{output}->add_option_msg(short_msg => "Wrong warning (5sec) threshold '" . $self->{option_results}->{warning} . "'.");
|
|
||||||
$self->{output}->option_exit();
|
|
||||||
}
|
|
||||||
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
|
|
||||||
$self->{output}->add_option_msg(short_msg => "Wrong critical (5sec) threshold '" . $self->{option_results}->{critical} . "'.");
|
|
||||||
$self->{output}->option_exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub run {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
# $options{snmp} = snmp object
|
|
||||||
$self->{snmp} = $options{snmp};
|
|
||||||
|
|
||||||
my $oid_nvramBatteryEntry = '.1.3.6.1.4.1.19746.1.2.3.1.1';
|
|
||||||
my $oid_nvramBatteryStatus = '.1.3.6.1.4.1.19746.1.2.3.1.1.2';
|
|
||||||
my $oid_nvramBatteryCharge = '.1.3.6.1.4.1.19746.1.2.3.1.1.3';
|
|
||||||
my $result = $self->{snmp}->get_table(oid => $oid_nvramBatteryEntry, nothing_quit => 1);
|
|
||||||
|
|
||||||
$self->{output}->output_add(severity => 'OK',
|
|
||||||
short_msg => 'All nvram batteries are ok.');
|
|
||||||
|
|
||||||
foreach my $oid (keys %$result) {
|
|
||||||
next if ($oid !~ /^$oid_nvramBatteryStatus/);
|
|
||||||
$oid =~ /\.([0-9]+)$/;
|
|
||||||
my $instance = $1;
|
|
||||||
|
|
||||||
my $status = $result->{$oid_nvramBatteryStatus . '.' . $instance};
|
|
||||||
my $charge = $result->{$oid_nvramBatteryCharge . '.' . $instance};
|
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("nvram battery '%s' status is %s.",
|
|
||||||
$instance, ${$conditions{$status}}[0]));
|
|
||||||
if (!$self->{output}->is_status(litteral => 1, value => ${$conditions{$status}}[1], compare => 'ok')) {
|
|
||||||
$self->{output}->output_add(severity => ${$conditions{$status}}[1],
|
|
||||||
short_msg => sprintf("nvram battery '%s' status is %s", $instance, ${$conditions{$status}}[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check only if ok
|
|
||||||
if ($status == 1) {
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $charge,
|
|
||||||
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("nvram battery '%s' charge is %s %%", $instance,
|
|
||||||
$charge));
|
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
|
||||||
$self->{output}->output_add(severity => $exit,
|
|
||||||
short_msg => sprintf("nvram battery '%s' charge is %s %%", $instance,
|
|
||||||
$charge));
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => 'nvram_battery_' . $instance, unit => '%',
|
|
||||||
value => $charge,
|
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
|
||||||
min => 0, max => 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->{output}->display();
|
|
||||||
$self->{output}->exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
||||||
|
|
||||||
__END__
|
|
||||||
|
|
||||||
=head1 MODE
|
|
||||||
|
|
||||||
Check nvram Batteries status and charge percentage (DATA-DOMAIN-MIB).
|
|
||||||
|
|
||||||
=over 8
|
|
||||||
|
|
||||||
=item B<--warning>
|
|
||||||
|
|
||||||
Threshold warning in percent (for charge).
|
|
||||||
|
|
||||||
=item B<--critical>
|
|
||||||
|
|
||||||
Threshold critical in percent (for charge).
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
@ -47,8 +47,8 @@ sub new {
|
|||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
%{$self->{modes}} = (
|
%{$self->{modes}} = (
|
||||||
'environment' => 'storage::emc::DataDomain::mode::environment',
|
'hardware' => 'storage::emc::DataDomain::mode::hardware',
|
||||||
'nvram-battery' => 'storage::emc::DataDomain::mode::nvrambattery',
|
'filesystem-usage' => 'storage::emc::DataDomain::mode::filesystem',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
85
storage/netapp/mode/components/communication.pm
Normal file
85
storage/netapp/mode/components/communication.pm
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::netapp::mode::components::communication;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_com_states = (
|
||||||
|
1 => 'initializing',
|
||||||
|
2 => 'transitioning',
|
||||||
|
3 => 'active',
|
||||||
|
4 => 'inactive',
|
||||||
|
5 => 'reconfiguring',
|
||||||
|
6 => 'nonexistent',
|
||||||
|
);
|
||||||
|
my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
|
||||||
|
my $oid_enclContactState = '.1.3.6.1.4.1.789.1.21.1.2.1.2';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_enclContactState };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking communications");
|
||||||
|
$self->{components}->{communication} = {name => 'communications', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'communication'));
|
||||||
|
|
||||||
|
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
||||||
|
my $shelf_addr = $self->{shelf_addr}->{$oid_enclChannelShelfAddr . '.' . $i};
|
||||||
|
my $com_state = $map_com_states{$self->{results}->{$oid_enclContactState}->{$oid_enclContactState . '.' . $i}};
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'communication', instance => $shelf_addr));
|
||||||
|
|
||||||
|
$self->{components}->{communication}->{total}++;
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' communication state is '%s'",
|
||||||
|
$shelf_addr, $com_state));
|
||||||
|
my $exit = $self->get_severity(section => 'communication', value => $com_state);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Shelve '%s' communication state is '%s'",
|
||||||
|
$shelf_addr, $com_state));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
89
storage/netapp/mode/components/electronics.pm
Normal file
89
storage/netapp/mode/components/electronics.pm
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::netapp::mode::components::electronics;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
|
||||||
|
my $oid_enclElectronicsPresent = '.1.3.6.1.4.1.789.1.21.1.2.1.31';
|
||||||
|
my $oid_enclElectronicsFailed = '.1.3.6.1.4.1.789.1.21.1.2.1.33';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_enclElectronicsPresent };
|
||||||
|
push @{$options{request}}, { oid => $oid_enclElectronicsFailed };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking electronics");
|
||||||
|
$self->{components}->{electronics} = {name => 'electronics', total => 0, skip => 0};
|
||||||
|
return if ($self->check_exclude(section => 'electronics'));
|
||||||
|
|
||||||
|
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
||||||
|
my $shelf_addr = $self->{shelf_addr}->{$oid_enclChannelShelfAddr . '.' . $i};
|
||||||
|
my $present = $self->{results}->{$oid_enclElectronicsPresent}->{$oid_enclElectronicsPresent . '.' . $i};
|
||||||
|
my $failed = $self->{results}->{$oid_enclElectronicsFailed}->{$oid_enclElectronicsFailed . '.' . $i};
|
||||||
|
|
||||||
|
foreach my $num (split /,/, $present) {
|
||||||
|
$num = centreon::plugins::misc::trim($num);
|
||||||
|
next if ($num !~ /[0-9]/);
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'electronics', instance => $shelf_addr . '.' . $num));
|
||||||
|
$self->{components}->{electronics}->{total}++;
|
||||||
|
|
||||||
|
my $status = 'ok';
|
||||||
|
if ($failed =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'failed';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' electronics '%s' is '%s'",
|
||||||
|
$shelf_addr, $num, $status));
|
||||||
|
my $exit = $self->get_severity(section => 'electronics', value => $status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Shelve '%s' electronics '%s' is '%s'", $shelf_addr, $num, $status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
107
storage/netapp/mode/components/fan.pm
Normal file
107
storage/netapp/mode/components/fan.pm
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::netapp::mode::components::fan;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
|
||||||
|
my $oid_enclFansPresent = '.1.3.6.1.4.1.789.1.21.1.2.1.17';
|
||||||
|
my $oid_enclFansFailed = '.1.3.6.1.4.1.789.1.21.1.2.1.18';
|
||||||
|
my $oid_enclFansSpeed = '.1.3.6.1.4.1.789.1.21.1.2.1.62';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_enclFansPresent };
|
||||||
|
push @{$options{request}}, { oid => $oid_enclFansFailed };
|
||||||
|
push @{$options{request}}, { oid => $oid_enclFansSpeed };
|
||||||
|
}
|
||||||
|
|
||||||
|
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_exclude(section => 'fan'));
|
||||||
|
|
||||||
|
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
||||||
|
my $shelf_addr = $self->{shelf_addr}->{$oid_enclChannelShelfAddr . '.' . $i};
|
||||||
|
my $present = $self->{results}->{$oid_enclFansPresent}->{$oid_enclFansPresent . '.' . $i};
|
||||||
|
my $failed = $self->{results}->{$oid_enclFansFailed}->{$oid_enclFansFailed . '.' . $i};
|
||||||
|
my @current_speed = split /,/, $self->{results}->{$oid_enclFansSpeed}->{$oid_enclFansSpeed . '.' . $i};
|
||||||
|
|
||||||
|
foreach my $num (split /,/, $present) {
|
||||||
|
$num = centreon::plugins::misc::trim($num);
|
||||||
|
next if ($num !~ /[0-9]/);
|
||||||
|
my $current_value = ($current_speed[$num - 1] =~ /(^|\s)([0-9]+)/) ? $2 : '';
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'fan', instance => $shelf_addr . '.' . $num));
|
||||||
|
$self->{components}->{fan}->{total}++;
|
||||||
|
|
||||||
|
my $status = 'ok';
|
||||||
|
if ($failed =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'failed';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' Fan '%s' is '%s'",
|
||||||
|
$shelf_addr, $num, $status));
|
||||||
|
my $exit = $self->get_severity(section => 'fan', value => $status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Shelve '%s' Fan '%s' is '%s'", $shelf_addr, $num, $status));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($current_value ne '') {
|
||||||
|
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'fan', instance => $shelf_addr . '.' . $num, value => $current_value);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Shelve '%s' Fan '%s' speed is '%s'", $shelf_addr, $num, $current_value));
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->perfdata_add(label => "speed_" . $shelf_addr . "_" . $num, unit => 'rpm',
|
||||||
|
value => $current_value,
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit,
|
||||||
|
min => 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
89
storage/netapp/mode/components/psu.pm
Normal file
89
storage/netapp/mode/components/psu.pm
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::netapp::mode::components::psu;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
|
||||||
|
my $oid_enclPowerSuppliesPresent = '.1.3.6.1.4.1.789.1.21.1.2.1.13';
|
||||||
|
my $oid_enclPowerSuppliesFailed = '.1.3.6.1.4.1.789.1.21.1.2.1.15';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_enclPowerSuppliesPresent };
|
||||||
|
push @{$options{request}}, { oid => $oid_enclPowerSuppliesFailed };
|
||||||
|
}
|
||||||
|
|
||||||
|
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_exclude(section => 'psu'));
|
||||||
|
|
||||||
|
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
||||||
|
my $shelf_addr = $self->{shelf_addr}->{$oid_enclChannelShelfAddr . '.' . $i};
|
||||||
|
my $present = $self->{results}->{$oid_enclPowerSuppliesPresent}->{$oid_enclPowerSuppliesPresent . '.' . $i};
|
||||||
|
my $failed = $self->{results}->{$oid_enclPowerSuppliesFailed}->{$oid_enclPowerSuppliesFailed . '.' . $i};
|
||||||
|
|
||||||
|
foreach my $num (split /,/, $present) {
|
||||||
|
$num = centreon::plugins::misc::trim($num);
|
||||||
|
next if ($num !~ /[0-9]/);
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'psu', instance => $shelf_addr . '.' . $num));
|
||||||
|
$self->{components}->{psu}->{total}++;
|
||||||
|
|
||||||
|
my $status = 'ok';
|
||||||
|
if ($failed =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'failed';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' PSU '%s' is '%s'",
|
||||||
|
$shelf_addr, $num, $status));
|
||||||
|
my $exit = $self->get_severity(section => 'psu', value => $status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Shelve '%s' PSU '%s' is '%s'", $shelf_addr, $num, $status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
152
storage/netapp/mode/components/temperature.pm
Normal file
152
storage/netapp/mode/components/temperature.pm
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::netapp::mode::components::temperature;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_hum_status = (
|
||||||
|
1 => 'noStatus',
|
||||||
|
2 => 'normal',
|
||||||
|
3 => 'highWarning',
|
||||||
|
4 => 'highCritical',
|
||||||
|
5 => 'lowWarning',
|
||||||
|
6 => 'lowCritical',
|
||||||
|
7 => 'sensorError',
|
||||||
|
);
|
||||||
|
my %map_hum_online = (
|
||||||
|
1 => 'online',
|
||||||
|
2 => 'offline',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
enclTempSensorsPresent => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.20' },
|
||||||
|
enclTempSensorsOverTempFail => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.21' },
|
||||||
|
enclTempSensorsOverTempWarn => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.22' },
|
||||||
|
enclTempSensorsUnderTempFail => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.23' },
|
||||||
|
enclTempSensorsUnderTempWarn => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.24' },
|
||||||
|
enclTempSensorsCurrentTemp => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.25' },
|
||||||
|
enclTempSensorsOverTempFailThr => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.26' },
|
||||||
|
enclTempSensorsOverTempWarnThr => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.27' },
|
||||||
|
enclTempSensorsUnderTempFailThr => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.28' },
|
||||||
|
enclTempSensorsUnderTempWarnThr => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.29' },
|
||||||
|
};
|
||||||
|
my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
|
||||||
|
my $oid_enclEntry = '.1.3.6.1.4.1.789.1.21.1.2.1';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_enclEntry, begin => $mapping->{enclTempSensorsPresent}->{oid}, end => $mapping->{enclTempSensorsUnderTempWarnThr}->{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_exclude(section => 'temperature'));
|
||||||
|
|
||||||
|
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclEntry}, instance => $i);
|
||||||
|
my $shelf_addr = $self->{shelf_addr}->{$oid_enclChannelShelfAddr . '.' . $i};
|
||||||
|
my @current_temp = split /,/, $result->{enclTempSensorsCurrentTemp};
|
||||||
|
|
||||||
|
my @warn_under_thr = split /,/, $result->{enclTempSensorsUnderTempWarnThr};
|
||||||
|
my @crit_under_thr = split /,/, $result->{enclTempSensorsUnderTempFailThr};
|
||||||
|
my @warn_over_thr = split /,/, $result->{enclTempSensorsOverTempWarnThr};
|
||||||
|
my @crit_over_thr = split /,/, $result->{enclTempSensorsOverTempFailThr};
|
||||||
|
|
||||||
|
foreach my $num (split /,/, $result->{enclTempSensorsPresent}) {
|
||||||
|
$num = centreon::plugins::misc::trim($num);
|
||||||
|
next if ($num !~ /[0-9]/);
|
||||||
|
|
||||||
|
$warn_under_thr[$num - 1] =~ /(-*[0-9]+)C/;
|
||||||
|
my $wu_thr = $1;
|
||||||
|
$crit_under_thr[$num - 1] =~ /(-*[0-9]+)C/;
|
||||||
|
my $cu_thr = $1;
|
||||||
|
$warn_over_thr[$num - 1] =~ /(-*[0-9]+)C/;
|
||||||
|
my $wo_thr = $1;
|
||||||
|
$crit_over_thr[$num - 1] =~ /(-*[0-9]+)C/;
|
||||||
|
my $co_thr = $1;
|
||||||
|
$current_temp[$num - 1] =~ /(-*[0-9]+)C/;
|
||||||
|
my $current_value = $1;
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'temperature', instance => $shelf_addr . '.' . $num));
|
||||||
|
$self->{components}->{temperature}->{total}++;
|
||||||
|
|
||||||
|
my $status = 'ok';
|
||||||
|
if ($result->{enclTempSensorsUnderTempFailThr} =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'under critical threshold';
|
||||||
|
} elsif ($result->{enclTempSensorsUnderTempWarnThr} =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'under warning threshold';
|
||||||
|
} elsif ($result->{enclTempSensorsOverTempFailThr} =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'over critical threshold';
|
||||||
|
} elsif ($result->{enclTempSensorsOverTempWarnThr} =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'over warning threshold';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' temperature sensor '%s' is %s [current = %s]",
|
||||||
|
$shelf_addr, $num, $status, $current_value));
|
||||||
|
my $exit = $self->get_severity(section => 'temperature', value => $status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Shelve '%s' temperature sensor '%s' is %s",
|
||||||
|
$shelf_addr, $num, $status));
|
||||||
|
}
|
||||||
|
|
||||||
|
my $warn = $wu_thr . ':' . $wo_thr;
|
||||||
|
my $crit = $cu_thr . ':' . $co_thr;
|
||||||
|
my ($exit2, $warn2, $crit2, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $shelf_addr . '.' . $num, value => $current_value);
|
||||||
|
if ($checked == 1) {
|
||||||
|
($warn, $crit) = ($warn2, $crit2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit2,
|
||||||
|
short_msg => sprintf("Shelve '%s' temperature sensor '%s' is %s degree centigrade",
|
||||||
|
$shelf_addr, $num, $current_value));
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->perfdata_add(label => "temp_" . $shelf_addr . "_" . $num, unit => 'C',
|
||||||
|
value => $current_value,
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
147
storage/netapp/mode/components/voltage.pm
Normal file
147
storage/netapp/mode/components/voltage.pm
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 storage::netapp::mode::components::voltage;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my %map_hum_status = (
|
||||||
|
1 => 'noStatus',
|
||||||
|
2 => 'normal',
|
||||||
|
3 => 'highWarning',
|
||||||
|
4 => 'highCritical',
|
||||||
|
5 => 'lowWarning',
|
||||||
|
6 => 'lowCritical',
|
||||||
|
7 => 'sensorError',
|
||||||
|
);
|
||||||
|
my %map_hum_online = (
|
||||||
|
1 => 'online',
|
||||||
|
2 => 'offline',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
enclVoltSensorsPresent => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.35' },
|
||||||
|
enclVoltSensorsOverVoltFail => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.36' },
|
||||||
|
enclVoltSensorsOverVoltWarn => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.37' },
|
||||||
|
enclVoltSensorsUnderVoltFail => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.38' },
|
||||||
|
enclVoltSensorsUnderVoltWarn => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.39' },
|
||||||
|
enclVoltSensorsCurrentVolt => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.40' },
|
||||||
|
enclVoltSensorsOverVoltFailThr => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.41' },
|
||||||
|
enclVoltSensorsOverVoltWarnThr => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.42' },
|
||||||
|
enclVoltSensorsUnderVoltFailThr => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.43' },
|
||||||
|
enclVoltSensorsUnderVoltWarnThr => { oid => '.1.3.6.1.4.1.789.1.21.1.2.1.44' },
|
||||||
|
};
|
||||||
|
my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
|
||||||
|
my $oid_enclTable = '.1.3.6.1.4.1.789.1.21.1.2';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my (%options) = @_;
|
||||||
|
|
||||||
|
push @{$options{request}}, { oid => $oid_enclTable, begin => $mapping->{enclVoltSensorsPresent}->{oid}, end => $mapping->{enclVoltSensorsUnderVoltWarnThr}->{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_exclude(section => 'voltage'));
|
||||||
|
|
||||||
|
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclTable}, instance => $i);
|
||||||
|
my $shelf_addr = $self->{shelf_addr}->{$oid_enclChannelShelfAddr . '.' . $i};
|
||||||
|
my @current_volt = split /,/, $result->{enclVoltSensorsCurrentVolt};
|
||||||
|
|
||||||
|
my @warn_under_thr = split /,/, $result->{enclVoltSensorsUnderVoltWarnThr};
|
||||||
|
my @crit_under_thr = split /,/, $result->{enclVoltSensorsUnderVoltFailThr};
|
||||||
|
my @warn_over_thr = split /,/, $result->{enclVoltSensorsOverVoltWarnThr};
|
||||||
|
my @crit_over_thr = split /,/, $result->{enclVoltSensorsOverVoltFailThr};
|
||||||
|
|
||||||
|
foreach my $num (split /,/, $result->{enclVoltSensorsPresent}) {
|
||||||
|
$num = centreon::plugins::misc::trim($num);
|
||||||
|
next if ($num !~ /[0-9]/);
|
||||||
|
|
||||||
|
my $wu_thr = (defined($warn_under_thr[$num - 1]) && $warn_under_thr[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
||||||
|
my $cu_thr = (defined($crit_under_thr[$num - 1]) && $crit_under_thr[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
||||||
|
my $wo_thr = (defined($warn_over_thr[$num - 1]) && $warn_over_thr[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
||||||
|
my $co_thr = (defined($crit_over_thr[$num - 1]) && $crit_over_thr[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
||||||
|
my $current_value = ($current_volt[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
||||||
|
|
||||||
|
next if ($self->check_exclude(section => 'voltage', instance => $shelf_addr . '.' . $num));
|
||||||
|
$self->{components}->{voltage}->{total}++;
|
||||||
|
|
||||||
|
my $status = 'ok';
|
||||||
|
if ($result->{enclVoltSensorsUnderVoltFailThr} =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'under critical threshold';
|
||||||
|
} elsif ($result->{enclVoltSensorsUnderVoltWarnThr} =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'under warning threshold';
|
||||||
|
} elsif ($result->{enclVoltSensorsOverVoltFailThr} =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'over critical threshold';
|
||||||
|
} elsif ($result->{enclVoltSensorsOverVoltWarnThr} =~ /(^|,|\s)$num(,|\s|$)/) {
|
||||||
|
$status = 'over warning threshold';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' voltage sensor '%s' is %s [current = %s]",
|
||||||
|
$shelf_addr, $num, $status, $current_value));
|
||||||
|
my $exit = $self->get_severity(section => 'voltage', value => $status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Shelve '%s' voltage sensor '%s' is %s",
|
||||||
|
$shelf_addr, $num, $status));
|
||||||
|
}
|
||||||
|
|
||||||
|
my $warn = $wu_thr . ':' . $wo_thr;
|
||||||
|
my $crit = $cu_thr . ':' . $co_thr;
|
||||||
|
my ($exit2, $warn2, $crit2, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $shelf_addr . '.' . $num, value => $current_value);
|
||||||
|
if ($checked == 1) {
|
||||||
|
($warn, $crit) = ($warn2, $crit2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit2,
|
||||||
|
short_msg => sprintf("Shelve '%s' voltage sensor '%s' is %s mV",
|
||||||
|
$shelf_addr, $num, $current_value));
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->perfdata_add(label => "volt_" . $shelf_addr . "_" . $num, unit => 'mV',
|
||||||
|
value => $current_value,
|
||||||
|
warning => $warn,
|
||||||
|
critical => $crit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
@ -39,6 +39,39 @@ use base qw(centreon::plugins::mode);
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use centreon::plugins::statefile;
|
||||||
|
use centreon::plugins::values;
|
||||||
|
|
||||||
|
my $maps_counters = {
|
||||||
|
read => { class => 'centreon::plugins::values', obj => undef,
|
||||||
|
set => {
|
||||||
|
key_values => [
|
||||||
|
{ name => 'read', diff => 1 },
|
||||||
|
],
|
||||||
|
per_second => 1,
|
||||||
|
output_template => 'Read I/O : %s %s/s',
|
||||||
|
output_change_bytes => 1,
|
||||||
|
perfdatas => [
|
||||||
|
{ value => 'read_per_second', template => '%d',
|
||||||
|
unit => 'B/s', min => 0 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
write => { class => 'centreon::plugins::values', obj => undef,
|
||||||
|
set => {
|
||||||
|
key_values => [
|
||||||
|
{ name => 'write', diff => 1 },
|
||||||
|
],
|
||||||
|
per_second => 1,
|
||||||
|
output_template => 'Write I/O : %s %s/s',
|
||||||
|
output_change_bytes => 1,
|
||||||
|
perfdatas => [
|
||||||
|
{ value => 'write_per_second', template => '%d',
|
||||||
|
unit => 'B/s', min => 0 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
my %states = (
|
my %states = (
|
||||||
1 => ['other', 'WARNING'],
|
1 => ['other', 'WARNING'],
|
||||||
@ -49,6 +82,15 @@ my %states = (
|
|||||||
6 => ['nonRecoverable', 'WARNING'],
|
6 => ['nonRecoverable', 'WARNING'],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my $oid_miscGlobalStatus = '.1.3.6.1.4.1.789.1.2.2.4.0';
|
||||||
|
my $oid_miscGlobalStatusMessage = '.1.3.6.1.4.1.789.1.2.2.25.0';
|
||||||
|
my $oid_misc64DiskReadBytes = '.1.3.6.1.4.1.789.1.2.2.32.0';
|
||||||
|
my $oid_misc64DiskWriteBytes = '.1.3.6.1.4.1.789.1.2.2.33.0';
|
||||||
|
my $oid_miscHighDiskReadBytes = '.1.3.6.1.4.1.789.1.2.2.15.0';
|
||||||
|
my $oid_miscLowDiskReadBytes = '.1.3.6.1.4.1.789.1.2.2.16.0';
|
||||||
|
my $oid_miscHighDiskWriteBytes = '.1.3.6.1.4.1.789.1.2.2.17.0';
|
||||||
|
my $oid_miscLowDiskWriteBytes = '.1.3.6.1.4.1.789.1.2.2.18.0';
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
@ -59,41 +101,133 @@ sub new {
|
|||||||
{
|
{
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
|
||||||
|
foreach (keys %{$maps_counters}) {
|
||||||
|
$options{options}->add_options(arguments => {
|
||||||
|
'warning-' . $_ . ':s' => { name => 'warning-' . $_ },
|
||||||
|
'critical-' . $_ . ':s' => { name => 'critical-' . $_ },
|
||||||
|
});
|
||||||
|
my $class = $maps_counters->{$_}->{class};
|
||||||
|
$maps_counters->{$_}->{obj} = $class->new(statefile => $self->{statefile_value},
|
||||||
|
output => $self->{output}, perfdata => $self->{perfdata},
|
||||||
|
label => $_);
|
||||||
|
$maps_counters->{$_}->{obj}->set(%{$maps_counters->{$_}->{set}});
|
||||||
|
}
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
sub check_options {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
$self->SUPER::init(%options);
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
foreach (keys %{$maps_counters}) {
|
||||||
|
$maps_counters->{$_}->{obj}->init(option_results => $self->{option_results});
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{statefile_value}->check_options(%options);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
$self->{hostname} = $self->{snmp}->get_hostname();
|
||||||
|
$self->{snmp_port} = $self->{snmp}->get_port();
|
||||||
|
|
||||||
my $oid_miscGlobalStatus = '.1.3.6.1.4.1.789.1.2.2.4.0';
|
$self->manage_selection();
|
||||||
my $oid_miscGlobalStatusMessage = '.1.3.6.1.4.1.789.1.2.2.25.0';
|
|
||||||
my $result = $self->{snmp}->get_leef(oids => [$oid_miscGlobalStatus, $oid_miscGlobalStatusMessage], nothing_quit => 1);
|
|
||||||
|
|
||||||
$self->{output}->output_add(severity => ${$states{$result->{$oid_miscGlobalStatus}}}[1],
|
$self->{output}->output_add(severity => ${$states{$self->{results}->{$oid_miscGlobalStatus}}}[1],
|
||||||
short_msg => sprintf("Overall global status is '%s' [message: '%s']",
|
short_msg => sprintf("Overall global status is '%s' [message: '%s']",
|
||||||
${$states{$result->{$oid_miscGlobalStatus}}}[0], $result->{$oid_miscGlobalStatusMessage}));
|
${$states{$self->{results}->{$oid_miscGlobalStatus}}}[0], $self->{results}->{$oid_miscGlobalStatusMessage}));
|
||||||
|
|
||||||
|
$self->{new_datas} = {};
|
||||||
|
$self->{statefile_value}->read(statefile => "cache_netapp_" . $self->{hostname} . '_' . $self->{snmp_port} . '_' . $self->{mode});
|
||||||
|
$self->{new_datas}->{last_timestamp} = time();
|
||||||
|
|
||||||
|
my ($short_msg, $short_msg_append, $long_msg, $long_msg_append) = ('', '', '', '');
|
||||||
|
my @exits;
|
||||||
|
foreach (sort keys %{$maps_counters}) {
|
||||||
|
$maps_counters->{$_}->{obj}->set(instance => 'global');
|
||||||
|
|
||||||
|
my ($value_check) = $maps_counters->{$_}->{obj}->execute(values => $self->{global},
|
||||||
|
new_datas => $self->{new_datas});
|
||||||
|
|
||||||
|
if ($value_check != 0) {
|
||||||
|
$long_msg .= $long_msg_append . $maps_counters->{$_}->{obj}->output_error();
|
||||||
|
$long_msg_append = ', ';
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
my $exit2 = $maps_counters->{$_}->{obj}->threshold_check();
|
||||||
|
push @exits, $exit2;
|
||||||
|
|
||||||
|
my $output = $maps_counters->{$_}->{obj}->output();
|
||||||
|
$long_msg .= $long_msg_append . $output;
|
||||||
|
$long_msg_append = ', ';
|
||||||
|
|
||||||
|
if (!$self->{output}->is_status(litteral => 1, value => $exit2, compare => 'ok')) {
|
||||||
|
$short_msg .= $short_msg_append . $output;
|
||||||
|
$short_msg_append = ', ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$maps_counters->{$_}->{obj}->perfdata();
|
||||||
|
}
|
||||||
|
|
||||||
|
my $exit = $self->{output}->get_most_critical(status => [ @exits ]);
|
||||||
|
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => "$short_msg"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$self->{output}->output_add(short_msg => "$long_msg");
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{statefile_value}->write(data => $self->{new_datas});
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $request = [$oid_miscGlobalStatus, $oid_miscGlobalStatusMessage,
|
||||||
|
$oid_miscHighDiskReadBytes, $oid_miscLowDiskReadBytes,
|
||||||
|
$oid_miscHighDiskWriteBytes, $oid_miscLowDiskWriteBytes];
|
||||||
|
if (!$self->{snmp}->is_snmpv1()) {
|
||||||
|
push @{$request}, ($oid_misc64DiskReadBytes, $oid_misc64DiskWriteBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{results} = $self->{snmp}->get_leef(oids => $request, nothing_quit => 1);
|
||||||
|
|
||||||
|
$self->{global} = {};
|
||||||
|
$self->{global}->{read} = defined($self->{results}->{$oid_misc64DiskReadBytes}) ?
|
||||||
|
$self->{results}->{$oid_misc64DiskReadBytes} :
|
||||||
|
($self->{results}->{$oid_miscHighDiskReadBytes} << 32) + $self->{results}->{$oid_miscLowDiskReadBytes};
|
||||||
|
$self->{global}->{write} = defined($self->{results}->{$oid_misc64DiskWriteBytes}) ?
|
||||||
|
$self->{results}->{$oid_misc64DiskWriteBytes} :
|
||||||
|
($self->{results}->{$oid_miscHighDiskWriteBytes} << 32) + $self->{results}->{$oid_miscLowDiskWriteBytes};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
=head1 MODE
|
=head1 MODE
|
||||||
|
|
||||||
Check the overall status of the appliance.
|
Check the overall status of the appliance and some metrics (total read bytes per seconds and total write bytes per seconds).
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
=item B<--warning-*>
|
||||||
|
|
||||||
|
Threshold warning.
|
||||||
|
Can be: 'read', 'write'.
|
||||||
|
|
||||||
|
=item B<--critical-*>
|
||||||
|
|
||||||
|
Threshold critical.
|
||||||
|
Can be: 'read', 'write'.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
@ -41,45 +41,45 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::misc;
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
my %com_states = (
|
my $thresholds = {
|
||||||
1 => ['initializing', 'WARNING'],
|
communication => [
|
||||||
2 => ['transitioning', 'WARNING'],
|
['initializing', 'WARNING'],
|
||||||
3 => ['active', 'OK'],
|
['transitioning', 'WARNING'],
|
||||||
4 => ['inactive', 'CRITICAL'],
|
['inactive', 'CRITICAL'],
|
||||||
5 => ['reconfiguring', 'WARNING'],
|
['reconfiguring', 'WARNING'],
|
||||||
6 => ['nonexistent', 'CRITICAL'],
|
['nonexistent', 'CRITICAL'],
|
||||||
);
|
['active', 'OK'],
|
||||||
|
],
|
||||||
|
fan => [
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
],
|
||||||
|
psu => [
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
],
|
||||||
|
electronics => [
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
],
|
||||||
|
voltage => [
|
||||||
|
['under critical threshold', 'CRITICAL'],
|
||||||
|
['under warning threshold', 'WARNING'],
|
||||||
|
['over critical threshold', 'CRITICAL'],
|
||||||
|
['over warning threshold', 'WARNING'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
],
|
||||||
|
temperature => [
|
||||||
|
['under critical threshold', 'CRITICAL'],
|
||||||
|
['under warning threshold', 'WARNING'],
|
||||||
|
['over critical threshold', 'CRITICAL'],
|
||||||
|
['over warning threshold', 'WARNING'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
my $oid_enclNumber = '.1.3.6.1.4.1.789.1.21.1.1.0';
|
my $oid_enclNumber = '.1.3.6.1.4.1.789.1.21.1.1';
|
||||||
my $oid_enclContactState = '.1.3.6.1.4.1.789.1.21.1.2.1.2';
|
|
||||||
my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
|
my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
|
||||||
my $oid_enclPowerSuppliesPresent = '.1.3.6.1.4.1.789.1.21.1.2.1.13';
|
|
||||||
my $oid_enclPowerSuppliesFailed = '.1.3.6.1.4.1.789.1.21.1.2.1.15';
|
|
||||||
my $oid_enclFansPresent = '.1.3.6.1.4.1.789.1.21.1.2.1.17';
|
|
||||||
my $oid_enclFansFailed = '.1.3.6.1.4.1.789.1.21.1.2.1.18';
|
|
||||||
my $oid_enclFansSpeed = '.1.3.6.1.4.1.789.1.21.1.2.1.62';
|
|
||||||
my $oid_enclTempSensorsPresent = '.1.3.6.1.4.1.789.1.21.1.2.1.20';
|
|
||||||
my $oid_enclTempSensorsOverTempFail = '.1.3.6.1.4.1.789.1.21.1.2.1.21';
|
|
||||||
my $oid_enclTempSensorsOverTempWarn = '.1.3.6.1.4.1.789.1.21.1.2.1.22';
|
|
||||||
my $oid_enclTempSensorsUnderTempFail = '.1.3.6.1.4.1.789.1.21.1.2.1.23';
|
|
||||||
my $oid_enclTempSensorsUnderTempWarn = '.1.3.6.1.4.1.789.1.21.1.2.1.24';
|
|
||||||
my $oid_enclTempSensorsCurrentTemp = '.1.3.6.1.4.1.789.1.21.1.2.1.25';
|
|
||||||
my $oid_enclTempSensorsOverTempFailThr = '.1.3.6.1.4.1.789.1.21.1.2.1.26';
|
|
||||||
my $oid_enclTempSensorsOverTempWarnThr = '.1.3.6.1.4.1.789.1.21.1.2.1.27';
|
|
||||||
my $oid_enclTempSensorsUnderTempFailThr = '.1.3.6.1.4.1.789.1.21.1.2.1.28';
|
|
||||||
my $oid_enclTempSensorsUnderTempWarnThr = '.1.3.6.1.4.1.789.1.21.1.2.1.29';
|
|
||||||
my $oid_enclElectronicsPresent = '.1.3.6.1.4.1.789.1.21.1.2.1.31';
|
|
||||||
my $oid_enclElectronicsFailed = '.1.3.6.1.4.1.789.1.21.1.2.1.33';
|
|
||||||
my $oid_enclVoltSensorsPresent = '.1.3.6.1.4.1.789.1.21.1.2.1.35';
|
|
||||||
my $oid_enclVoltSensorsOverVoltFail = '.1.3.6.1.4.1.789.1.21.1.2.1.36';
|
|
||||||
my $oid_enclVoltSensorsOverVoltWarn = '.1.3.6.1.4.1.789.1.21.1.2.1.37';
|
|
||||||
my $oid_enclVoltSensorsUnderVoltFail = '.1.3.6.1.4.1.789.1.21.1.2.1.38';
|
|
||||||
my $oid_enclVoltSensorsUnderVoltWarn = '.1.3.6.1.4.1.789.1.21.1.2.1.39';
|
|
||||||
my $oid_enclVoltSensorsCurrentVolt = '.1.3.6.1.4.1.789.1.21.1.2.1.40';
|
|
||||||
my $oid_enclVoltSensorsOverVoltFailThr = '.1.3.6.1.4.1.789.1.21.1.2.1.41';
|
|
||||||
my $oid_enclVoltSensorsOverVoltWarnThr = '.1.3.6.1.4.1.789.1.21.1.2.1.42';
|
|
||||||
my $oid_enclVoltSensorsUnderVoltFailThr = '.1.3.6.1.4.1.789.1.21.1.2.1.43';
|
|
||||||
my $oid_enclVoltSensorsUnderVoltWarnThr = '.1.3.6.1.4.1.789.1.21.1.2.1.44';
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
@ -90,9 +90,14 @@ sub new {
|
|||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments =>
|
||||||
{
|
{
|
||||||
"exclude:s" => { name => 'exclude' },
|
"exclude:s" => { name => 'exclude' },
|
||||||
"component:s" => { name => 'component', default => 'all' },
|
"component:s" => { name => 'component', default => '.*' },
|
||||||
|
"absent-problem:s" => { name => 'absent' },
|
||||||
"no-component:s" => { name => 'no_component' },
|
"no-component:s" => { name => 'no_component' },
|
||||||
|
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||||
|
"warning:s@" => { name => 'warning' },
|
||||||
|
"critical:s@" => { name => 'critical' },
|
||||||
});
|
});
|
||||||
|
|
||||||
$self->{components} = {};
|
$self->{components} = {};
|
||||||
$self->{no_components} = undef;
|
$self->{no_components} = undef;
|
||||||
return $self;
|
return $self;
|
||||||
@ -109,6 +114,46 @@ sub check_options {
|
|||||||
$self->{no_components} = 'critical';
|
$self->{no_components} = 'critical';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->{overload_th} = {};
|
||||||
|
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||||
|
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my ($section, $status, $filter) = ($1, $2, $3);
|
||||||
|
if ($self->{output}->is_litteral_status(status => $status) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
|
||||||
|
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{numeric_threshold} = {};
|
||||||
|
foreach my $option (('warning', 'critical')) {
|
||||||
|
foreach my $val (@{$self->{option_results}->{$option}}) {
|
||||||
|
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my ($section, $regexp, $value) = ($1, $2, $3);
|
||||||
|
if ($section !~ /(voltage|temperature|fan)/) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: fan, voltage or temperature).");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
my $position = 0;
|
||||||
|
if (defined($self->{numeric_threshold}->{$section})) {
|
||||||
|
$position = scalar(@{$self->{numeric_threshold}->{$section}});
|
||||||
|
}
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
$self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section}));
|
||||||
|
push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
@ -116,44 +161,36 @@ sub run {
|
|||||||
# $options{snmp} = snmp object
|
# $options{snmp} = snmp object
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
my $result = $self->{snmp}->get_leef(oids => [$oid_enclNumber], nothing_quit => 1);
|
my $snmp_request = [];
|
||||||
$self->{snmp}->load(oids => [$oid_enclContactState, $oid_enclChannelShelfAddr, $oid_enclPowerSuppliesPresent, $oid_enclPowerSuppliesFailed,
|
my @components = ('communication', 'psu', 'fan', 'temperature', 'voltage', 'electronics');
|
||||||
$oid_enclFansPresent, $oid_enclFansFailed, $oid_enclFansSpeed, $oid_enclTempSensorsPresent, $oid_enclTempSensorsOverTempFail, $oid_enclTempSensorsOverTempWarn,
|
foreach (@components) {
|
||||||
$oid_enclTempSensorsUnderTempFail, $oid_enclTempSensorsUnderTempWarn, $oid_enclTempSensorsCurrentTemp,
|
if (/$self->{option_results}->{component}/) {
|
||||||
$oid_enclTempSensorsOverTempFailThr, $oid_enclTempSensorsOverTempWarnThr, $oid_enclTempSensorsUnderTempFailThr,
|
my $mod_name = "storage::netapp::mode::components::$_";
|
||||||
$oid_enclTempSensorsUnderTempWarnThr, $oid_enclElectronicsPresent, $oid_enclElectronicsFailed, $oid_enclVoltSensorsPresent,
|
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name,
|
||||||
$oid_enclVoltSensorsOverVoltFail, $oid_enclVoltSensorsOverVoltWarn, $oid_enclVoltSensorsUnderVoltFail, $oid_enclVoltSensorsUnderVoltWarn,
|
error_msg => "Cannot load module '$mod_name'.");
|
||||||
$oid_enclVoltSensorsCurrentVolt, $oid_enclVoltSensorsOverVoltFailThr, $oid_enclVoltSensorsOverVoltWarnThr, $oid_enclVoltSensorsUnderVoltFailThr,
|
my $func = $mod_name->can('load');
|
||||||
$oid_enclVoltSensorsUnderVoltWarnThr],
|
$func->(request => $snmp_request);
|
||||||
begin => 1, end => $result->{$oid_enclNumber});
|
}
|
||||||
$self->{result} = $self->{snmp}->get_leef();
|
}
|
||||||
|
|
||||||
$self->{number_shelf} = $result->{$oid_enclNumber};
|
if (scalar(@{$snmp_request}) == 0) {
|
||||||
|
|
||||||
if ($self->{option_results}->{component} eq 'all') {
|
|
||||||
$self->check_communication();
|
|
||||||
$self->check_fan();
|
|
||||||
$self->check_psu();
|
|
||||||
$self->check_temperature();
|
|
||||||
$self->check_electronics();
|
|
||||||
$self->check_voltage();
|
|
||||||
} elsif ($self->{option_results}->{component} eq 'communication') {
|
|
||||||
$self->check_communication();
|
|
||||||
} elsif ($self->{option_results}->{component} eq 'psu') {
|
|
||||||
$self->check_psu();
|
|
||||||
} elsif ($self->{option_results}->{component} eq 'fan') {
|
|
||||||
$self->check_fan();
|
|
||||||
} elsif ($self->{option_results}->{component} eq 'temperature') {
|
|
||||||
$self->check_temperature();
|
|
||||||
} elsif ($self->{option_results}->{component} eq 'voltage') {
|
|
||||||
$self->check_voltage();
|
|
||||||
} elsif ($self->{option_results}->{component} eq 'electronics') {
|
|
||||||
$self->check_electronics();
|
|
||||||
} else {
|
|
||||||
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
push @{$snmp_request}, ({ oid => $oid_enclNumber }, { oid => $oid_enclChannelShelfAddr });
|
||||||
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => $snmp_request);
|
||||||
|
$self->{number_shelf} = defined($self->{results}->{$oid_enclNumber}->{$oid_enclNumber . '.0'}) ? $self->{results}->{$oid_enclNumber}->{$oid_enclNumber . '.0'} : -1;
|
||||||
|
$self->{shelf_addr} = $self->{results}->{$oid_enclChannelShelfAddr};
|
||||||
|
|
||||||
|
foreach (@components) {
|
||||||
|
if (/$self->{option_results}->{component}/) {
|
||||||
|
my $mod_name = "storage::netapp::mode::components::$_";
|
||||||
|
my $func = $mod_name->can('check');
|
||||||
|
$func->($self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $total_components = 0;
|
my $total_components = 0;
|
||||||
my $display_by_component = '';
|
my $display_by_component = '';
|
||||||
my $display_by_component_append = '';
|
my $display_by_component_append = '';
|
||||||
@ -167,10 +204,9 @@ sub run {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->output_add(severity => 'OK',
|
$self->{output}->output_add(severity => 'OK',
|
||||||
short_msg => sprintf("All %s components are ok [%s] [%s shelves].",
|
short_msg => sprintf("All %s components are ok [%s].",
|
||||||
$total_components,
|
$total_components,
|
||||||
$display_by_component,
|
$display_by_component)
|
||||||
$self->{number_shelf})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||||
@ -198,262 +234,62 @@ sub check_exclude {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_communication {
|
sub absent_problem {
|
||||||
my ($self) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking communications");
|
|
||||||
$self->{components}->{communication} = {name => 'communications', total => 0, skip => 0};
|
|
||||||
return if ($self->check_exclude(section => 'communication'));
|
|
||||||
|
|
||||||
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
|
||||||
my $shelf_addr = $self->{result}->{$oid_enclChannelShelfAddr . '.' . $i};
|
|
||||||
my $com_state = $self->{result}->{$oid_enclContactState . '.' . $i};
|
|
||||||
|
|
||||||
next if ($self->check_exclude(section => 'communication', instance => $shelf_addr));
|
|
||||||
$self->{components}->{communication}->{total}++;
|
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' communication state is '%s'",
|
|
||||||
$shelf_addr, ${$com_states{$com_state}}[0]));
|
|
||||||
if (${$com_states{$com_state}}[1] ne 'OK') {
|
|
||||||
$self->{output}->output_add(severity => ${$com_states{$com_state}}[0],
|
|
||||||
short_msg => sprintf("Shelve '%s' communication state is '%s'",
|
|
||||||
$shelf_addr, ${$com_states{$com_state}}[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub check_fan {
|
|
||||||
my ($self) = @_;
|
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking fans");
|
|
||||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
|
||||||
return if ($self->check_exclude(section => 'fan'));
|
|
||||||
|
|
||||||
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
|
||||||
my $shelf_addr = $self->{result}->{$oid_enclChannelShelfAddr . '.' . $i};
|
|
||||||
my $present = $self->{result}->{$oid_enclFansPresent . '.' . $i};
|
|
||||||
my $failed = $self->{result}->{$oid_enclFansFailed . '.' . $i};
|
|
||||||
my @current_speed = split /,/, $self->{result}->{$oid_enclFansSpeed . '.' . $i};
|
|
||||||
|
|
||||||
foreach my $num (split /,/, $present) {
|
|
||||||
$num = centreon::plugins::misc::trim($num);
|
|
||||||
next if ($num !~ /[0-9]/);
|
|
||||||
my $current_value = ($current_speed[$num - 1] =~ /(^|\s)([0-9]+)/) ? $2 : '';
|
|
||||||
|
|
||||||
next if ($self->check_exclude(section => 'fan', instance => $shelf_addr . '.' . $num));
|
|
||||||
$self->{components}->{fan}->{total}++;
|
|
||||||
|
|
||||||
if ($failed =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'CRITICAL',
|
|
||||||
long_msg => sprintf("Shelve '%s' Fan '%s' is failed",
|
|
||||||
$shelf_addr, $num));
|
|
||||||
} else {
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' Fan '%s' is ok",
|
|
||||||
$shelf_addr, $num));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($current_value ne '') {
|
|
||||||
$self->{output}->perfdata_add(label => "speed_" . $i . "_" . $num, unit => 'rpm',
|
|
||||||
value => $current_value,
|
|
||||||
min => 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub check_psu {
|
|
||||||
my ($self) = @_;
|
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
|
||||||
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
|
||||||
return if ($self->check_exclude(section => 'psu'));
|
|
||||||
|
|
||||||
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
|
||||||
my $shelf_addr = $self->{result}->{$oid_enclChannelShelfAddr . '.' . $i};
|
|
||||||
my $present = $self->{result}->{$oid_enclPowerSuppliesPresent . '.' . $i};
|
|
||||||
my $failed = $self->{result}->{$oid_enclPowerSuppliesFailed . '.' . $i};
|
|
||||||
|
|
||||||
foreach my $num (split /,/, $present) {
|
|
||||||
$num = centreon::plugins::misc::trim($num);
|
|
||||||
next if ($num !~ /[0-9]/);
|
|
||||||
|
|
||||||
next if ($self->check_exclude(section => 'psu', instance => $shelf_addr . '.' . $num));
|
|
||||||
$self->{components}->{psu}->{total}++;
|
|
||||||
|
|
||||||
if ($failed =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'CRITICAL',
|
|
||||||
long_msg => sprintf("Shelve '%s' PSU '%s' is failed",
|
|
||||||
$shelf_addr, $num));
|
|
||||||
} else {
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' PSU '%s' is ok",
|
|
||||||
$shelf_addr, $num));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub check_electronics {
|
|
||||||
my ($self) = @_;
|
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking electronics");
|
|
||||||
$self->{components}->{electronics} = {name => 'electronics', total => 0, skip => 0};
|
|
||||||
return if ($self->check_exclude(section => 'electronics'));
|
|
||||||
|
|
||||||
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
|
||||||
my $shelf_addr = $self->{result}->{$oid_enclChannelShelfAddr . '.' . $i};
|
|
||||||
my $present = $self->{result}->{$oid_enclElectronicsPresent . '.' . $i};
|
|
||||||
my $failed = $self->{result}->{$oid_enclElectronicsFailed . '.' . $i};
|
|
||||||
|
|
||||||
foreach my $num (split /,/, $present) {
|
|
||||||
$num = centreon::plugins::misc::trim($num);
|
|
||||||
next if ($num !~ /[0-9]/);
|
|
||||||
|
|
||||||
next if ($self->check_exclude(section => 'electronics', instance => $shelf_addr . '.' . $num));
|
|
||||||
$self->{components}->{electronics}->{total}++;
|
|
||||||
|
|
||||||
if ($failed =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'CRITICAL',
|
|
||||||
long_msg => sprintf("Shelve '%s' electronics '%s' is failed",
|
|
||||||
$shelf_addr, $num));
|
|
||||||
} else {
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' electronics '%s' is ok",
|
|
||||||
$shelf_addr, $num));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub check_voltage {
|
|
||||||
my ($self) = @_;
|
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking voltages");
|
|
||||||
$self->{components}->{voltage} = {name => 'voltages', total => 0, skip => 0};
|
|
||||||
return if ($self->check_exclude(section => 'voltage'));
|
|
||||||
|
|
||||||
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
if (defined($self->{option_results}->{absent}) &&
|
||||||
my $shelf_addr = $self->{result}->{$oid_enclChannelShelfAddr . '.' . $i};
|
$self->{option_results}->{absent} =~ /(^|\s|,)($options{section}(\s*,|$)|${options{section}}[^,]*#\Q$options{instance}\E#)/) {
|
||||||
my $present = $self->{result}->{$oid_enclVoltSensorsPresent . '.' . $i};
|
$self->{output}->output_add(severity => 'CRITICAL',
|
||||||
my @current_volt = split /,/, $self->{result}->{$oid_enclVoltSensorsCurrentVolt . '.' . $i};
|
short_msg => sprintf("Component '%s' instance '%s' is not present",
|
||||||
|
$options{section}, $options{instance}));
|
||||||
my $warn_under = $self->{result}->{$oid_enclVoltSensorsUnderVoltWarn . '.' . $i};
|
|
||||||
my $crit_under = $self->{result}->{$oid_enclVoltSensorsUnderVoltFail . '.' . $i};
|
|
||||||
my $warn_over = $self->{result}->{$oid_enclVoltSensorsOverVoltWarn . '.' . $i};
|
|
||||||
my $crit_over = $self->{result}->{$oid_enclVoltSensorsOverVoltFail . '.' . $i};
|
|
||||||
|
|
||||||
my @warn_under_thr = split /,/, $self->{result}->{$oid_enclVoltSensorsUnderVoltWarnThr . '.' . $i};
|
|
||||||
my @crit_under_thr = split /,/, $self->{result}->{$oid_enclVoltSensorsUnderVoltFailThr . '.' . $i};
|
|
||||||
my @warn_over_thr = split /,/, $self->{result}->{$oid_enclVoltSensorsOverVoltWarnThr . '.' . $i};
|
|
||||||
my @crit_over_thr = split /,/, $self->{result}->{$oid_enclVoltSensorsOverVoltFailThr . '.' . $i};
|
|
||||||
|
|
||||||
foreach my $num (split /,/, $present) {
|
|
||||||
$num = centreon::plugins::misc::trim($num);
|
|
||||||
next if ($num !~ /[0-9]/);
|
|
||||||
|
|
||||||
my $wu_thr = (defined($warn_under_thr[$num - 1]) && $warn_under_thr[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
|
||||||
my $cu_thr = (defined($crit_under_thr[$num - 1]) && $crit_under_thr[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
|
||||||
my $wo_thr = (defined($warn_over_thr[$num - 1]) && $warn_over_thr[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
|
||||||
my $co_thr = (defined($crit_over_thr[$num - 1]) && $crit_over_thr[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
|
||||||
my $current_value = ($current_volt[$num - 1] =~ /(^|\s)(-*[0-9]+)/) ? $2 : '';
|
|
||||||
|
|
||||||
next if ($self->check_exclude(section => 'voltage', instance => $shelf_addr . '.' . $num));
|
|
||||||
$self->{components}->{voltage}->{total}++;
|
|
||||||
|
|
||||||
if ($crit_under =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'CRITICAL',
|
|
||||||
long_msg => sprintf("Shelve '%s' voltage sensor '%s' is under critical threshold [current = %s < %s]",
|
|
||||||
$shelf_addr, $num, $current_value, $cu_thr));
|
|
||||||
} elsif ($warn_under =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'WARNING',
|
|
||||||
long_msg => sprintf("Shelve '%s' voltage sensor '%s' is under warning threshold [current = %s < %s]",
|
|
||||||
$shelf_addr, $num, $current_value, $wu_thr));
|
|
||||||
} elsif ($crit_over =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'CRITICAL',
|
|
||||||
long_msg => sprintf("Shelve '%s' voltage sensor '%s' is over critical threshold [current = %s > %s]",
|
|
||||||
$shelf_addr, $num, $current_value, $co_thr));
|
|
||||||
} elsif ($warn_over =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'WARNING',
|
|
||||||
long_msg => sprintf("Shelve '%s' voltage sensor '%s' is over warning threshold [current = %s > %s]",
|
|
||||||
$shelf_addr, $num, $current_value, $wo_thr));
|
|
||||||
} else {
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' voltage sensor '%s' is ok [current = %s]",
|
|
||||||
$shelf_addr, $num, $current_value));
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => "volt_" . $i . "_" . $num, unit => 'mV',
|
|
||||||
value => $current_value,
|
|
||||||
warning => ($wu_thr ne '' || $wo_thr ne '') ? ($wu_thr . ':' . $wo_thr) : '',
|
|
||||||
critical => ($cu_thr ne '' || $co_thr ne '') ? ($cu_thr . ':' . $co_thr) : '');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance (not present)"));
|
||||||
|
$self->{components}->{$options{section}}->{skip}++;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_temperature {
|
sub get_severity_numeric {
|
||||||
my ($self) = @_;
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'OK'; # default
|
||||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
my $thresholds = { warning => undef, critical => undef };
|
||||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
my $checked = 0;
|
||||||
return if ($self->check_exclude(section => 'temperature'));
|
|
||||||
|
if (defined($self->{numeric_threshold}->{$options{section}})) {
|
||||||
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
|
my $exits = [];
|
||||||
my $shelf_addr = $self->{result}->{$oid_enclChannelShelfAddr . '.' . $i};
|
foreach (@{$self->{numeric_threshold}->{$options{section}}}) {
|
||||||
my $present = $self->{result}->{$oid_enclTempSensorsPresent . '.' . $i};
|
if ($options{instance} =~ /$_->{regexp}/) {
|
||||||
my @current_temp = split /,/, $self->{result}->{$oid_enclTempSensorsCurrentTemp . '.' . $i};
|
push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]);
|
||||||
|
$thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label});
|
||||||
my $warn_under = $self->{result}->{$oid_enclTempSensorsUnderTempWarn . '.' . $i};
|
$checked = 1;
|
||||||
my $crit_under = $self->{result}->{$oid_enclTempSensorsUnderTempFail . '.' . $i};
|
}
|
||||||
my $warn_over = $self->{result}->{$oid_enclTempSensorsOverTempWarn . '.' . $i};
|
}
|
||||||
my $crit_over = $self->{result}->{$oid_enclTempSensorsOverTempFail . '.' . $i};
|
$status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0);
|
||||||
|
}
|
||||||
my @warn_under_thr = split /,/, $self->{result}->{$oid_enclTempSensorsUnderTempWarnThr . '.' . $i};
|
|
||||||
my @crit_under_thr = split /,/, $self->{result}->{$oid_enclTempSensorsUnderTempFailThr . '.' . $i};
|
return ($status, $thresholds->{warning}, $thresholds->{critical}, $checked);
|
||||||
my @warn_over_thr = split /,/, $self->{result}->{$oid_enclTempSensorsOverTempWarnThr . '.' . $i};
|
}
|
||||||
my @crit_over_thr = split /,/, $self->{result}->{$oid_enclTempSensorsOverTempFailThr . '.' . $i};
|
|
||||||
|
sub get_severity {
|
||||||
foreach my $num (split /,/, $present) {
|
my ($self, %options) = @_;
|
||||||
$num = centreon::plugins::misc::trim($num);
|
my $status = 'UNKNOWN'; # default
|
||||||
next if ($num !~ /[0-9]/);
|
|
||||||
|
if (defined($self->{overload_th}->{$options{section}})) {
|
||||||
$warn_under_thr[$num - 1] =~ /(-*[0-9]+)C/;
|
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||||
my $wu_thr = $1;
|
if ($options{value} =~ /$_->{filter}/i) {
|
||||||
$crit_under_thr[$num - 1] =~ /(-*[0-9]+)C/;
|
$status = $_->{status};
|
||||||
my $cu_thr = $1;
|
return $status;
|
||||||
$warn_over_thr[$num - 1] =~ /(-*[0-9]+)C/;
|
|
||||||
my $wo_thr = $1;
|
|
||||||
$crit_over_thr[$num - 1] =~ /(-*[0-9]+)C/;
|
|
||||||
my $co_thr = $1;
|
|
||||||
$current_temp[$num - 1] =~ /(-*[0-9]+)C/;
|
|
||||||
my $current_value = $1;
|
|
||||||
|
|
||||||
next if ($self->check_exclude(section => 'temperature', instance => $shelf_addr . '.' . $num));
|
|
||||||
$self->{components}->{temperature}->{total}++;
|
|
||||||
|
|
||||||
if ($crit_under =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'CRITICAL',
|
|
||||||
long_msg => sprintf("Shelve '%s' temperature sensor '%s' is under critical threshold [current = %s < %s]",
|
|
||||||
$shelf_addr, $num, $current_value, $cu_thr));
|
|
||||||
} elsif ($warn_under =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'WARNING',
|
|
||||||
long_msg => sprintf("Shelve '%s' temperature sensor '%s' is under warning threshold [current = %s < %s]",
|
|
||||||
$shelf_addr, $num, $current_value, $wu_thr));
|
|
||||||
} elsif ($crit_over =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'CRITICAL',
|
|
||||||
long_msg => sprintf("Shelve '%s' temperature sensor '%s' is over critical threshold [current = %s > %s]",
|
|
||||||
$shelf_addr, $num, $current_value, $co_thr));
|
|
||||||
} elsif ($warn_over =~ /(^|,|\s)$num(,|\s|$)/) {
|
|
||||||
$self->{output}->output_add(severity => 'WARNING',
|
|
||||||
long_msg => sprintf("Shelve '%s' temperature sensor '%s' is over warning threshold [current = %s > %s]",
|
|
||||||
$shelf_addr, $num, $current_value, $wo_thr));
|
|
||||||
} else {
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Shelve '%s' temperature sensor '%s' is ok [current = %s]",
|
|
||||||
$shelf_addr, $num, $current_value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => "temp_" . $i . "_" . $num, unit => 'C',
|
|
||||||
value => $current_value,
|
|
||||||
warning => $wu_thr . ':' . $wo_thr,
|
|
||||||
critical => $cu_thr . ':' . $co_thr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (@{$thresholds->{$options{section}}}) {
|
||||||
|
if ($options{value} =~ /$$_[0]/i) {
|
||||||
|
$status = $$_[1];
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
@ -468,19 +304,40 @@ Check Shelves hardware (temperatures, voltages, electronics, fan, power supplies
|
|||||||
|
|
||||||
=item B<--component>
|
=item B<--component>
|
||||||
|
|
||||||
Which component to check (Default: 'all').
|
Which component to check (Default: '.*').
|
||||||
Can be: 'psu', 'fan', 'communication', 'voltage', 'temperature', 'electronics'.
|
Can be: 'psu', 'fan', 'communication', 'voltage', 'temperature', 'electronics'.
|
||||||
|
|
||||||
=item B<--exclude>
|
=item B<--exclude>
|
||||||
|
|
||||||
Exclude some parts (comma seperated list) (Example: --exclude=psu)
|
Exclude some parts (comma seperated list) (Example: --exclude=psu)
|
||||||
Can also exclude specific instance: --exclude='psu#0b.00.99.1#'
|
Can also exclude specific instance: --exclude='psu#41239F00647-A#'
|
||||||
|
|
||||||
|
=item B<--absent-problem>
|
||||||
|
|
||||||
|
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
||||||
|
Can be specific or global: --absent-problem=fan#41239F00647-fan02#
|
||||||
|
|
||||||
=item B<--no-component>
|
=item B<--no-component>
|
||||||
|
|
||||||
Return an error if no compenents are checked.
|
Return an error if no compenents are checked.
|
||||||
If total (with skipped) is 0. (Default: 'critical' returns).
|
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='gfc,CRITICAL,^(?!(Online)$)'
|
||||||
|
|
||||||
|
=item B<--warning>
|
||||||
|
|
||||||
|
Set warning threshold for temperatures (syntax: regexp,treshold)
|
||||||
|
Example: --warning='41239F00647-vimm46,20' --warning='41239F00647-vimm5.*,30'
|
||||||
|
|
||||||
|
=item B<--critical>
|
||||||
|
|
||||||
|
Set critical threshold for temperatures (syntax: regexp,treshold)
|
||||||
|
Example: --critical='41239F00647-vimm46,25' --warning='41239F00647-vimm5.*,35'
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
@ -47,20 +47,20 @@ sub new {
|
|||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
%{$self->{modes}} = (
|
%{$self->{modes}} = (
|
||||||
'cpuload' => 'storage::netapp::mode::cpuload',
|
'cpuload' => 'storage::netapp::mode::cpuload',
|
||||||
'diskfailed' => 'storage::netapp::mode::diskfailed',
|
'diskfailed' => 'storage::netapp::mode::diskfailed',
|
||||||
'fan' => 'storage::netapp::mode::fan',
|
'fan' => 'storage::netapp::mode::fan',
|
||||||
'filesys' => 'storage::netapp::mode::filesys',
|
'filesys' => 'storage::netapp::mode::filesys',
|
||||||
'globalstatus' => 'storage::netapp::mode::globalstatus',
|
'global-status' => 'storage::netapp::mode::globalstatus',
|
||||||
'list-filesys' => 'storage::netapp::mode::listfilesys',
|
'list-filesys' => 'storage::netapp::mode::listfilesys',
|
||||||
'ndmpsessions' => 'storage::netapp::mode::ndmpsessions',
|
'ndmpsessions' => 'storage::netapp::mode::ndmpsessions',
|
||||||
'nvram' => 'storage::netapp::mode::nvram',
|
'nvram' => 'storage::netapp::mode::nvram',
|
||||||
'partnerstatus' => 'storage::netapp::mode::partnerstatus',
|
'partnerstatus' => 'storage::netapp::mode::partnerstatus',
|
||||||
'psu' => 'storage::netapp::mode::psu',
|
'psu' => 'storage::netapp::mode::psu',
|
||||||
'shelf' => 'storage::netapp::mode::shelf',
|
'shelf' => 'storage::netapp::mode::shelf',
|
||||||
'snapmirrorlag' => 'storage::netapp::mode::snapmirrorlag',
|
'snapmirrorlag' => 'storage::netapp::mode::snapmirrorlag',
|
||||||
'temperature' => 'storage::netapp::mode::temperature',
|
'temperature' => 'storage::netapp::mode::temperature',
|
||||||
'volumeoptions' => 'storage::netapp::mode::volumeoptions',
|
'volumeoptions' => 'storage::netapp::mode::volumeoptions',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -106,7 +106,7 @@ sub run {
|
|||||||
my $prct_used = $memory_used * 100 / $total_size;
|
my $prct_used = $memory_used * 100 / $total_size;
|
||||||
my $prct_free = 100 - $prct_used;
|
my $prct_free = 100 - $prct_used;
|
||||||
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
||||||
my ($used_value, $used_unit) = $self->{perfdata}->change_bytes(value => $memory_used);
|
my ($used_value, $used_unit) = $self->{perfdata}->change_bytes(value => $memory_used);
|
||||||
my ($free_value, $free_unit) = $self->{perfdata}->change_bytes(value => $memory_free);
|
my ($free_value, $free_unit) = $self->{perfdata}->change_bytes(value => $memory_free);
|
||||||
@ -118,10 +118,10 @@ sub run {
|
|||||||
$free_value . " " . $free_unit, $prct_free));
|
$free_value . " " . $free_unit, $prct_free));
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => "used",
|
$self->{output}->perfdata_add(label => "used",
|
||||||
value => sprintf("%d", $memory_used),
|
value => int($memory_used),
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),
|
||||||
min => 0, max => sprintf("%d", $total_size));
|
min => 0, max => int($total_size));
|
||||||
|
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
|
65
storage/violin/3000/snmp/plugin.pm
Normal file
65
storage/violin/3000/snmp/plugin.pm
Normal 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 storage::violin::3000::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;
|
||||||
|
# $options->{options} = options object
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
%{$self->{modes}} = (
|
||||||
|
'hardware' => 'centreon::common::violin::snmp::mode::hardware',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 PLUGIN DESCRIPTION
|
||||||
|
|
||||||
|
Check Violin 3000 series in SNMP.
|
||||||
|
Please use plugin SNMP Linux for system checks ('cpu', 'memory', 'traffic',...).
|
||||||
|
|
||||||
|
=cut
|
Loading…
x
Reference in New Issue
Block a user