diff --git a/network/checkpoint/snmp/mode/connections.pm b/network/checkpoint/snmp/mode/connections.pm index 706cf28ad..d4e633c01 100644 --- a/network/checkpoint/snmp/mode/connections.pm +++ b/network/checkpoint/snmp/mode/connections.pm @@ -30,12 +30,11 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $options{options}->add_options(arguments => - { - "warning:s" => { name => 'warning' }, - "critical:s" => { name => 'critical' }, - "units:s" => { name => 'units', default => 'absolute' }, - }); + $options{options}->add_options(arguments => { + 'warning:s' => { name => 'warning' }, + 'critical:s' => { name => 'critical' }, + 'units:s' => { name => 'units', default => 'absolute' }, + }); return $self; } @@ -82,15 +81,18 @@ sub run { my $exit = $self->{perfdata}->threshold_check(value => $value, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Connections: %d%s", $result->{$oid_fwNumCom}, $extra)); - $self->{output}->perfdata_add(label => "connections", unit => 'con', - value => $result->{$oid_fwNumCom}, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options), - min => 0 - ); - + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Connections: %d%s", $result->{$oid_fwNumCom}, $extra) + ); + $self->{output}->perfdata_add( + label => "connections", unit => 'con', + value => $result->{$oid_fwNumCom}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options), + min => 0 + ); + $self->{output}->display(); $self->{output}->exit(); } diff --git a/network/checkpoint/snmp/mode/cpu.pm b/network/checkpoint/snmp/mode/cpu.pm index 534a90a76..b7277a827 100644 --- a/network/checkpoint/snmp/mode/cpu.pm +++ b/network/checkpoint/snmp/mode/cpu.pm @@ -30,11 +30,10 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $options{options}->add_options(arguments => - { - "warning:s" => { name => 'warning', }, - "critical:s" => { name => 'critical', }, - }); + $options{options}->add_options(arguments => { + 'warning:s' => { name => 'warning', }, + 'critical:s' => { name => 'critical', }, + }); return $self; } @@ -90,7 +89,6 @@ sub run { critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), min => 0, max => 100); - $self->{output}->display(); $self->{output}->exit(); } diff --git a/snmp_standard/mode/dynamiccommand.pm b/snmp_standard/mode/dynamiccommand.pm index adbfb6b24..71315f708 100644 --- a/snmp_standard/mode/dynamiccommand.pm +++ b/snmp_standard/mode/dynamiccommand.pm @@ -41,13 +41,13 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $options{options}->add_options(arguments => - { - "label:s" => { name => 'label' }, - "command:s" => { name => 'command' }, - "args:s" => { name => 'args' }, - "shell" => { name => 'shell' }, - }); + $options{options}->add_options(arguments => { + 'label:s' => { name => 'label' }, + 'command:s' => { name => 'command' }, + 'args:s' => { name => 'args' }, + 'shell' => { name => 'shell' }, + }); + return $self; } @@ -95,13 +95,13 @@ sub create_command { sub update_command { my ($self, %options) = @_; my $shell = defined($self->{option_results}->{shell}) ? 2 : 1; - + # Cannot change values if ($options{result}->{$oid_nsExtendStorage . '.' . $options{instance}} != 2) { $self->{output}->add_option_msg(short_msg => "Command label '" . $self->{option_results}->{label} . "' is not volatile. So we can't manage it."); $self->{output}->option_exit(); } - + my $oids2set = {}; if (!defined($options{result}->{$oid_nsExtendCommand . '.' . $options{instance}}) || $options{result}->{$oid_nsExtendCommand . '.' . $options{instance}} ne $self->{option_results}->{command}) { @@ -124,32 +124,41 @@ sub update_command { sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; - $self->{hostname} = $self->{snmp}->get_hostname(); # snmpset -On -c test -v 2c localhost \ # '.1.3.6.1.4.1.8072.1.3.2.2.1.21.4.104.102.101.102' = 4 \ # '.1.3.6.1.4.1.8072.1.3.2.2.1.2.4.104.102.101.102' = /bin/echo \ # '.1.3.6.1.4.1.8072.1.3.2.2.1.3.4.104.102.101.102' = 'myplop' # - my $instance = $self->get_instance(); - $self->{snmp}->load(oids => [$oid_nsExtendArgs, $oid_nsExtendStatus, - $oid_nsExtendCommand, $oid_nsExtendStorage, $oid_nsExtendExecType], - instances => [$instance], - instance_regexp => '^(.+)$'); + $self->{snmp}->load( + oids => [ + $oid_nsExtendArgs, $oid_nsExtendStatus, + $oid_nsExtendCommand, $oid_nsExtendStorage, $oid_nsExtendExecType + ], + instances => [$instance], + instance_regexp => '^(.+)$' + ); my $result = $self->{snmp}->get_leef(); - + if (!defined($result->{$oid_nsExtendCommand . '.' . $instance})) { $self->create_command(instance => $instance); } else { $self->update_command(result => $result, instance => $instance); } - $result = $self->{snmp}->get_leef(oids => [$oid_nsExtendOutputFull . '.' . $instance, - $oid_nsExtendResult . '.' . $instance], nothing_quit => 1); + $result = $self->{snmp}->get_leef( + oids => [ + $oid_nsExtendOutputFull . '.' . $instance, + $oid_nsExtendResult . '.' . $instance + ], + nothing_quit => 1 + ); - $self->{output}->output_add(severity => $self->{output}->get_litteral_status(status => $result->{$oid_nsExtendResult . '.' . $instance}), - short_msg => $result->{$oid_nsExtendOutputFull . '.' . $instance}); + $self->{output}->output_add( + severity => $self->{output}->get_litteral_status(status => $result->{$oid_nsExtendResult . '.' . $instance}), + short_msg => $result->{$oid_nsExtendOutputFull . '.' . $instance} + ); $self->{output}->display(force_ignore_perfdata => 1); $self->{output}->exit(); } diff --git a/snmp_standard/mode/entity.pm b/snmp_standard/mode/entity.pm index cae44837e..26aec3b12 100644 --- a/snmp_standard/mode/entity.pm +++ b/snmp_standard/mode/entity.pm @@ -50,10 +50,9 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_load_components => 1); bless $self, $class; - $options{options}->add_options(arguments => - { - "sensor-scale" => { name => 'sensor_scale' }, - }); + $options{options}->add_options(arguments => { + 'sensor-scale' => { name => 'sensor_scale' }, + }); return $self; } @@ -207,9 +206,15 @@ sub check { } $self->{components}->{sensor}->{total}++; - $self->{output}->output_add(long_msg => sprintf("sensor '%s' status is '%s' [instance = %s, value = %s]", - $name, $result->{entPhySensorOperStatus}, $result->{entPhySensorType} . '.' . $instance, - defined($result->{entPhySensorValue}) ? $result->{entPhySensorValue} : '-')); + $self->{output}->output_add( + long_msg => sprintf( + "sensor '%s' status is '%s' [instance = %s, value = %s]", + $name, + $result->{entPhySensorOperStatus}, + $result->{entPhySensorType} . '.' . $instance, + defined($result->{entPhySensorValue}) ? $result->{entPhySensorValue} : '-' + ) + ); my $exit = $self->get_severity(label => 'sensor', section => 'sensor.' . $result->{entPhySensorType}, value => $result->{entPhySensorOperStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, @@ -221,13 +226,23 @@ sub check { my $component = 'sensor.' . $result->{entPhySensorType}; my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => $component, instance => $instance, value => $result->{entPhySensorValue}); if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit2, - short_msg => sprintf("Sensor '%s/%s' is %s %s", $name, $instance, $result->{entPhySensorValue}, $perfdata_unit{$result->{entPhySensorType}})); + $self->{output}->output_add( + severity => $exit2, + short_msg => sprintf( + "Sensor '%s/%s' is %s %s", + $name, + $instance, + $result->{entPhySensorValue}, + $perfdata_unit{$result->{entPhySensorType}} + ) + ); } - $self->{output}->perfdata_add(label => $component . '_' . $name, unit => $perfdata_unit{$result->{entPhySensorType}}, - value => $result->{entPhySensorValue}, - warning => $warn, - critical => $crit); + $self->{output}->perfdata_add( + label => $component . '_' . $name, unit => $perfdata_unit{$result->{entPhySensorType}}, + value => $result->{entPhySensorValue}, + warning => $warn, + critical => $crit + ); } } diff --git a/snmp_standard/mode/isdnusage.pm b/snmp_standard/mode/isdnusage.pm index 29dda01fb..5a3af2e50 100644 --- a/snmp_standard/mode/isdnusage.pm +++ b/snmp_standard/mode/isdnusage.pm @@ -72,11 +72,10 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); bless $self, $class; - $options{options}->add_options(arguments => - { - "filter-name:s" => { name => 'filter_name' }, - }); - + $options{options}->add_options(arguments => { + 'filter-name:s' => { name => 'filter_name' }, + }); + return $self; } @@ -107,12 +106,14 @@ sub manage_selection { $self->{isdn} = {}; $self->{bearer} = { active => 0, total => 0 }; - my $snmp_result = $options{snmp}->get_multiple_table(oids => [ - { oid => $oid_isdnBearerOperStatus }, - { oid => $oid_isdnSignalingIfIndex }, - { oid => $oid_isdnSignalingStatsEntry }, - ], - nothing_quit => 1); + my $snmp_result = $options{snmp}->get_multiple_table( + oids => [ + { oid => $oid_isdnBearerOperStatus }, + { oid => $oid_isdnSignalingIfIndex }, + { oid => $oid_isdnSignalingStatsEntry }, + ], + nothing_quit => 1 + ); # Get interface name foreach my $oid (keys %{$snmp_result->{$oid_isdnSignalingIfIndex}}) { @@ -132,8 +133,11 @@ sub manage_selection { } my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result->{$oid_isdnSignalingStatsEntry}, instance => $instance); - $self->{isdn}->{$instance} = { in => $result->{isdnSigStatsInCalls}, out => $result->{isdnSigStatsOutCalls}, - display => $display }; + $self->{isdn}->{$instance} = { + in => $result->{isdnSigStatsInCalls}, + out => $result->{isdnSigStatsOutCalls}, + display => $display + }; } foreach my $oid (keys %{$snmp_result->{$oid_isdnBearerOperStatus}}) { diff --git a/snmp_standard/mode/tcpcon.pm b/snmp_standard/mode/tcpcon.pm index 11a243ebe..6b8472b2d 100644 --- a/snmp_standard/mode/tcpcon.pm +++ b/snmp_standard/mode/tcpcon.pm @@ -53,20 +53,22 @@ sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - - $options{options}->add_options(arguments => - { - "warning:s" => { name => 'warning', }, - "critical:s" => { name => 'critical', }, - "service:s@" => { name => 'service', }, - "application:s@" => { name => 'application', }, - }); + + $options{options}->add_options(arguments => { + 'warning:s' => { name => 'warning' }, + 'critical:s' => { name => 'critical' }, + 'service:s@' => { name => 'service' }, + 'application:s@' => { name => 'application' }, + }); + @{$self->{connections}} = (); $self->{services} = { total => { filter => '.*?#.*?#.*?#.*?#.*?#(?!(listen))', builtin => 1, number => 0, msg => 'Total connections: %d' } }; $self->{applications} = {}; - $self->{states} = { closed => 0, listen => 0, synSent => 0, synReceived => 0, - established => 0, finWait1 => 0, finWait2 => 0, closeWait => 0, - lastAck => 0, closing => 0, timeWait => 0 }; + $self->{states} = { + closed => 0, listen => 0, synSent => 0, synReceived => 0, + established => 0, finWait1 => 0, finWait2 => 0, closeWait => 0, + lastAck => 0, closing => 0, timeWait => 0 + }; return $self; } @@ -89,15 +91,17 @@ sub get_ipv6 { sub get_from_rfc4022 { my ($self, %options) = @_; - + my $oid_tcpConnectionState = '.1.3.6.1.2.1.6.19.1.7'; my $oid_tcpListenerProcess = '.1.3.6.1.2.1.6.20.1.4'; - my $results = $self->{snmp}->get_multiple_table(oids => [ - { oid => $oid_tcpConnectionState }, - { oid => $oid_tcpListenerProcess }, - ]); + my $results = $self->{snmp}->get_multiple_table( + oids => [ + { oid => $oid_tcpConnectionState }, + { oid => $oid_tcpListenerProcess }, + ] + ); return 0 if (scalar(keys %{$results->{$oid_tcpConnectionState}}) + scalar(keys %{$results->{$oid_tcpListenerProcess}}) == 0); - + # Listener foreach (keys %{$results->{$oid_tcpListenerProcess}}) { /^$oid_tcpListenerProcess\.(\d+)/; @@ -117,7 +121,7 @@ sub get_from_rfc4022 { push @{$self->{connections}}, $ipv . "#$src_addr#$src_port#$dst_addr#0#listen"; $self->{states}->{listen}++; } - + foreach (keys %{$results->{$oid_tcpConnectionState}}) { /^$oid_tcpConnectionState\.(\d+)/; my $ipv = $map_addr_type{$1}; @@ -134,16 +138,16 @@ sub get_from_rfc4022 { $self->{states}->{$map_states{$results->{$oid_tcpConnectionState}->{$_}}}++; push @{$self->{connections}}, $ipv . "#$src_addr#$src_port#$dst_addr#$dst_port#" . lc($map_states{$results->{$oid_tcpConnectionState}->{$_}}); } - + return 1; } sub get_from_rfc1213 { my ($self, %options) = @_; - + my $oid_tcpConnState = '.1.3.6.1.2.1.6.13.1.1'; my $result = $self->{snmp}->get_table(oid => $oid_tcpConnState, nothing_quit => 1); - + # Construct foreach (keys %$result) { /(\d+\.\d+\.\d+\.\d+).(\d+)\.(\d+\.\d+\.\d+\.\d+).(\d+)$/; @@ -154,7 +158,7 @@ sub get_from_rfc1213 { sub build_connections { my ($self, %options) = @_; - + if ($self->get_from_rfc4022() == 0) { $self->get_from_rfc1213(); } @@ -162,7 +166,7 @@ sub build_connections { sub check_services { my ($self, %options) = @_; - + foreach my $service (@{$self->{option_results}->{service}}) { my ($tag, $ipv, $state, $port_src, $port_dst, $filter_ip_src, $filter_ip_dst, $warn, $crit) = split /,/, $service; @@ -175,14 +179,17 @@ sub check_services { $self->{output}->option_exit(); } - $self->{services}->{$tag} = { filter => ((defined($ipv) && $ipv ne '') ? $ipv : '.*?') . '#' . - ((defined($filter_ip_src) && $filter_ip_src ne '') ? $filter_ip_src : '.*?') . '#' . - ((defined($port_src) && $port_src ne '') ? $port_src : '.*?') . '#' . - ((defined($filter_ip_dst) && $filter_ip_dst ne '') ? $filter_ip_dst : '.*?') . '#' . - ((defined($port_dst) && $port_dst ne '') ? $port_dst : '.*?') . '#' . - ((defined($state) && $state ne '') ? lc($state) : '(?!(listen))') - , - builtin => 0, number => 0 }; + $self->{services}->{$tag} = { + filter => + ((defined($ipv) && $ipv ne '') ? $ipv : '.*?') . '#' . + ((defined($filter_ip_src) && $filter_ip_src ne '') ? $filter_ip_src : '.*?') . '#' . + ((defined($port_src) && $port_src ne '') ? $port_src : '.*?') . '#' . + ((defined($filter_ip_dst) && $filter_ip_dst ne '') ? $filter_ip_dst : '.*?') . '#' . + ((defined($port_dst) && $port_dst ne '') ? $port_dst : '.*?') . '#' . + ((defined($state) && $state ne '') ? lc($state) : '(?!(listen))'), + builtin => 0, + number => 0 + }; if (($self->{perfdata}->threshold_validate(label => 'warning-service-' . $tag, value => $warn)) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $warn . "' for service '$tag'."); $self->{output}->option_exit(); @@ -209,9 +216,7 @@ sub check_applications { $self->{output}->option_exit(); } - $self->{applications}->{$tag} = { - services => {}, - }; + $self->{applications}->{$tag} = { services => {} }; foreach my $service (split /\|/, $services) { if (!defined($self->{services}->{$service})) { $self->{output}->add_option_msg(short_msg => "Service '" . $service . "' is not defined."); @@ -239,22 +244,31 @@ sub test_services { if (/$self->{services}->{$tag}->{filter}/) { $self->{services}->{$tag}->{number}++; } - } + } + + my $exit_code = $self->{perfdata}->threshold_check( + value => $self->{services}->{$tag}->{number}, + threshold => [ { label => 'critical-service-' . $tag, exit_litteral => 'critical' }, { label => 'warning-service-' . $tag, exit_litteral => 'warning' } ] + ); - my $exit_code = $self->{perfdata}->threshold_check(value => $self->{services}->{$tag}->{number}, - threshold => [ { label => 'critical-service-' . $tag, 'exit_litteral' => 'critical' }, { label => 'warning-service-' . $tag, exit_litteral => 'warning' } ]); - my ($perf_label, $msg) = ('service_' . $tag, "Service '$tag' connections: %d"); + my $msg = "Service '$tag' connections: %d"; if ($self->{services}->{$tag}->{builtin} == 1) { - ($perf_label, $msg) = ($tag, $self->{services}->{$tag}->{msg}); + $msg = $self->{services}->{$tag}->{msg}; } - $self->{output}->output_add(severity => $exit_code, - short_msg => sprintf($msg, $self->{services}->{$tag}->{number})); - $self->{output}->perfdata_add(label => $perf_label, - value => $self->{services}->{$tag}->{number}, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-service-' . $tag), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-service-' . $tag), - min => 0); + $self->{output}->output_add( + severity => $exit_code, + short_msg => sprintf($msg, $self->{services}->{$tag}->{number}) + ); + $self->{output}->perfdata_add( + label => 'service', + nlabel => 'service.connections.tcp.count', + instances => $tag, + value => $self->{services}->{$tag}->{number}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-service-' . $tag), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-service-' . $tag), + min => 0 + ); } } @@ -263,20 +277,28 @@ sub test_applications { foreach my $tag (keys %{$self->{applications}}) { my $number = 0; - + foreach (keys %{$self->{applications}->{$tag}->{services}}) { $number += $self->{services}->{$_}->{number}; } - - my $exit_code = $self->{perfdata}->threshold_check(value => $number, - threshold => [ { label => 'critical-app-' . $tag, 'exit_litteral' => 'critical' }, { label => 'warning-app-' . $tag, exit_litteral => 'warning' } ]); - $self->{output}->output_add(severity => $exit_code, - short_msg => sprintf("Applicatin '%s' connections: %d", $tag, $number)); - $self->{output}->perfdata_add(label => 'app_' . $tag, - value => $number, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-app-' . $tag), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-app-' . $tag), - min => 0); + + my $exit_code = $self->{perfdata}->threshold_check( + value => $number, + threshold => [ { label => 'critical-app-' . $tag, exit_litteral => 'critical' }, { label => 'warning-app-' . $tag, exit_litteral => 'warning' } ] + ); + $self->{output}->output_add( + severity => $exit_code, + short_msg => sprintf("Applicatin '%s' connections: %d", $tag, $number) + ); + $self->{output}->perfdata_add( + label => 'app', + nlabel => 'application.connections.tcp.count', + instances => $tag, + value => $number, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-app-' . $tag), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-app-' . $tag), + min => 0 + ); } } @@ -299,15 +321,18 @@ sub check_options { sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; - + $self->build_connections(); $self->test_services(); $self->test_applications(); - + foreach (keys %{$self->{states}}) { - $self->{output}->perfdata_add(label => 'con_' . $_, - value => $self->{states}->{$_}, - min => 0); + $self->{output}->perfdata_add( + label => 'con_' . $_, + nlabel => 'connections.tcp.' . lc($_) . '.count', + value => $self->{states}->{$_}, + min => 0 + ); } $self->{output}->display(); diff --git a/snmp_standard/mode/uptime.pm b/snmp_standard/mode/uptime.pm index ff67f7785..d3c4b098b 100644 --- a/snmp_standard/mode/uptime.pm +++ b/snmp_standard/mode/uptime.pm @@ -125,15 +125,21 @@ sub run { my $exit_code = $self->{perfdata}->threshold_check(value => floor($value / $unitdiv->{$self->{option_results}->{unit}}), threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - $self->{output}->perfdata_add(label => 'uptime', unit => $self->{option_results}->{unit}, - value => floor($value / $unitdiv->{$self->{option_results}->{unit}}), - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), - min => 0); + $self->{output}->perfdata_add( + label => 'uptime', unit => $self->{option_results}->{unit}, + value => floor($value / $unitdiv->{$self->{option_results}->{unit}}), + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), + min => 0 + ); - $self->{output}->output_add(severity => $exit_code, - short_msg => sprintf("System uptime is: %s", - centreon::plugins::misc::change_seconds(value => $value, start => 'd'))); + $self->{output}->output_add( + severity => $exit_code, + short_msg => sprintf( + 'System uptime is: %s', + centreon::plugins::misc::change_seconds(value => $value, start => 'd') + ) + ); $self->{output}->display(); $self->{output}->exit(); diff --git a/snmp_standard/mode/vrrp.pm b/snmp_standard/mode/vrrp.pm index 6b5f4d3da..adbdcce95 100644 --- a/snmp_standard/mode/vrrp.pm +++ b/snmp_standard/mode/vrrp.pm @@ -29,7 +29,7 @@ use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold) sub custom_status_output { my ($self, %options) = @_; - + my $msg = sprintf("state : %s [admin state : '%s']", $self->{result_values}->{operState}, $self->{result_values}->{adminState}); return $msg; @@ -80,11 +80,10 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); bless $self, $class; - $options{options}->add_options(arguments => - { - "warning-status:s" => { name => 'warning_status', default => '' }, - "critical-status:s" => { name => 'critical_status', default => '%{adminState} eq "up" and %{operState} ne %{operStateLast}' }, - }); + $options{options}->add_options(arguments => { + 'warning-status:s' => { name => 'warning_status', default => '' }, + 'critical-status:s' => { name => 'critical_status', default => '%{adminState} eq "up" and %{operState} ne %{operStateLast}' }, + }); return $self; } @@ -110,8 +109,11 @@ sub manage_selection { my ($self, %options) = @_; $self->{vrrp} = {}; - my $snmp_result = $options{snmp}->get_table(oid => $oid_vrrpOperEntry, end => $mapping->{vrrpOperMasterIpAddr}->{oid}, - nothing_quit => 1); + my $snmp_result = $options{snmp}->get_table( + oid => $oid_vrrpOperEntry, + end => $mapping->{vrrpOperMasterIpAddr}->{oid}, + nothing_quit => 1 + ); foreach my $oid (keys %{$snmp_result}) { next if ($oid !~ /^$mapping->{vrrpOperState}->{oid}\.(.*)$/);