I want to check the status of command ntpq -p from various servers after installing the package and ntp configuration file and running the ntp service .how do I get the output from all the hosts in a file

asked 2017-02-05 22:26:46 -0500

Sonu gravatar image

I want to check the status of command ntpq -p from various server to ensure if the ntp is in sync with ntp server

edit retag flag offensive close merge delete


It depends on what you are trying to accomplish. This sounds more like a monitoring problem than a 'puppet' problem. If you want to do this ad-hoc, somehing like https://docs.puppet.com/mcollective/ ?

DarylW gravatar imageDarylW ( 2017-02-06 07:53:25 -0500 )edit

a 'roundabout' way to do this would be to have a custom fact that would get the information you need from ntpq -p, and you can look up fact information in puppetDB https://docs.puppet.com/puppetdb/ with https://docs.puppet.com/puppetdb/4.3/api/query/tutorial-pql.html

DarylW gravatar imageDarylW ( 2017-02-06 07:55:40 -0500 )edit

If you create an exec resource for it with logoutput => true, then the output will appear in the agents' reports.

Josh gravatar imageJosh ( 2017-02-06 14:42:11 -0500 )edit

This is not a puppet problem. for i in `cat servers.list` do ssh $i 'hostname; ntpq -p' >> /tmp/ntpq.res; done.

puser gravatar imagepuser ( 2017-02-07 14:18:31 -0500 )edit

I had made a module of ntp which includes package,file and service resources..just wanted to know how if all hosts are syncing with ntpserver...Thanks all for that insight . appreciate your help...

Sonu gravatar imageSonu ( 2017-02-07 19:36:39 -0500 )edit