diff --git a/network/f5/bigip/snmp/mode/listnodes.pm b/network/f5/bigip/snmp/mode/listnodes.pm index b26c3bcaa..fc3cf3870 100644 --- a/network/f5/bigip/snmp/mode/listnodes.pm +++ b/network/f5/bigip/snmp/mode/listnodes.pm @@ -33,10 +33,10 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options); 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; } diff --git a/network/f5/bigip/snmp/mode/listpools.pm b/network/f5/bigip/snmp/mode/listpools.pm index 024a5b2f9..4a7c5f7d3 100644 --- a/network/f5/bigip/snmp/mode/listpools.pm +++ b/network/f5/bigip/snmp/mode/listpools.pm @@ -32,13 +32,10 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $options{options}->add_options(arguments => - { - "name:s" => { name => 'name' }, - "regexp" => { name => 'use_regexp' }, - }); - $self->{pool_id_selected} = []; - + $options{options}->add_options(arguments => { + 'filter-name:s' => { name => 'filter_name' }, + }); + return $self; } @@ -50,40 +47,64 @@ sub check_options { sub manage_selection { my ($self, %options) = @_; - $self->{result_names} = $self->{snmp}->get_table(oid => $oid_ltmPoolStatusName, nothing_quit => 1); - foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{result_names}})) { - next if ($oid !~ /^$oid_ltmPoolStatusName\.(.*)$/); - my $instance = $1; - - # Get all without a name - if (!defined($self->{option_results}->{name})) { - push @{$self->{pool_id_selected}}, $instance; + my $map_pool_status = { + 0 => 'none', 1 => 'green', + 2 => 'yellow', 3 => 'red', + 4 => 'blue', 5 => 'gray', + }; + my $map_pool_enabled = { + 0 => 'none', 1 => 'enabled', 2 => 'disabled', 3 => 'disabledbyparent', + }; + my $mapping = { + AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.5.5.2.1.2', map => $map_pool_status }, + EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.5.5.2.1.3', map => $map_pool_enabled }, + }; + my $oid_ltmPoolStatusEntry = '.1.3.6.1.4.1.3375.2.2.5.5.2.1'; + + my $snmp_result = $options{snmp}->get_table( + oid => $oid_ltmPoolStatusEntry, + start => $mapping->{AvailState}->{oid}, + end => $mapping->{EnabledState}->{oid}, + nothing_quit => 1 + ); + my $results = {}; + foreach my $oid (keys %$snmp_result) { + next if ($oid !~ /^$mapping->{AvailState}->{oid}\.(.*?)\.(.*)$/); + my ($num, $index) = ($1, $2); + + my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $num . '.' . $index); + my $name = $self->{output}->to_utf8(join('', map(chr($_), split(/\./, $index)))); + + if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && + $name !~ /$self->{option_results}->{filter_name}/) { + $self->{output}->output_add(long_msg => "skipping pool '" . $name . "'.", debug => 1); next; } - - $self->{result_names}->{$oid} = $self->{output}->to_utf8($self->{result_names}->{$oid}); - if (!defined($self->{option_results}->{use_regexp}) && $self->{result_names}->{$oid} eq $self->{option_results}->{name}) { - push @{$self->{pool_id_selected}}, $instance; - next; - } - if (defined($self->{option_results}->{use_regexp}) && $self->{result_names}->{$oid} =~ /$self->{option_results}->{name}/) { - push @{$self->{pool_id_selected}}, $instance; - next; - } - - $self->{output}->output_add(long_msg => "Skipping pool '" . $self->{result_names}->{$oid} . "': no matching filter name", debug => 1); + + $results->{$name} = { + display => $name, + status => $result->{AvailState}, + state => $result->{EnabledState}, + }; } + + return $results; } sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; - $self->manage_selection(); - foreach my $instance (sort @{$self->{pool_id_selected}}) { - my $name = $self->{result_names}->{$oid_ltmPoolStatusName . '.' . $instance}; - - $self->{output}->output_add(long_msg => "'" . $name . "'"); + my $results = $self->manage_selection(snmp => $options{snmp}); + foreach my $name (sort keys %$results) { + $self->{output}->output_add( + long_msg => sprintf( + '[name: %s] [status: %s] [state: %s]', + $name, + $results->{$name}->{status}, + $results->{$name}->{state}, + ) + ); } $self->{output}->output_add(severity => 'OK', @@ -95,18 +116,19 @@ sub run { sub disco_format { my ($self, %options) = @_; - $self->{output}->add_disco_format(elements => ['name']); + $self->{output}->add_disco_format(elements => ['name', 'status', 'state']); } sub disco_show { my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - $self->manage_selection(disco => 1); - foreach my $instance (sort @{$self->{pool_id_selected}}) { - my $name = $self->{result_names}->{$oid_ltmPoolStatusName . '.' . $instance}; - - $self->{output}->add_disco_entry(name => $name); + my $results = $self->manage_selection(snmp => $options{snmp}); + foreach my $name (sort keys %$results) { + $self->{output}->add_disco_entry( + name => $name, + status => $results->{$name}->{status}, + state => $results->{$name}->{state} + ); } } @@ -120,13 +142,9 @@ List F-5 Pools. =over 8 -=item B<--name> +=item B<--filter-name> -Set the pool name. - -=item B<--regexp> - -Allows to use regexp to filter pool name (with option --name). +Filter pool name. =back diff --git a/network/f5/bigip/snmp/mode/listvirtualservers.pm b/network/f5/bigip/snmp/mode/listvirtualservers.pm index 8819a255e..ad460d59e 100644 --- a/network/f5/bigip/snmp/mode/listvirtualservers.pm +++ b/network/f5/bigip/snmp/mode/listvirtualservers.pm @@ -31,8 +31,8 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - "name:s" => { name => 'name' }, - "regexp" => { name => 'use_regexp' }, + 'name:s' => { name => 'name' }, + 'regexp' => { name => 'use_regexp' }, }); return $self; @@ -73,10 +73,13 @@ my $oid_ltmVirtualServEntry = '.1.3.6.1.4.1.3375.2.2.10.1.2.1'; # old sub manage_selection { my ($self, %options) = @_; - my $snmp_result = $options{snmp}->get_multiple_table(oids => [ - { oid => $oid_ltmVirtualServEntry, start => $mapping->{old}->{AvailState}->{oid}, end => $mapping->{old}->{EnabledState}->{oid} }, - { oid => $oid_ltmVsStatusEntry, start => $mapping->{new}->{AvailState}->{oid}, end => $mapping->{new}->{EnabledState}->{oid} }, - ], nothing_quit => 1); + my $snmp_result = $options{snmp}->get_multiple_table( + oids => [ + { oid => $oid_ltmVirtualServEntry, start => $mapping->{old}->{AvailState}->{oid}, end => $mapping->{old}->{EnabledState}->{oid} }, + { oid => $oid_ltmVsStatusEntry, start => $mapping->{new}->{AvailState}->{oid}, end => $mapping->{new}->{EnabledState}->{oid} }, + ], + nothing_quit => 1 + ); my ($branch, $map) = ($oid_ltmVsStatusEntry, 'new'); if (!defined($snmp_result->{$oid_ltmVsStatusEntry}) || scalar(keys %{$snmp_result->{$oid_ltmVsStatusEntry}}) == 0) { @@ -85,16 +88,11 @@ sub manage_selection { $self->{vs} = {}; foreach my $oid (keys %{$snmp_result->{$branch}}) { - next if ($oid !~ /^$mapping->{$map}->{AvailState}->{oid}\.(.*)$/); - my $instance = $1; - my $result = $options{snmp}->map_instance(mapping => $mapping->{$map}, results => $snmp_result->{$branch}, instance => $instance); - - $result->{Name} = ''; - foreach (split /\./, $instance) { - $result->{Name} .= chr if ($_ >= 32 && $_ <= 126); - } - $result->{Name} =~ s/^.//; - + next if ($oid !~ /^$mapping->{$map}->{AvailState}->{oid}\.(.*?)\.(.*)$/); + my ($num, $index) = ($1, $2); + my $result = $options{snmp}->map_instance(mapping => $mapping->{$map}, results => $snmp_result->{$branch}, instance => $num . '.' . $index); + + $result->{Name} = $self->{output}->to_utf8(join('', map(chr($_), split(/\./, $index)))); if (defined($self->{option_results}->{name}) && $self->{option_results}->{name} ne '') { next if (defined($self->{option_results}->{use_regexp}) && $result->{Name} !~ /$self->{option_results}->{name}/); next if ($result->{Name} ne $self->{option_results}->{name}); diff --git a/network/f5/bigip/snmp/mode/nodestatus.pm b/network/f5/bigip/snmp/mode/nodestatus.pm index 76a11204e..4a073a82c 100644 --- a/network/f5/bigip/snmp/mode/nodestatus.pm +++ b/network/f5/bigip/snmp/mode/nodestatus.pm @@ -24,53 +24,41 @@ use base qw(centreon::plugins::templates::counter); use strict; use warnings; +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc); -my $thresholds = { - node => [ - ['none', 'CRITICAL'], - ['green', 'OK'], - ['yellow', 'WARNING'], - ['red', 'CRITICAL'], - ['blue', 'UNKNOWN'], - ['gray', 'UNKNOWN'], - ], -}; - -sub custom_threshold_output { +sub custom_status_output { my ($self, %options) = @_; - - return $self->{instance_mode}->get_severity(section => 'node', value => $self->{result_values}->{AvailState}); -} -sub custom_status_calc { - my ($self, %options) = @_; - - $self->{result_values}->{AvailState} = $options{new_datas}->{$self->{instance} . '_AvailState'}; - return 0; + my $msg = sprintf( + 'status: %s [state: %s] [reason: %s]', + $self->{result_values}->{status}, + $self->{result_values}->{state}, + $self->{result_values}->{reason}, + ); + return $msg; } sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ - { name => 'node', type => 1, cb_prefix_output => 'prefix_node_output', message_multiple => 'All Nodes are ok' }, + { name => 'node', type => 1, cb_prefix_output => 'prefix_node_output', message_multiple => 'All Nodes are ok', skipped_code => { -10 => 1 } }, ]; $self->{maps_counters}->{node} = [ { label => 'status', threshold => 0, set => { - key_values => [ { name => 'AvailState' } ], - closure_custom_calc => $self->can('custom_status_calc'), - output_template => 'Status : %s', output_error_template => 'Status : %s', - output_use => 'AvailState', + key_values => [ { name => 'state' }, { name => 'status' }, { name => 'reason' },{ name => 'display' } ], + closure_custom_calc => \&catalog_status_calc, + closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, - closure_custom_threshold_check => $self->can('custom_threshold_output'), + closure_custom_threshold_check => \&catalog_status_threshold, } }, { label => 'current-server-connections', set => { - key_values => [ { name => 'ltmNodeAddrStatServerCurConns' }, { name => 'Name' } ], - output_template => 'Current Server Connections : %s', output_error_template => "Current Server Connections : %s", + key_values => [ { name => 'ltmNodeAddrStatServerCurConns' }, { name => 'display' } ], + output_template => 'current server connections : %s', perfdatas => [ { label => 'current_server_connections', value => 'ltmNodeAddrStatServerCurConns_absolute', template => '%s', - min => 0, label_extra_instance => 1, instance_use => 'Name_absolute' }, + min => 0, label_extra_instance => 1, instance_use => 'display_absolute' }, ], } }, @@ -80,7 +68,7 @@ sub set_counters { sub prefix_node_output { my ($self, %options) = @_; - return "Node '" . $options{instance_value}->{Name} . "' "; + return "Node '" . $options{instance_value}->{display} . "' "; } sub new { @@ -89,8 +77,10 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - "filter-name:s" => { name => 'filter_name' }, - "threshold-overload:s@" => { name => 'threshold_overload' }, + 'filter-name:s' => { name => 'filter_name' }, + 'unknown-status:s' => { name => 'unknown_status', default => '' }, + 'warning-status:s' => { name => 'warning_status', default => '%{state} eq "enabled" and %{status} eq "yellow"' }, + 'critical-status:s' => { name => 'critical_status', default => '%{state} eq "enabled" and %{status} eq "red"' }, }); return $self; @@ -100,127 +90,93 @@ sub check_options { my ($self, %options) = @_; $self->SUPER::check_options(%options); - $self->{overload_th} = {}; - foreach my $val (@{$self->{option_results}->{threshold_overload}}) { - if ($val !~ /^(.*?),(.*?),(.*)$/) { - $self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'."); - $self->{output}->option_exit(); - } - my ($section, $status, $filter) = ($1, $2, $3); - if ($self->{output}->is_litteral_status(status => $status) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'."); - $self->{output}->option_exit(); - } - $self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section})); - push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status}; - } + $self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']); } -sub get_severity { - my ($self, %options) = @_; - my $status = 'UNKNOWN'; # default - - if (defined($self->{overload_th}->{$options{section}})) { - foreach (@{$self->{overload_th}->{$options{section}}}) { - if ($options{value} =~ /$_->{filter}/i) { - $status = $_->{status}; - return $status; - } - } - } - foreach (@{$thresholds->{$options{section}}}) { - if ($options{value} =~ /$$_[0]/i) { - $status = $$_[1]; - return $status; - } - } - - return $status; -} - -my %map_node_status = ( - 0 => 'none', - 1 => 'green', - 2 => 'yellow', - 3 => 'red', - 4 => 'blue', # unknown - 5 => 'gray', -); -my %map_node_enabled = ( - 0 => 'none', - 1 => 'enabled', - 2 => 'disabled', - 3 => 'disabledbyparent', -); +my $map_node_status = { + 0 => 'none', 1 => 'green', + 2 => 'yellow', 3 => 'red', + 4 => 'blue', 5 => 'gray', +}; +my $map_node_enabled = { + 0 => 'none', 1 => 'enabled', + 2 => 'disabled', 3 => 'disabledbyparent', +}; # New OIDS my $mapping = { new => { - AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.3', map => \%map_node_status }, - EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.4', map => \%map_node_enabled }, + AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.3', map => $map_node_status }, + EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.4', map => $map_node_enabled }, StatusReason => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.6' }, }, old => { - AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.13', map => \%map_node_status }, - EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.14', map => \%map_node_enabled }, + AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.13', map => $map_node_status }, + EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.14', map => $map_node_enabled }, StatusReason => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.16' }, }, }; my $mapping2 = { ltmNodeAddrStatServerCurConns => { oid => '.1.3.6.1.4.1.3375.2.2.4.2.3.1.9' }, }; -my $oid_ltmNodeAddrName = '.1.3.6.1.4.1.3375.2.2.4.1.2.1.17'; # old -my $oid_ltmNodeAddrStatusName = '.1.3.6.1.4.1.3375.2.2.4.3.2.1.7'; # new sub manage_selection { my ($self, %options) = @_; - my $snmp_result = $options{snmp}->get_multiple_table(oids => [ - { oid => $oid_ltmNodeAddrName }, - { oid => $oid_ltmNodeAddrStatusName }, - ], - , nothing_quit => 1); - - my ($branch_name, $map) = ($oid_ltmNodeAddrStatusName, 'new'); - if (!defined($snmp_result->{$oid_ltmNodeAddrStatusName}) || scalar(keys %{$snmp_result->{$oid_ltmNodeAddrStatusName}}) == 0) { - ($branch_name, $map) = ($oid_ltmNodeAddrName, 'old'); + my $snmp_result = $options{snmp}->get_multiple_table( + oids => [ + { oid => $mapping->{new}->{AvailState}->{oid} }, + { oid => $mapping->{old}->{AvailState}->{oid} }, + ], + nothing_quit => 1 + ); + + my ($branch_name, $map) = ($mapping->{new}->{AvailState}->{oid}, 'new'); + if (!defined($snmp_result->{$mapping->{new}->{AvailState}->{oid}}) || scalar(keys %{$snmp_result->{$mapping->{new}->{AvailState}->{oid}}}) == 0) { + ($branch_name, $map) = ($mapping->{old}->{AvailState}->{oid}, 'old'); } - + $self->{node} = {}; foreach my $oid (keys %{$snmp_result->{$branch_name}}) { - $oid =~ /^$branch_name\.(.*)$/; - my $instance = $1; + $oid =~ /^$branch_name\.(.*?)\.(.*)$/; + my ($num, $index) = ($1, $2); + + my $result = $options{snmp}->map_instance(mapping => $mapping->{$map}, results => $snmp_result->{$branch_name}, instance => $num . '.' . $index); + my $name = $self->{output}->to_utf8(join('', map(chr($_), split(/\./, $index)))); + if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && - $snmp_result->{$branch_name}->{$oid} !~ /$self->{option_results}->{filter_name}/) { - $self->{output}->output_add(long_msg => "skipping node '" . $snmp_result->{$branch_name}->{$oid} . "'.", debug => 1); + $name !~ /$self->{option_results}->{filter_name}/) { + $self->{output}->output_add(long_msg => "skipping node '" . $name . "'.", debug => 1); next; } - - $self->{node}->{$instance} = { Name => $snmp_result->{$branch_name}->{$oid} }; + + $self->{node}->{$num . '.' . $index} = { + display => $name, + status => $result->{AvailState} + }; } - - $options{snmp}->load(oids => [$mapping->{$map}->{AvailState}->{oid}, $mapping->{$map}->{EnabledState}->{oid}, - $mapping->{$map}->{StatusReason}->{oid}, $mapping2->{ltmNodeAddrStatServerCurConns}->{oid} + + $options{snmp}->load( + oids => [ + $mapping->{$map}->{EnabledState}->{oid}, + $mapping->{$map}->{StatusReason}->{oid}, + $mapping2->{ltmNodeAddrStatServerCurConns}->{oid} ], - instances => [keys %{$self->{node}}], instance_regexp => '^(.*)$'); + instances => [keys %{$self->{node}}], + instance_regexp => '^(.*)$' + ); $snmp_result = $options{snmp}->get_leef(nothing_quit => 1); - + foreach (keys %{$self->{node}}) { my $result = $options{snmp}->map_instance(mapping => $mapping->{$map}, results => $snmp_result, instance => $_); my $result2 = $options{snmp}->map_instance(mapping => $mapping2, results => $snmp_result, instance => $_); - if ($result->{EnabledState} !~ /enabled/) { - $self->{output}->output_add(long_msg => "skipping '" . $self->{node}->{$_}->{Name} . "': state is '$result->{EnabledState}'.", debug => 1); - delete $self->{node}->{$_}; - next; - } - $self->{node}->{$_}->{ltmNodeAddrStatServerCurConns} = $result2->{ltmNodeAddrStatServerCurConns}; $result->{StatusReason} = '-' if (!defined($result->{StatusReason}) || $result->{StatusReason} eq ''); - foreach my $name (keys %{$mapping->{$map}}) { - $self->{node}->{$_}->{$name} = $result->{$name}; - } + $self->{node}->{$_}->{reason} = $result->{StatusReason}; + $self->{node}->{$_}->{state} = $result->{EnabledState}; + $self->{node}->{$_}->{ltmNodeAddrStatServerCurConns} = $result2->{ltmNodeAddrStatServerCurConns}; } - + if (scalar(keys %{$self->{node}}) <= 0) { $self->{output}->add_option_msg(short_msg => "No entry found."); $self->{output}->option_exit(); @@ -241,20 +197,24 @@ Check Nodes status. Filter by name (regexp can be used). -=item B<--threshold-overload> +=item B<--unknown-status> -Set to overload default threshold values (syntax: section,status,regexp) -It used before default thresholds (order stays). -Example: --threshold-overload='node,CRITICAL,^(?!(green)$)' +Set unknown threshold for status (Default: ''). +Can used special variables like: %{state}, %{status}, %{display} -=item B<--warning-*> +=item B<--warning-status> -Threshold warning. -Can be: 'current-server-connections'. +Set warning threshold for status (Default: '%{state} eq "enabled" and %{status} eq "yellow"'). +Can used special variables like: %{state}, %{status}, %{display} -=item B<--critical-*> +=item B<--critical-status> -Threshold critical. +Set critical threshold for status (Default: '%{state} eq "enabled" and %{status} eq "red"'). +Can used special variables like: %{state}, %{status}, %{display} + +=item B<--warning-*> B<--critical-*> + +Thresholds. Can be: 'current-server-connections'. =back diff --git a/network/f5/bigip/snmp/mode/poolstatus.pm b/network/f5/bigip/snmp/mode/poolstatus.pm index c38843ff8..ffd275a63 100644 --- a/network/f5/bigip/snmp/mode/poolstatus.pm +++ b/network/f5/bigip/snmp/mode/poolstatus.pm @@ -32,7 +32,7 @@ sub custom_status_output { my $msg = sprintf( 'status: %s [state: %s] [reason: %s]', $self->{result_values}->{status}, - $self->{result_values}->{enabled}, + $self->{result_values}->{state}, $self->{result_values}->{reason}, ); return $msg; @@ -47,7 +47,7 @@ sub set_counters { $self->{maps_counters}->{pool} = [ { label => 'status', threshold => 0, set => { - key_values => [ { name => 'enabled' }, { name => 'status' }, { name => 'reason' },{ name => 'display' } ], + key_values => [ { name => 'state' }, { name => 'status' }, { name => 'reason' },{ name => 'display' } ], closure_custom_calc => \&catalog_status_calc, closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, @@ -98,8 +98,8 @@ sub new { $options{options}->add_options(arguments => { 'filter-name:s' => { name => 'filter_name' }, 'unknown-status:s' => { name => 'unknown_status', default => '' }, - 'warning-status:s' => { name => 'warning_status', default => '%{enabled} eq "enabled" and %{status} eq "yellow"' }, - 'critical-status:s' => { name => 'critical_status', default => '%{enabled} eq "enabled" and %{status} eq "red"' }, + 'warning-status:s' => { name => 'warning_status', default => '%{state} eq "enabled" and %{status} eq "yellow"' }, + 'critical-status:s' => { name => 'critical_status', default => '%{state} eq "enabled" and %{status} eq "red"' }, }); return $self; @@ -195,7 +195,7 @@ sub manage_selection { $result->{StatusReason} = '-' if (!defined($result->{StatusReason}) || $result->{StatusReason} eq ''); $self->{pool}->{$_}->{reason} = $result->{StatusReason}; - $self->{pool}->{$_}->{enabled} = $result->{EnabledState}; + $self->{pool}->{$_}->{state} = $result->{EnabledState}; $self->{pool}->{$_}->{ltmPoolStatServerCurConns} = $result2->{ltmPoolStatServerCurConns}; $self->{pool}->{$_}->{ltmPoolActiveMemberCnt} = $result2->{ltmPoolActiveMemberCnt}; $self->{pool}->{$_}->{ltmPoolMemberCnt} = $result2->{ltmPoolMemberCnt}; @@ -224,17 +224,17 @@ Filter by name (regexp can be used). =item B<--unknown-status> Set unknown threshold for status (Default: ''). -Can used special variables like: %{enabled}, %{status}, %{display} +Can used special variables like: %{state}, %{status}, %{display} =item B<--warning-status> -Set warning threshold for status (Default: '%{enabled} eq "enabled" and %{status} eq "yellow"'). -Can used special variables like: %{enabled}, %{status}, %{display} +Set warning threshold for status (Default: '%{state} eq "enabled" and %{status} eq "yellow"'). +Can used special variables like: %{state}, %{status}, %{display} =item B<--critical-status> -Set critical threshold for status (Default: '%{enabled} eq "enabled" and %{status} eq "red"'). -Can used special variables like: %{enabled}, %{status}, %{display} +Set critical threshold for status (Default: '%{state} eq "enabled" and %{status} eq "red"'). +Can used special variables like: %{state}, %{status}, %{display} =item B<--warning-*> B<--critical-*> diff --git a/network/f5/bigip/snmp/mode/virtualserverstatus.pm b/network/f5/bigip/snmp/mode/virtualserverstatus.pm index 4e112e857..94465a953 100644 --- a/network/f5/bigip/snmp/mode/virtualserverstatus.pm +++ b/network/f5/bigip/snmp/mode/virtualserverstatus.pm @@ -32,7 +32,7 @@ sub custom_status_output { my $msg = sprintf( 'status: %s [state: %s] [reason: %s]', $self->{result_values}->{status}, - $self->{result_values}->{enabled}, + $self->{result_values}->{state}, $self->{result_values}->{reason}, ); return $msg; @@ -46,7 +46,7 @@ sub set_counters { ]; $self->{maps_counters}->{vs} = [ { label => 'status', threshold => 0, set => { - key_values => [ { name => 'enabled' }, { name => 'status' }, { name => 'reason' },{ name => 'display' } ], + key_values => [ { name => 'state' }, { name => 'status' }, { name => 'reason' },{ name => 'display' } ], closure_custom_calc => \&catalog_status_calc, closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, @@ -70,8 +70,8 @@ sub new { $options{options}->add_options(arguments => { 'filter-name:s' => { name => 'filter_name' }, 'unknown-status:s' => { name => 'unknown_status', default => '' }, - 'warning-status:s' => { name => 'warning_status', default => '%{enabled} eq "enabled" and %{status} eq "yellow"' }, - 'critical-status:s' => { name => 'critical_status', default => '%{enabled} eq "enabled" and %{status} eq "red"' }, + 'warning-status:s' => { name => 'warning_status', default => '%{state} eq "enabled" and %{status} eq "yellow"' }, + 'critical-status:s' => { name => 'critical_status', default => '%{state} eq "enabled" and %{status} eq "red"' }, }); return $self; @@ -142,7 +142,7 @@ sub manage_selection { $self->{vs}->{$num . '.' . $index} = { display => $name, status => $result->{AvailState}, - enabled => $result->{EnabledState}, + state => $result->{EnabledState}, reason => $result->{StatusReason} }; } @@ -170,17 +170,17 @@ Filter by name (regexp can be used). =item B<--unknown-status> Set unknown threshold for status (Default: ''). -Can used special variables like: %{enabled}, %{status}, %{display} +Can used special variables like: %{state}, %{status}, %{display} =item B<--warning-status> -Set warning threshold for status (Default: '%{enabled} eq "enabled" and %{status} eq "yellow"'). -Can used special variables like: %{enabled}, %{status}, %{display} +Set warning threshold for status (Default: '%{state} eq "enabled" and %{status} eq "yellow"'). +Can used special variables like: %{state}, %{status}, %{display} =item B<--critical-status> -Set critical threshold for status (Default: '%{enabled} eq "enabled" and %{status} eq "red"'). -Can used special variables like: %{enabled}, %{status}, %{display} +Set critical threshold for status (Default: '%{state} eq "enabled" and %{status} eq "red"'). +Can used special variables like: %{state}, %{status}, %{display} =back