enh(snmp_standard): mode interfaces - add option --check-metrics (#3398)
This commit is contained in:
parent
34697b1655
commit
48fbb96cf1
|
@ -237,6 +237,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -98,6 +98,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -316,6 +316,10 @@ Check interface traffic.
|
|||
|
||||
Check interface optical.
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -100,7 +100,7 @@ sub default_critical_status {
|
|||
return undef;
|
||||
}
|
||||
|
||||
sub default_check_status {
|
||||
sub default_check_metrics {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return '%{opstatus} eq "up" or %{opstatus} eq "inService"';
|
||||
|
@ -403,6 +403,10 @@ Check interface traffic.
|
|||
|
||||
Check interface errors.
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up" or %{opstatus} eq "inService"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -291,6 +291,10 @@ Check interface data volume between two checks (not supposed to be graphed, usef
|
|||
|
||||
Check interface optical.
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -162,6 +162,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -115,6 +115,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -75,6 +75,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -174,6 +174,10 @@ Check interface data volume between two checks (not supposed to be graphed, usef
|
|||
|
||||
Check power over thernet.
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -276,6 +276,10 @@ Check interface data volume between two checks (not supposed to be graphed, usef
|
|||
|
||||
Check interface optical metrics.
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -75,6 +75,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -75,6 +75,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -173,6 +173,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -155,7 +155,7 @@ sub set_oids_cast {
|
|||
$self->{oid_ifHCOutBroadcastPkts} = '.1.3.6.1.4.1.6926.2.1.5.1.11';
|
||||
}
|
||||
|
||||
sub default_check_status {
|
||||
sub default_check_metrics {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return '%{opstatus} eq "enabled" and %{linkstatus} eq "true"';
|
||||
|
@ -456,6 +456,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "enabled" and %{linkstatus} eq "true"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -42,9 +42,10 @@ sub custom_threshold_output {
|
|||
$status = 'warning';
|
||||
}
|
||||
|
||||
$self->{instance_mode}->{last_status} = 0;
|
||||
if (eval "$self->{instance_mode}->{check_status}") {
|
||||
$self->{instance_mode}->{last_status} = 1;
|
||||
$self->{instance_mode}->{last_status} = 1;
|
||||
if (defined($self->{instance_mode}->{option_results}->{check_metrics}) && $self->{instance_mode}->{option_results}->{check_metrics} ne '' &&
|
||||
!$self->eval(value => $self->{instance_mode}->{option_results}->{check_metrics})) {
|
||||
$self->{instance_mode}->{last_status} = 0;
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
@ -798,7 +799,7 @@ sub check_oids_label {
|
|||
}
|
||||
}
|
||||
|
||||
sub default_check_status {
|
||||
sub default_check_metrics {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return '%{opstatus} eq "up"';
|
||||
|
@ -867,6 +868,7 @@ sub new {
|
|||
'add-duplex-status' => { name => 'add_duplex_status' },
|
||||
'warning-status:s' => { name => 'warning_status', default => $self->default_warning_status() },
|
||||
'critical-status:s' => { name => 'critical_status', default => $self->default_critical_status() },
|
||||
'check-metrics:s' => { name => 'check_metrics', default => $self->default_check_metrics() },
|
||||
'global-admin-up-rule:s' => { name => 'global_admin_up_rule', default => $self->default_global_admin_up_rule() },
|
||||
'global-oper-up-rule:s' => { name => 'global_oper_up_rule', default => $self->default_global_oper_up_rule() },
|
||||
'global-admin-down-rule:s' => { name => 'global_admin_down_rule', default => $self->default_global_admin_down_rule() },
|
||||
|
@ -984,8 +986,7 @@ sub check_options {
|
|||
}
|
||||
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
$self->{check_status} = $self->default_check_status();
|
||||
$self->{check_status} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
$self->{option_results}->{check_metrics} =~ s/%\{(.*?)\}/\$values->{$1}/g;
|
||||
}
|
||||
|
||||
sub get_display_value {
|
||||
|
@ -1571,6 +1572,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -88,6 +88,10 @@ Check interface speed.
|
|||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
Loading…
Reference in New Issue