diff --git a/centreon-plugins/os/linux/local/mode/ntp.pm b/centreon-plugins/os/linux/local/mode/ntp.pm index ec4bdd8f5..07cfe75e8 100644 --- a/centreon-plugins/os/linux/local/mode/ntp.pm +++ b/centreon-plugins/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; }