NTP, the Network Time Protocol, is used to keep computer clocks accurate
by synchronizing them over the Internet or a local network, or by
following an accurate hardware receiver that interprets GPS, DCF-77,
NIST or similar time signals.
This charm can be deployed alongside principal charms to enable NTP
management across deployed services.
NTP provides network based time services to ensure synchronization of time
The ntp charm is a subordinate charm which is designed for use with other
principal charms. It can be used in two ways:
In this mode, the ntp charm is used to configure NTP in other service units to
talk directly to a set of NTP time sources:
juju deploy ntp juju add-relation ntp myservice
By default this charm uses the standard set of NTP pool servers which are
configured in the ntp Ubuntu package.
However, if you have a handy atomic clock on your network which you would prefer
to use then you can add that:
juju set ntp source=myatomiclock.local.net
You can also specify multiple sources and peers:
juju set ntp source="mac1.local.net mac2.local.net mac3.local.net" juju set ntp peers="mac1.local.net mac2.local.net mac3.local.net"
To disable the default list of pool servers, set that to the empty string:
juju set ntp pools=""
Sources, peers, and pools should be space separated.
When you need a set of services to keep close time to each other, it may
be useful to have them automatically peer with each other. This means
any set of services which use the same ntp subordinate will peer together.
juju set ntp auto_peers=true
This will add all the hosts as peers to each other. Using auto_peers is not
recommended when more than 10 units are expected to be deployed.
In the event that you don't wish every server on your network to talk directly to
your configured time sources, you can use this charm in-conjunction with the ntpmaster
juju deploy ntp juju deploy ntpmaster juju add-relation ntp ntpmaster
This allows you to gate NTP services to a single set of servers within your control.
This might have application in more secure network environments where general
outbound network access to the Internet is not avaliable or desirable and you don't
have a good internal time source such as an atomic clock.
You can of course have more than one ntpmaster:
juju add-unit ntpmaster
All services that the ntp charm is subordinate to will be configured to sync with
all avaliable masters.
The ntpmaster charm supports the same "source" configuration that the ntp charm does.
The ntp charm can also be used in place of the ntpmaster charm when coupled with
another primary charm:
juju deploy ntp ntp-masters juju deploy ubuntu --num-units=4 juju add-relation ubuntu ntp-masters juju set ntp-masters auto_peers=true juju deploy ntp juju deploy my-other-service --num-units=30 juju add-relation ntp my-other-service juju add-relation ntp ntp-masters
This is the recommended method, since this charm provides better monitoring and
more flexible configuration than ntpmaster.
- (string) A space-separated list of nagios ntpmon checks to enable. Options are "offset peers reachability sync"; if all are specified, they are combined into a single check; leave empty for no checks.
- offset peers reachability sync
- (string) A comma-separated list of nagios servicegroups. If left empty, the nagios_context will be used as the servicegroup.
- (string) Space-separated list of NTP servers to use as peers for time. Peers are allowed to query the local NTP server via ntpq.
- (boolean) Automatically peer with other units in the same service. DEPRECATED. Please consider using the ntpmaster charm to provide sufficient peers for your environment in favour of auto_peers.
- (string) Used by the nrpe-external-master subordinate charm. A string that will be prepended to instance name to set the host name in nagios. So for instance the hostname would be something like: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them.
- (int) The NTP stratum at which ntp most lose connectivity to before it considers itself orphaned, and starts communicating with local peers. The default value of 6 will enable orphaned operation when there are no stratum 6 servers or servers of a higher stratum available, which is two strata below most Internet NTP hosts. Set to 0 to disable orphan mode entirely.
- (string) Space-separated list of NTP servers to use as sources for time.
- (string) Space-separated list of NTP servers to use as pool sources for time. Pool sources are recommended over normal sources for their self-healing capabilities. Leave empty to disable pool sources.
- 0.ubuntu.pool.ntp.org 1.ubuntu.pool.ntp.org 2.ubuntu.pool.ntp.org 3.ubuntu.pool.ntp.org ntp.ubuntu.com
- (boolean) Use iburst for all peers/sources, not just those received via the master relation.