enhance indent

This commit is contained in:
garnier-quentin 2019-10-15 15:55:05 +02:00
parent 7285405476
commit d5b0340bb6
1 changed files with 14 additions and 11 deletions

View File

@ -55,15 +55,14 @@ sub check_options {
sub run { sub run {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{snmp} = $options{snmp};
my $oid_jnxOperatingDescr = '.1.3.6.1.4.1.2636.3.1.13.1.5'; my $oid_jnxOperatingDescr = '.1.3.6.1.4.1.2636.3.1.13.1.5';
my $oid_jnxOperatingCPU = '.1.3.6.1.4.1.2636.3.1.13.1.8'; my $oid_jnxOperatingCPU = '.1.3.6.1.4.1.2636.3.1.13.1.8';
my $oid_jnxOperating1MinLoadAvg = '.1.3.6.1.4.1.2636.3.1.13.1.20'; my $oid_jnxOperating1MinLoadAvg = '.1.3.6.1.4.1.2636.3.1.13.1.20';
my $oid_jnxOperating5MinLoadAvg = '.1.3.6.1.4.1.2636.3.1.13.1.21'; my $oid_jnxOperating5MinLoadAvg = '.1.3.6.1.4.1.2636.3.1.13.1.21';
my $oid_jnxOperating15MinLoadAvg = '.1.3.6.1.4.1.2636.3.1.13.1.22'; my $oid_jnxOperating15MinLoadAvg = '.1.3.6.1.4.1.2636.3.1.13.1.22';
my $result = $self->{snmp}->get_table(oid => $oid_jnxOperatingDescr, nothing_quit => 1); my $result = $options{snmp}->get_table(oid => $oid_jnxOperatingDescr, nothing_quit => 1);
my $routing_engine_find = 0; my $routing_engine_find = 0;
my @oids_routing_engine = (); my @oids_routing_engine = ();
foreach my $oid (keys %$result) { foreach my $oid (keys %$result) {
@ -80,15 +79,19 @@ sub run {
my $multiple = 0; my $multiple = 0;
if (scalar(@oids_routing_engine) > 1) { if (scalar(@oids_routing_engine) > 1) {
$multiple = 1; $multiple = 1;
$self->{output}->output_add(severity => 'OK', $self->{output}->output_add(
short_msg => sprintf("All CPU(s) average usages are ok")); severity => 'OK',
short_msg => sprintf("All CPU(s) average usages are ok")
);
} }
$self->{snmp}->load(oids => [$oid_jnxOperatingCPU, $oid_jnxOperating1MinLoadAvg, $oid_jnxOperating5MinLoadAvg, $oid_jnxOperating15MinLoadAvg], $options{snmp}->load(
instances => \@oids_routing_engine, oids => [$oid_jnxOperatingCPU, $oid_jnxOperating1MinLoadAvg, $oid_jnxOperating5MinLoadAvg, $oid_jnxOperating15MinLoadAvg],
instance_regexp => "^" . $oid_jnxOperatingDescr . '\.(.+)'); instances => \@oids_routing_engine,
my $result2 = $self->{snmp}->get_leef(); instance_regexp => "^" . $oid_jnxOperatingDescr . '\.(.+)'
);
my $result2 = $options{snmp}->get_leef();
foreach my $oid_routing_engine (@oids_routing_engine) { foreach my $oid_routing_engine (@oids_routing_engine) {
$oid_routing_engine =~ /^$oid_jnxOperatingDescr\.(.+)/; $oid_routing_engine =~ /^$oid_jnxOperatingDescr\.(.+)/;
my $instance = $1; my $instance = $1;