(plugin) os::linux::local - mode ntp fix offset threshold (#4267)

This commit is contained in:
qgarnier 2023-03-08 10:21:50 +00:00 committed by GitHub
parent 97570afbe3
commit 200ffa6592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ sub custom_status_output {
sub custom_offset_perfdata { sub custom_offset_perfdata {
my ($self, %options) = @_; my ($self, %options) = @_;
if ($self->{result_values}->{state} ne '*') { if ($self->{result_values}->{rawstate} ne '*') {
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
nlabel => $self->{nlabel}, nlabel => $self->{nlabel},
unit => 'ms', unit => 'ms',
@ -106,7 +106,7 @@ sub custom_offset_perfdata {
sub custom_offset_threshold { sub custom_offset_threshold {
my ($self, %options) = @_; my ($self, %options) = @_;
if ($self->{result_values}->{state} ne '*') { if ($self->{result_values}->{rawstate} ne '*') {
return 'ok'; return 'ok';
} }
return $self->{perfdata}->threshold_check(value => $self->{result_values}->{offset}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{thlabel}, exit_litteral => 'warning' } ]); return $self->{perfdata}->threshold_check(value => $self->{result_values}->{offset}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{thlabel}, exit_litteral => 'warning' } ]);
@ -150,7 +150,7 @@ sub set_counters {
} }
}, },
{ label => 'offset', nlabel => 'peer.time.offset.milliseconds', display_ok => 0, set => { { label => 'offset', nlabel => 'peer.time.offset.milliseconds', display_ok => 0, set => {
key_values => [ { name => 'offset' }, { name => 'state' }, { name => 'display' } ], key_values => [ { name => 'offset' }, { name => 'rawstate' }, { name => 'display' } ],
output_template => 'offset: %s ms', output_template => 'offset: %s ms',
closure_custom_threshold_check => $self->can('custom_offset_threshold'), closure_custom_threshold_check => $self->can('custom_offset_threshold'),
closure_custom_perfdata => $self->can('custom_offset_perfdata'), closure_custom_perfdata => $self->can('custom_offset_perfdata'),