+ change path name
This commit is contained in:
garnier-quentin 2017-02-23 15:57:37 +01:00
parent 79a54f62a8
commit d26a60e9cd
4 changed files with 21 additions and 13 deletions

View File

@ -18,7 +18,7 @@
# limitations under the License.
#
package network::brocade::mode::cpu;
package network::brocade::snmp::mode::cpu;
use base qw(centreon::plugins::mode);
@ -62,13 +62,17 @@ sub run {
my $oid_swCpuUsage = '.1.3.6.1.4.1.1588.2.1.1.1.26.1.0';
my $result = $self->{snmp}->get_leef(oids => [$oid_swFwFabricWatchLicense, $oid_swCpuUsage], nothing_quit => 1);
if ($result->{$oid_swFwFabricWatchLicense} == 2) {
$self->{output}->add_option_msg(short_msg => "Need Fabric Watch License to get information.");
if (!defined($result->{$oid_swCpuUsage})) {
if ($result->{$oid_swFwFabricWatchLicense} == 2) {
$self->{output}->add_option_msg(short_msg => "Need Fabric Watch License to get information.");
$self->{output}->option_exit();
}
$self->{output}->add_option_msg(short_msg => "Cannot get information.");
$self->{output}->option_exit();
}
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_swCpuUsage},
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,
short_msg => sprintf("CPU Usage: %.2f%%", $result->{$oid_swCpuUsage}));
$self->{output}->perfdata_add(label => "cpu", unit => '%',

View File

@ -18,7 +18,7 @@
# limitations under the License.
#
package network::brocade::mode::hardware;
package network::brocade::snmp::mode::hardware;
use base qw(centreon::plugins::mode);

View File

@ -18,7 +18,7 @@
# limitations under the License.
#
package network::brocade::mode::memory;
package network::brocade::snmp::mode::memory;
use base qw(centreon::plugins::mode);
@ -62,13 +62,17 @@ sub run {
my $oid_swMemUsage = '.1.3.6.1.4.1.1588.2.1.1.1.26.6.0';
my $result = $self->{snmp}->get_leef(oids => [$oid_swFwFabricWatchLicense, $oid_swMemUsage], nothing_quit => 1);
if ($result->{$oid_swFwFabricWatchLicense} == 2) {
$self->{output}->add_option_msg(short_msg => "Need Fabric Watch License to get information.");
if (!defined($result->{$oid_swMemUsage})) {
if ($result->{$oid_swFwFabricWatchLicense} == 2) {
$self->{output}->add_option_msg(short_msg => "Need Fabric Watch License to get information.");
$self->{output}->option_exit();
}
$self->{output}->add_option_msg(short_msg => "Cannot get information.");
$self->{output}->option_exit();
}
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_swMemUsage},
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,
short_msg => sprintf("Memory Usage: %.2f%% used", $result->{$oid_swMemUsage}));
$self->{output}->perfdata_add(label => "used", unit => '%',

View File

@ -18,7 +18,7 @@
# limitations under the License.
#
package network::brocade::plugin;
package network::brocade::snmp::plugin;
use strict;
use warnings;
@ -31,11 +31,11 @@ sub new {
$self->{version} = '1.0';
%{$self->{modes}} = (
'cpu' => 'network::brocade::mode::cpu',
'hardware' => 'network::brocade::mode::hardware',
'cpu' => 'network::brocade::snmp::mode::cpu',
'hardware' => 'network::brocade::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'memory' => 'network::brocade::mode::memory',
'memory' => 'network::brocade::snmp::mode::memory',
);
return $self;