ntp #24


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
across computers.


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.

If you have a large number of nodes which need to keep close sync with one
another but need to keep upstream traffic to a minimum, try auto_peers:

juju set ntp auto_peers=true

This will select the most suitable units for connecting with upstream, and
configure the remaining units to receive time from those units.


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 select the most appropriate units in the service to be a service stratum connecting with upstream NTP servers, and use those units as time sources for the remaining units.
(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.
(int) How many units should attempt to connect with upstream NTP servers?
(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.