From f3f3689c58a3140d548b956c131aea0a1479d580 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Sun, 5 Oct 2014 17:37:48 +0200 Subject: [PATCH] + Refactor HP server directory (for ilo) + Correct local 'vx-disks' --- .../snmp}/mode/components/blade.pm | 2 +- .../snmp}/mode/components/enclosure.pm | 2 +- .../bladechassis/snmp}/mode/components/fan.pm | 2 +- .../snmp}/mode/components/fuse.pm | 2 +- .../snmp}/mode/components/manager.pm | 2 +- .../snmp}/mode/components/network.pm | 2 +- .../bladechassis/snmp}/mode/components/psu.pm | 2 +- .../snmp}/mode/components/temperature.pm | 2 +- .../bladechassis/snmp}/mode/hardware.pm | 50 +++---- .../bladechassis/snmp}/plugin.pm | 4 +- .../proliant/snmp}/mode/components/cpu.pm | 2 +- .../proliant/snmp}/mode/components/fan.pm | 2 +- .../proliant/snmp}/mode/components/fca.pm | 2 +- .../proliant/snmp}/mode/components/ida.pm | 2 +- .../proliant/snmp}/mode/components/ide.pm | 2 +- .../proliant/snmp}/mode/components/network.pm | 2 +- .../proliant/snmp}/mode/components/pc.pm | 2 +- .../proliant/snmp}/mode/components/psu.pm | 2 +- .../proliant/snmp}/mode/components/sas.pm | 2 +- .../proliant/snmp}/mode/components/scsi.pm | 2 +- .../snmp}/mode/components/temperature.pm | 2 +- .../proliant/snmp}/mode/hardware.pm | 124 +++++++++--------- .../proliant/snmp}/plugin.pm | 4 +- os/solaris/local/mode/vxdisks.pm | 80 +++++++---- 24 files changed, 163 insertions(+), 137 deletions(-) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/components/blade.pm (98%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/components/enclosure.pm (98%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/components/fan.pm (98%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/components/fuse.pm (98%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/components/manager.pm (98%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/components/network.pm (98%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/components/psu.pm (99%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/components/temperature.pm (98%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/mode/hardware.pm (71%) rename hardware/server/{hpbladechassis => hp/bladechassis/snmp}/plugin.pm (93%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/cpu.pm (98%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/fan.pm (98%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/fca.pm (99%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/ida.pm (99%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/ide.pm (99%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/network.pm (99%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/pc.pm (98%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/psu.pm (99%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/sas.pm (99%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/scsi.pm (99%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/components/temperature.pm (98%) rename hardware/server/{hpproliant => hp/proliant/snmp}/mode/hardware.pm (65%) rename hardware/server/{hpproliant => hp/proliant/snmp}/plugin.pm (94%) diff --git a/hardware/server/hpbladechassis/mode/components/blade.pm b/hardware/server/hp/bladechassis/snmp/mode/components/blade.pm similarity index 98% rename from hardware/server/hpbladechassis/mode/components/blade.pm rename to hardware/server/hp/bladechassis/snmp/mode/components/blade.pm index 10c16bcd5..6d43fa175 100644 --- a/hardware/server/hpbladechassis/mode/components/blade.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/components/blade.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::components::blade; +package hardware::server::hp::bladechassis::snmp::mode::components::blade; use strict; use warnings; diff --git a/hardware/server/hpbladechassis/mode/components/enclosure.pm b/hardware/server/hp/bladechassis/snmp/mode/components/enclosure.pm similarity index 98% rename from hardware/server/hpbladechassis/mode/components/enclosure.pm rename to hardware/server/hp/bladechassis/snmp/mode/components/enclosure.pm index 4f7eba103..9093e8e94 100644 --- a/hardware/server/hpbladechassis/mode/components/enclosure.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/components/enclosure.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::components::enclosure; +package hardware::server::hp::bladechassis::snmp::mode::components::enclosure; use strict; use warnings; diff --git a/hardware/server/hpbladechassis/mode/components/fan.pm b/hardware/server/hp/bladechassis/snmp/mode/components/fan.pm similarity index 98% rename from hardware/server/hpbladechassis/mode/components/fan.pm rename to hardware/server/hp/bladechassis/snmp/mode/components/fan.pm index cea3571eb..ee94f5c7c 100644 --- a/hardware/server/hpbladechassis/mode/components/fan.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/components/fan.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::components::fan; +package hardware::server::hp::bladechassis::snmp::mode::components::fan; use strict; use warnings; diff --git a/hardware/server/hpbladechassis/mode/components/fuse.pm b/hardware/server/hp/bladechassis/snmp/mode/components/fuse.pm similarity index 98% rename from hardware/server/hpbladechassis/mode/components/fuse.pm rename to hardware/server/hp/bladechassis/snmp/mode/components/fuse.pm index 169383296..130a96865 100644 --- a/hardware/server/hpbladechassis/mode/components/fuse.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/components/fuse.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::components::fuse; +package hardware::server::hp::bladechassis::snmp::mode::components::fuse; use strict; use warnings; diff --git a/hardware/server/hpbladechassis/mode/components/manager.pm b/hardware/server/hp/bladechassis/snmp/mode/components/manager.pm similarity index 98% rename from hardware/server/hpbladechassis/mode/components/manager.pm rename to hardware/server/hp/bladechassis/snmp/mode/components/manager.pm index 3e504dda8..82404697e 100644 --- a/hardware/server/hpbladechassis/mode/components/manager.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/components/manager.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::components::manager; +package hardware::server::hp::bladechassis::snmp::mode::components::manager; use strict; use warnings; diff --git a/hardware/server/hpbladechassis/mode/components/network.pm b/hardware/server/hp/bladechassis/snmp/mode/components/network.pm similarity index 98% rename from hardware/server/hpbladechassis/mode/components/network.pm rename to hardware/server/hp/bladechassis/snmp/mode/components/network.pm index 49f80c2f8..86ef49ac2 100644 --- a/hardware/server/hpbladechassis/mode/components/network.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/components/network.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::components::network; +package hardware::server::hp::bladechassis::snmp::mode::components::network; use strict; use warnings; diff --git a/hardware/server/hpbladechassis/mode/components/psu.pm b/hardware/server/hp/bladechassis/snmp/mode/components/psu.pm similarity index 99% rename from hardware/server/hpbladechassis/mode/components/psu.pm rename to hardware/server/hp/bladechassis/snmp/mode/components/psu.pm index 3d153b110..c7840bc1b 100644 --- a/hardware/server/hpbladechassis/mode/components/psu.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/components/psu.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::components::psu; +package hardware::server::hp::bladechassis::snmp::mode::components::psu; use strict; use warnings; diff --git a/hardware/server/hpbladechassis/mode/components/temperature.pm b/hardware/server/hp/bladechassis/snmp/mode/components/temperature.pm similarity index 98% rename from hardware/server/hpbladechassis/mode/components/temperature.pm rename to hardware/server/hp/bladechassis/snmp/mode/components/temperature.pm index 87f057608..aa5dc5803 100644 --- a/hardware/server/hpbladechassis/mode/components/temperature.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/components/temperature.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::components::temperature; +package hardware::server::hp::bladechassis::snmp::mode::components::temperature; use strict; use warnings; diff --git a/hardware/server/hpbladechassis/mode/hardware.pm b/hardware/server/hp/bladechassis/snmp/mode/hardware.pm similarity index 71% rename from hardware/server/hpbladechassis/mode/hardware.pm rename to hardware/server/hp/bladechassis/snmp/mode/hardware.pm index a1eb4b4b2..424851d48 100644 --- a/hardware/server/hpbladechassis/mode/hardware.pm +++ b/hardware/server/hp/bladechassis/snmp/mode/hardware.pm @@ -33,20 +33,20 @@ # #################################################################################### -package hardware::server::hpbladechassis::mode::hardware; +package hardware::server::hp::bladechassis::snmp::mode::hardware; use base qw(centreon::plugins::mode); use strict; use warnings; -use hardware::server::hpbladechassis::mode::components::enclosure; -use hardware::server::hpbladechassis::mode::components::manager; -use hardware::server::hpbladechassis::mode::components::fan; -use hardware::server::hpbladechassis::mode::components::blade; -use hardware::server::hpbladechassis::mode::components::network; -use hardware::server::hpbladechassis::mode::components::psu; -use hardware::server::hpbladechassis::mode::components::temperature; -use hardware::server::hpbladechassis::mode::components::fuse; +use hardware::server::hp::bladechassis::snmp::mode::components::enclosure; +use hardware::server::hp::bladechassis::snmp::mode::components::manager; +use hardware::server::hp::bladechassis::snmp::mode::components::fan; +use hardware::server::hp::bladechassis::snmp::mode::components::blade; +use hardware::server::hp::bladechassis::snmp::mode::components::network; +use hardware::server::hp::bladechassis::snmp::mode::components::psu; +use hardware::server::hp::bladechassis::snmp::mode::components::temperature; +use hardware::server::hp::bladechassis::snmp::mode::components::fuse; sub new { my ($class, %options) = @_; @@ -71,14 +71,14 @@ sub check_options { sub global { my ($self, %options) = @_; - hardware::server::hpbladechassis::mode::components::enclosure::check($self); - hardware::server::hpbladechassis::mode::components::manager::check($self); - hardware::server::hpbladechassis::mode::components::fan::check($self); - hardware::server::hpbladechassis::mode::components::blade::check($self); - hardware::server::hpbladechassis::mode::components::network::check($self); - hardware::server::hpbladechassis::mode::components::psu::check($self); - hardware::server::hpbladechassis::mode::components::temperature::check($self); - hardware::server::hpbladechassis::mode::components::fuse::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::enclosure::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::manager::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::fan::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::blade::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::network::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::psu::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::temperature::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::fuse::check($self); } sub run { @@ -89,21 +89,21 @@ sub run { if ($self->{option_results}->{component} eq 'all') { $self->global(); } elsif ($self->{option_results}->{component} eq 'enclosure') { - hardware::server::hpbladechassis::mode::components::enclosure::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::enclosure::check($self); } elsif ($self->{option_results}->{component} eq 'manager') { - hardware::server::hpbladechassis::mode::components::manager::check($self, force => 1); + hardware::server::hp::bladechassis::snmp::mode::components::manager::check($self, force => 1); } elsif ($self->{option_results}->{component} eq 'fan') { - hardware::server::hpbladechassis::mode::components::fan::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::fan::check($self); } elsif ($self->{option_results}->{component} eq 'blade') { - hardware::server::hpbladechassis::mode::components::blade::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::blade::check($self); } elsif ($self->{option_results}->{component} eq 'network') { - hardware::server::hpbladechassis::mode::components::network::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::network::check($self); } elsif ($self->{option_results}->{component} eq 'psu') { - hardware::server::hpbladechassis::mode::components::psu::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::psu::check($self); } elsif ($self->{option_results}->{component} eq 'temperature') { - hardware::server::hpbladechassis::mode::components::temperature::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::temperature::check($self); } elsif ($self->{option_results}->{component} eq 'fuse') { - hardware::server::hpbladechassis::mode::components::fuse::check($self); + hardware::server::hp::bladechassis::snmp::mode::components::fuse::check($self); } else { $self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'."); $self->{output}->option_exit(); diff --git a/hardware/server/hpbladechassis/plugin.pm b/hardware/server/hp/bladechassis/snmp/plugin.pm similarity index 93% rename from hardware/server/hpbladechassis/plugin.pm rename to hardware/server/hp/bladechassis/snmp/plugin.pm index 7b48efa1c..da8eec001 100644 --- a/hardware/server/hpbladechassis/plugin.pm +++ b/hardware/server/hp/bladechassis/snmp/plugin.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpbladechassis::plugin; +package hardware::server::hp::bladechassis::snmp::plugin; use strict; use warnings; @@ -47,7 +47,7 @@ sub new { $self->{version} = '1.0'; %{$self->{modes}} = ( - 'hardware' => 'hardware::server::hpbladechassis::mode::hardware', + 'hardware' => 'hardware::server::hp::bladechassis::snmp::mode::hardware', ); return $self; diff --git a/hardware/server/hpproliant/mode/components/cpu.pm b/hardware/server/hp/proliant/snmp/mode/components/cpu.pm similarity index 98% rename from hardware/server/hpproliant/mode/components/cpu.pm rename to hardware/server/hp/proliant/snmp/mode/components/cpu.pm index 5f0884643..b1cdf539c 100644 --- a/hardware/server/hpproliant/mode/components/cpu.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/cpu.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::cpu; +package hardware::server::hp::proliant::snmp::mode::components::cpu; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/fan.pm b/hardware/server/hp/proliant/snmp/mode/components/fan.pm similarity index 98% rename from hardware/server/hpproliant/mode/components/fan.pm rename to hardware/server/hp/proliant/snmp/mode/components/fan.pm index 6c9b609f1..4ffc733b0 100644 --- a/hardware/server/hpproliant/mode/components/fan.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/fan.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::fan; +package hardware::server::hp::proliant::snmp::mode::components::fan; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/fca.pm b/hardware/server/hp/proliant/snmp/mode/components/fca.pm similarity index 99% rename from hardware/server/hpproliant/mode/components/fca.pm rename to hardware/server/hp/proliant/snmp/mode/components/fca.pm index 91d91de49..fc00a4c90 100644 --- a/hardware/server/hpproliant/mode/components/fca.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/fca.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::fca; +package hardware::server::hp::proliant::snmp::mode::components::fca; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/ida.pm b/hardware/server/hp/proliant/snmp/mode/components/ida.pm similarity index 99% rename from hardware/server/hpproliant/mode/components/ida.pm rename to hardware/server/hp/proliant/snmp/mode/components/ida.pm index c7c009577..f88626005 100644 --- a/hardware/server/hpproliant/mode/components/ida.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/ida.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::ida; +package hardware::server::hp::proliant::snmp::mode::components::ida; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/ide.pm b/hardware/server/hp/proliant/snmp/mode/components/ide.pm similarity index 99% rename from hardware/server/hpproliant/mode/components/ide.pm rename to hardware/server/hp/proliant/snmp/mode/components/ide.pm index 4e56ec71a..1c2eae991 100644 --- a/hardware/server/hpproliant/mode/components/ide.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/ide.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::ide; +package hardware::server::hp::proliant::snmp::mode::components::ide; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/network.pm b/hardware/server/hp/proliant/snmp/mode/components/network.pm similarity index 99% rename from hardware/server/hpproliant/mode/components/network.pm rename to hardware/server/hp/proliant/snmp/mode/components/network.pm index 018359f36..13a4ec0f2 100644 --- a/hardware/server/hpproliant/mode/components/network.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/network.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::network; +package hardware::server::hp::proliant::snmp::mode::components::network; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/pc.pm b/hardware/server/hp/proliant/snmp/mode/components/pc.pm similarity index 98% rename from hardware/server/hpproliant/mode/components/pc.pm rename to hardware/server/hp/proliant/snmp/mode/components/pc.pm index a84f67bed..1cfff9962 100644 --- a/hardware/server/hpproliant/mode/components/pc.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/pc.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::pc; +package hardware::server::hp::proliant::snmp::mode::components::pc; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/psu.pm b/hardware/server/hp/proliant/snmp/mode/components/psu.pm similarity index 99% rename from hardware/server/hpproliant/mode/components/psu.pm rename to hardware/server/hp/proliant/snmp/mode/components/psu.pm index d60e46398..61023cd93 100644 --- a/hardware/server/hpproliant/mode/components/psu.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/psu.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::psu; +package hardware::server::hp::proliant::snmp::mode::components::psu; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/sas.pm b/hardware/server/hp/proliant/snmp/mode/components/sas.pm similarity index 99% rename from hardware/server/hpproliant/mode/components/sas.pm rename to hardware/server/hp/proliant/snmp/mode/components/sas.pm index 2781602ba..2b22da339 100644 --- a/hardware/server/hpproliant/mode/components/sas.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/sas.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::sas; +package hardware::server::hp::proliant::snmp::mode::components::sas; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/components/scsi.pm b/hardware/server/hp/proliant/snmp/mode/components/scsi.pm similarity index 99% rename from hardware/server/hpproliant/mode/components/scsi.pm rename to hardware/server/hp/proliant/snmp/mode/components/scsi.pm index febb750f7..e6c5401cb 100644 --- a/hardware/server/hpproliant/mode/components/scsi.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/scsi.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::scsi; +package hardware::server::hp::proliant::snmp::mode::components::scsi; # In 'CPQSCSI-MIB.mib' use strict; diff --git a/hardware/server/hpproliant/mode/components/temperature.pm b/hardware/server/hp/proliant/snmp/mode/components/temperature.pm similarity index 98% rename from hardware/server/hpproliant/mode/components/temperature.pm rename to hardware/server/hp/proliant/snmp/mode/components/temperature.pm index fd224454f..d0ff46929 100644 --- a/hardware/server/hpproliant/mode/components/temperature.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/temperature.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::mode::components::temperature; +package hardware::server::hp::proliant::snmp::mode::components::temperature; use strict; use warnings; diff --git a/hardware/server/hpproliant/mode/hardware.pm b/hardware/server/hp/proliant/snmp/mode/hardware.pm similarity index 65% rename from hardware/server/hpproliant/mode/hardware.pm rename to hardware/server/hp/proliant/snmp/mode/hardware.pm index dbba7abcf..44463f673 100644 --- a/hardware/server/hpproliant/mode/hardware.pm +++ b/hardware/server/hp/proliant/snmp/mode/hardware.pm @@ -33,24 +33,24 @@ # #################################################################################### -package hardware::server::hpproliant::mode::hardware; +package hardware::server::hp::proliant::snmp::mode::hardware; use base qw(centreon::plugins::mode); use strict; use warnings; use centreon::plugins::misc; -use hardware::server::hpproliant::mode::components::cpu; -use hardware::server::hpproliant::mode::components::psu; -use hardware::server::hpproliant::mode::components::pc; -use hardware::server::hpproliant::mode::components::fan; -use hardware::server::hpproliant::mode::components::temperature; -use hardware::server::hpproliant::mode::components::network; -use hardware::server::hpproliant::mode::components::ida; -use hardware::server::hpproliant::mode::components::fca; -use hardware::server::hpproliant::mode::components::ide; -use hardware::server::hpproliant::mode::components::sas; -use hardware::server::hpproliant::mode::components::scsi; +use hardware::server::hp::proliant::snmp::mode::components::cpu; +use hardware::server::hp::proliant::snmp::mode::components::psu; +use hardware::server::hp::proliant::snmp::mode::components::pc; +use hardware::server::hp::proliant::snmp::mode::components::fan; +use hardware::server::hp::proliant::snmp::mode::components::temperature; +use hardware::server::hp::proliant::snmp::mode::components::network; +use hardware::server::hp::proliant::snmp::mode::components::ida; +use hardware::server::hp::proliant::snmp::mode::components::fca; +use hardware::server::hp::proliant::snmp::mode::components::ide; +use hardware::server::hp::proliant::snmp::mode::components::sas; +use hardware::server::hp::proliant::snmp::mode::components::scsi; sub new { my ($class, %options) = @_; @@ -92,31 +92,31 @@ sub global { my ($self, %options) = @_; $self->get_system_information(); - hardware::server::hpproliant::mode::components::cpu::check($self); - hardware::server::hpproliant::mode::components::psu::check($self); - hardware::server::hpproliant::mode::components::pc::check($self); - hardware::server::hpproliant::mode::components::fan::check($self); - hardware::server::hpproliant::mode::components::temperature::check($self); - hardware::server::hpproliant::mode::components::network::physical_nic($self); - hardware::server::hpproliant::mode::components::network::logical_nic($self); - hardware::server::hpproliant::mode::components::ida::array_controller($self); - hardware::server::hpproliant::mode::components::ida::array_accelerator($self); - hardware::server::hpproliant::mode::components::ida::logical_drive($self); - hardware::server::hpproliant::mode::components::ida::physical_drive($self); - hardware::server::hpproliant::mode::components::fca::host_array_controller($self); - hardware::server::hpproliant::mode::components::fca::external_array_controller($self); - hardware::server::hpproliant::mode::components::fca::external_array_accelerator($self); - hardware::server::hpproliant::mode::components::fca::logical_drive($self); - hardware::server::hpproliant::mode::components::fca::physical_drive($self); - hardware::server::hpproliant::mode::components::ide::controller($self); - hardware::server::hpproliant::mode::components::ide::logical_drive($self); - hardware::server::hpproliant::mode::components::ide::physical_drive($self); - hardware::server::hpproliant::mode::components::sas::controller($self); - hardware::server::hpproliant::mode::components::sas::logical_drive($self); - hardware::server::hpproliant::mode::components::sas::physical_drive($self); - hardware::server::hpproliant::mode::components::scsi::controller($self); - hardware::server::hpproliant::mode::components::scsi::logical_drive($self); - hardware::server::hpproliant::mode::components::scsi::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::cpu::check($self); + hardware::server::hp::proliant::snmp::mode::components::psu::check($self); + hardware::server::hp::proliant::snmp::mode::components::pc::check($self); + hardware::server::hp::proliant::snmp::mode::components::fan::check($self); + hardware::server::hp::proliant::snmp::mode::components::temperature::check($self); + hardware::server::hp::proliant::snmp::mode::components::network::physical_nic($self); + hardware::server::hp::proliant::snmp::mode::components::network::logical_nic($self); + hardware::server::hp::proliant::snmp::mode::components::ida::array_controller($self); + hardware::server::hp::proliant::snmp::mode::components::ida::array_accelerator($self); + hardware::server::hp::proliant::snmp::mode::components::ida::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::ida::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::fca::host_array_controller($self); + hardware::server::hp::proliant::snmp::mode::components::fca::external_array_controller($self); + hardware::server::hp::proliant::snmp::mode::components::fca::external_array_accelerator($self); + hardware::server::hp::proliant::snmp::mode::components::fca::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::fca::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::ide::controller($self); + hardware::server::hp::proliant::snmp::mode::components::ide::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::ide::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::sas::controller($self); + hardware::server::hp::proliant::snmp::mode::components::sas::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::sas::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::scsi::controller($self); + hardware::server::hp::proliant::snmp::mode::components::scsi::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::scsi::physical_drive($self); my $total_components = 0; my $display_by_component = ''; @@ -146,37 +146,37 @@ sub component { my ($self, %options) = @_; if ($self->{option_results}->{component} eq 'cpu') { - hardware::server::hpproliant::mode::components::cpu::check($self); + hardware::server::hp::proliant::snmp::mode::components::cpu::check($self); } elsif ($self->{option_results}->{component} eq 'psu') { - hardware::server::hpproliant::mode::components::psu::check($self); + hardware::server::hp::proliant::snmp::mode::components::psu::check($self); } elsif ($self->{option_results}->{component} eq 'pc') { - hardware::server::hpproliant::mode::components::pc::check($self); + hardware::server::hp::proliant::snmp::mode::components::pc::check($self); } elsif ($self->{option_results}->{component} eq 'fan') { - hardware::server::hpproliant::mode::components::fan::check($self); + hardware::server::hp::proliant::snmp::mode::components::fan::check($self); } elsif ($self->{option_results}->{component} eq 'temperature') { - hardware::server::hpproliant::mode::components::temperature::check($self); + hardware::server::hp::proliant::snmp::mode::components::temperature::check($self); } elsif ($self->{option_results}->{component} eq 'network') { - hardware::server::hpproliant::mode::components::network::physical_nic($self); - hardware::server::hpproliant::mode::components::network::logical_nic($self); + hardware::server::hp::proliant::snmp::mode::components::network::physical_nic($self); + hardware::server::hp::proliant::snmp::mode::components::network::logical_nic($self); } elsif ($self->{option_results}->{component} eq 'storage') { - hardware::server::hpproliant::mode::components::ida::array_controller($self); - hardware::server::hpproliant::mode::components::ida::array_accelerator($self); - hardware::server::hpproliant::mode::components::ida::logical_drive($self); - hardware::server::hpproliant::mode::components::ida::physical_drive($self); - hardware::server::hpproliant::mode::components::fca::host_array_controller($self); - hardware::server::hpproliant::mode::components::fca::external_array_controller($self); - hardware::server::hpproliant::mode::components::fca::external_array_accelerator($self); - hardware::server::hpproliant::mode::components::fca::logical_drive($self); - hardware::server::hpproliant::mode::components::fca::physical_drive($self); - hardware::server::hpproliant::mode::components::ide::controller($self); - hardware::server::hpproliant::mode::components::ide::logical_drive($self); - hardware::server::hpproliant::mode::components::ide::physical_drive($self); - hardware::server::hpproliant::mode::components::sas::controller($self); - hardware::server::hpproliant::mode::components::sas::logical_drive($self); - hardware::server::hpproliant::mode::components::sas::physical_drive($self); - hardware::server::hpproliant::mode::components::scsi::controller($self); - hardware::server::hpproliant::mode::components::scsi::logical_drive($self); - hardware::server::hpproliant::mode::components::scsi::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::ida::array_controller($self); + hardware::server::hp::proliant::snmp::mode::components::ida::array_accelerator($self); + hardware::server::hp::proliant::snmp::mode::components::ida::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::ida::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::fca::host_array_controller($self); + hardware::server::hp::proliant::snmp::mode::components::fca::external_array_controller($self); + hardware::server::hp::proliant::snmp::mode::components::fca::external_array_accelerator($self); + hardware::server::hp::proliant::snmp::mode::components::fca::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::fca::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::ide::controller($self); + hardware::server::hp::proliant::snmp::mode::components::ide::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::ide::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::sas::controller($self); + hardware::server::hp::proliant::snmp::mode::components::sas::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::sas::physical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::scsi::controller($self); + hardware::server::hp::proliant::snmp::mode::components::scsi::logical_drive($self); + hardware::server::hp::proliant::snmp::mode::components::scsi::physical_drive($self); } else { $self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'."); $self->{output}->option_exit(); diff --git a/hardware/server/hpproliant/plugin.pm b/hardware/server/hp/proliant/snmp/plugin.pm similarity index 94% rename from hardware/server/hpproliant/plugin.pm rename to hardware/server/hp/proliant/snmp/plugin.pm index 023c4f680..19b689930 100644 --- a/hardware/server/hpproliant/plugin.pm +++ b/hardware/server/hp/proliant/snmp/plugin.pm @@ -33,7 +33,7 @@ # #################################################################################### -package hardware::server::hpproliant::plugin; +package hardware::server::hp::proliant::snmp::plugin; use strict; use warnings; @@ -47,7 +47,7 @@ sub new { $self->{version} = '1.0'; %{$self->{modes}} = ( - 'hardware' => 'hardware::server::hpproliant::mode::hardware', + 'hardware' => 'hardware::server::hp::proliant::snmp::mode::hardware', ); return $self; diff --git a/os/solaris/local/mode/vxdisks.pm b/os/solaris/local/mode/vxdisks.pm index 088360701..b26439368 100644 --- a/os/solaris/local/mode/vxdisks.pm +++ b/os/solaris/local/mode/vxdisks.pm @@ -59,12 +59,14 @@ sub new { "command1:s" => { name => 'command1', default => 'vxdisk' }, "command1-path:s" => { name => 'command1_path', default => '/usr/sbin' }, "command1-options:s" => { name => 'command1_options', default => 'list 2>&1' }, + "skip-vxdisk" => { name => 'skip_vxdisk' }, "sudo2" => { name => 'sudo2' }, "command2:s" => { name => 'command2', default => 'vxprint' }, "command2-path:s" => { name => 'command2_path', default => '/usr/sbin' }, "command2-options:s" => { name => 'command2_options', default => '-Ath 2>&1' }, - "warning:s" => { name => 'warning', }, - "critical:s" => { name => 'critical', }, + "skip-vxprint" => { name => 'skip_vxprint' }, + "warning:s" => { name => 'warning' }, + "critical:s" => { name => 'critical' }, }); return $self; } @@ -83,9 +85,9 @@ sub check_options { } } -sub run { +sub vdisk_execute { my ($self, %options) = @_; - + my $stdout = centreon::plugins::misc::execute(output => $self->{output}, options => $self->{option_results}, sudo => $self->{option_results}->{sudo1}, @@ -95,43 +97,58 @@ sub run { my $long_msg = $stdout; $long_msg =~ s/\|/~/mg; $self->{output}->output_add(long_msg => $long_msg); - - my $stdout2 = centreon::plugins::misc::execute(output => $self->{output}, - options => $self->{option_results}, - sudo => $self->{option_results}->{sudo2}, - command => $self->{option_results}->{command2}, - command_path => $self->{option_results}->{command2_path}, - command_options => $self->{option_results}->{command2_options}); - $long_msg = $stdout2; - $long_msg =~ s/\|/~/mg; - $self->{output}->output_add(long_msg => $long_msg); - - my $num_errors = 0; - my $vxdisks_name = ''; + foreach (split /\n/, $stdout) { if (/(failed)/i ) { my $status = $1; next if (! /\S+\s+\S+\s+(\S+)\s+/); - $num_errors++; - $vxdisks_name .= ' [' . $1 . '/' . $status . ']'; + $self->{num_errors}++; + $self->{vxdisks_name} .= ' [' . $1 . '/' . $status . ']'; } } +} + +sub vxprint_execute { + my ($self, %options) = @_; - my $vxprint_name = ''; - foreach (split /\n/, $stdout2) { + my $stdout = centreon::plugins::misc::execute(output => $self->{output}, + options => $self->{option_results}, + sudo => $self->{option_results}->{sudo2}, + command => $self->{option_results}->{command2}, + command_path => $self->{option_results}->{command2_path}, + command_options => $self->{option_results}->{command2_options}); + my $long_msg = $stdout; + $long_msg =~ s/\|/~/mg; + $self->{output}->output_add(long_msg => $long_msg); + + foreach (split /\n/, $stdout) { if (/(NODEVICE|FAILING)/i ) { my $status = $1; - next if (! /\S+\s+(\S+)\s+/); - $num_errors++; - $vxprint_name .= ' [' . $1 . '/' . $status . ']'; + next if (! /^\s*\S+\s+(\S+)\s+/); + $self->{num_errors}++; + $self->{vxprint_name} .= ' [' . $1 . '/' . $status . ']'; } } +} - my ($exit_code) = $self->{perfdata}->threshold_check(value => $num_errors, +sub run { + my ($self, %options) = @_; + $self->{num_errors} = 0; + $self->{vxdisks_name} = ''; + $self->{vxprint_name} = ''; + + if (!defined($self->{option_results}->{skip_vxdisk})) { + $self->vdisk_execute(); + } + if (!defined($self->{option_results}->{skip_vxprint})) { + $self->vxprint_execute(); + } + + my ($exit_code) = $self->{perfdata}->threshold_check(value => $self->{num_errors}, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - if ($num_errors > 0) { + if ($self->{num_errors} > 0) { $self->{output}->output_add(severity => $exit_code, - short_msg => sprintf("Problems on some disks:" . $vxdisks_name . $vxdisks_name)); + short_msg => sprintf("Problems on some disks:" . $self->{vxdisks_name} . $self->{vxprint_name})); } else { $self->{output}->output_add(severity => 'OK', short_msg => "No problems on disks."); @@ -217,6 +234,15 @@ Command path (Default: '/usr/sbin'). Command options (Default: '-Ath 2>&1'). +=item B<--skip-vxdisk> + +Skip 'vxdisk' command (not executed). + +=item B<--skip-vxprint> + +Skip 'vxprint' command (not executed). + + =back =cut