From d3954ca8df1eada5f6dd1ea2271043af4dd3da38 Mon Sep 17 00:00:00 2001 From: CPbN Date: Tue, 26 Mar 2019 16:56:52 +0100 Subject: [PATCH] Local NTP, use correct maps --- os/linux/local/mode/ntp.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/os/linux/local/mode/ntp.pm b/os/linux/local/mode/ntp.pm index ec4bdd8f5..07cfe75e8 100644 --- a/os/linux/local/mode/ntp.pm +++ b/os/linux/local/mode/ntp.pm @@ -84,9 +84,17 @@ sub custom_status_calc { $self->{result_values}->{rawtype} = $options{new_datas}->{$self->{instance} . '_type'}; $self->{result_values}->{rawstate} = $options{new_datas}->{$self->{instance} . '_state'}; - $self->{result_values}->{type} = $type_map_chronyc{$options{new_datas}->{$self->{instance} . '_type'}}; + if ($self->{instance_mode}->{option_results}->{command} eq 'ntpq') { + $self->{result_values}->{type} = $type_map_ntpq{$options{new_datas}->{$self->{instance} . '_type'}}; + } else { + $self->{result_values}->{type} = $type_map_chronyc{$options{new_datas}->{$self->{instance} . '_type'}}; + } $self->{result_values}->{reach} = $options{new_datas}->{$self->{instance} . '_reach'}; - $self->{result_values}->{state} = $state_map_chronyc{$options{new_datas}->{$self->{instance} . '_state'}}; + if ($self->{instance_mode}->{option_results}->{command} eq 'ntpq') { + $self->{result_values}->{state} = $state_map_ntpq{$options{new_datas}->{$self->{instance} . '_state'}}; + } else { + $self->{result_values}->{state} = $state_map_chronyc{$options{new_datas}->{$self->{instance} . '_state'}}; + } return 0; }