parent
79a54f62a8
commit
d26a60e9cd
|
@ -18,7 +18,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
package network::brocade::mode::cpu;
|
package network::brocade::snmp::mode::cpu;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
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 $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);
|
my $result = $self->{snmp}->get_leef(oids => [$oid_swFwFabricWatchLicense, $oid_swCpuUsage], nothing_quit => 1);
|
||||||
|
|
||||||
if ($result->{$oid_swFwFabricWatchLicense} == 2) {
|
if (!defined($result->{$oid_swCpuUsage})) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need Fabric Watch License to get information.");
|
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();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_swCpuUsage},
|
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,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("CPU Usage: %.2f%%", $result->{$oid_swCpuUsage}));
|
short_msg => sprintf("CPU Usage: %.2f%%", $result->{$oid_swCpuUsage}));
|
||||||
$self->{output}->perfdata_add(label => "cpu", unit => '%',
|
$self->{output}->perfdata_add(label => "cpu", unit => '%',
|
|
@ -18,7 +18,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
package network::brocade::mode::hardware;
|
package network::brocade::snmp::mode::hardware;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
package network::brocade::mode::memory;
|
package network::brocade::snmp::mode::memory;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
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 $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);
|
my $result = $self->{snmp}->get_leef(oids => [$oid_swFwFabricWatchLicense, $oid_swMemUsage], nothing_quit => 1);
|
||||||
|
|
||||||
if ($result->{$oid_swFwFabricWatchLicense} == 2) {
|
if (!defined($result->{$oid_swMemUsage})) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Need Fabric Watch License to get information.");
|
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();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_swMemUsage},
|
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,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Memory Usage: %.2f%% used", $result->{$oid_swMemUsage}));
|
short_msg => sprintf("Memory Usage: %.2f%% used", $result->{$oid_swMemUsage}));
|
||||||
$self->{output}->perfdata_add(label => "used", unit => '%',
|
$self->{output}->perfdata_add(label => "used", unit => '%',
|
|
@ -18,7 +18,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
package network::brocade::plugin;
|
package network::brocade::snmp::plugin;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -31,11 +31,11 @@ sub new {
|
||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
%{$self->{modes}} = (
|
%{$self->{modes}} = (
|
||||||
'cpu' => 'network::brocade::mode::cpu',
|
'cpu' => 'network::brocade::snmp::mode::cpu',
|
||||||
'hardware' => 'network::brocade::mode::hardware',
|
'hardware' => 'network::brocade::snmp::mode::hardware',
|
||||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||||
'memory' => 'network::brocade::mode::memory',
|
'memory' => 'network::brocade::snmp::mode::memory',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
Loading…
Reference in New Issue