Chrony

Parses the chrony config file

Author: Pat Riehecky rieh.nosp@m.ecky@fnal.nosp@m..gov

Summary
ChronyParses the chrony config file
ReferenceThis lens tries to keep as close as possible to chrony config syntax
LimitationsDoes not (currently) support
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration filesThis lens applies to /etc/chrony.conf
Import provided expressions
empty
eol
space
email_addr
word
integer
decimal
ip
Create required expressions
number
address_re
commentfrom 4.2.1 of the upstream doc Chrony comments start with: !
no_spaceNo spaces or comment characters
cmd_optionsServer/Peer options with values
cmd_flagsServer/Peer options without values
server_peerServer/Peer key names
flagsOptions without values
log_flagslog has a specific options list
simple_keysOptions with single values
Make some sub-lenses for use in later lenses
host_flags
host_options
log_flag_list
store_address
Lenses for parsing out sections
all_flagsmatch all flags using Build.flag_line
kvoptions with only one arg can be directly mapped to key = value
Options with multiple valuesEach of these gets their own parsing block
host_listFind all ntp servers/peers and their flags/options
log_listlog has a specific options list
bcastbroadcast has specific syntax
fdriftfallbackdrift has specific syntax
istepslewinitstepslew has specific syntax
locallocal has specific syntax
emailmailonchange has specific syntax
makestepmakestep has specific syntax
maxchangemaxchange has specific syntax
Final lense summary
settingsAll supported chrony settings
lnsThe crony lens
filterThe files parsed by default

Reference

This lens tries to keep as close as possible to chrony config syntax

See http://chrony.tuxfamily.org/manual.html#Configuration-file

Limitations

Does not (currently) support

  • include
  • manual
  • refclock
  • tempcomp

License

This file is licenced under the LGPL v2+, like the rest of Augeas.

Lens Usage

To be documented

Configuration files

This lens applies to /etc/chrony.conf

See filter.

Import provided expressions

empty

let empty = Util.empty

eol

let eol = Util.eol

space

let space = Sep.space

email_addr

let email_addr = Rx.email_addr

word

let word = Rx.word

integer

let integer = Rx.integer

decimal

let decimal = Rx.decimal

ip

let ip = Rx.ip

Create required expressions

number

let number = integer | decimal

address_re

let address_re = Rx.ip | Rx.hostname

comment

let comment = Util.comment_generic /[ \t]*[!;#%][ \t]*/ "# "

from 4.2.1 of the upstream doc Chrony comments start with: ! ; # or % and must be on their own line

no_space

let no_space = /[^ \t\r\n!;#%]+/

No spaces or comment characters

cmd_options

let cmd_options = "key" | /maxdelay((dev)?ratio)?/ | /(min|max)poll/ | "polltarget" | "port" | "presend"

Server/Peer options with values

cmd_flags

let cmd_flags = "auto_offline"|"iburst"|"noselect"|"offline"|"prefer"

Server/Peer options without values

server_peer

let server_peer = "server"|"peer"

Server/Peer key names

flags

let flags = "dumponexit" | "generatecommandkey" | "lock_all" | "noclientlog" | "rtconutc" | "rtcsync"

Options without values

log_flags

let log_flags = /measurements|statistics|tracking|rtc|refclocks|tempcomp/

log has a specific options list

simple_keys

let simple_keys = "acquisitionport" | "allow" | "bindaddress" | "bindcmdaddress" | "cmdallow" | "cmddeny" | "combinelimit" | "commandkey" | "cmdport" | "corrtimeratio" | "deny" | "driftfile" | "dumpdir" | "keyfile" | "leapsectz" | "linux_hz" | "linux_freq_scale" | "logbanner" | "logchange" | "logdir" | "maxclockerror" | "maxsamples" | "maxupdateskew" | "minsamples" | "clientloglimit" | "pidfile" | "port" | "reselectdist" | "rtcdevice" | "rtcfile" | "sched_priority" | "stratumweight" | "user"

Options with single values

Make some sub-lenses for use in later lenses

host_flags

let host_flags = [ space . key cmd_flags ]

host_options

let host_options = [ space . key cmd_options . space . store integer ]

log_flag_list

let log_flag_list = [ space . key log_flags ]

store_address

let store_address = [ label "address" . store address_re ]

Lenses for parsing out sections

all_flags

let all_flags = Build.flag_line flags

match all flags using Build.flag_line

kv

let kv = Build.key_value_line_comment simple_keys space (store no_space) comment

options with only one arg can be directly mapped to key = value

Options with multiple values

Each of these gets their own parsing block

  • server|peer <address> <options>
  • log <options>
  • broadcast <interval> <address> <optional port>
  • fallbackdrift <min> <max>
  • initstepslew <threshold> <addr> <optional extra addrs>
  • local stratum <int>
  • mailonchange <emailaddress> <threshold>
  • makestep <threshold> <limit>
  • maxchange <threshold> <delay> <limit>

host_list

let host_list = [ Util.indent . key server_peer . space . store address_re . ( host_flags | host_options )* . eol ]

Find all ntp servers/peers and their flags/options

log_list

let log_list = [ Util.indent . key "log" . log_flag_list+ . eol ]

log has a specific options list

bcast

let bcast = [ Util.indent . key "broadcast" . space . [ label "interval" . store integer ] . space . store_address . ( space . [ label "port" . store integer] | eol) ]

broadcast has specific syntax

fdrift

let fdrift = [ Util.indent . key "fallbackdrift" . space . [ label "min" . store integer ] . space . [ label "max" . store integer ] . eol ]

fallbackdrift has specific syntax

istepslew

let istepslew = [ Util.indent . key "initstepslew" . space . [ label "threshold" . store number ] . ( space . store_address )+ . eol ]

initstepslew has specific syntax

local

let local = [ Util.indent . key "local" . space . [ key "stratum" . space . store integer ] . eol ]

local has specific syntax

email

let email = [ Util.indent . key "mailonchange" . space . [ label "emailaddress" . store email_addr ] . space . [ label "threshold" . store number ] . eol ]

mailonchange has specific syntax

makestep

let makestep = [ Util.indent . key "makestep" . space . [ label "threshold" . store number ] . space . [ label "limit" . store integer ] . eol ]

makestep has specific syntax

maxchange

let maxchange = [ Util.indent . key "maxchange" . space . [ label "threshold" . store number ] . space . [ label "delay" . store integer ] . space . [ label "limit" . store integer ] . eol ]

maxchange has specific syntax

Final lense summary

settings

let settings = host_list | log_list | bcast | fdrift | istepslew | local | email | makestep | maxchange | kv | all_flags

All supported chrony settings

lns

let lns = ( empty | comment | settings )*

The crony lens

filter

The files parsed by default

let empty = Util.empty
let eol = Util.eol
let space = Sep.space
let email_addr = Rx.email_addr
let word = Rx.word
let integer = Rx.integer
let decimal = Rx.decimal
let ip = Rx.ip
let number = integer | decimal
let address_re = Rx.ip | Rx.hostname
let comment = Util.comment_generic /[ \t]*[!;#%][ \t]*/ "# "
from 4.2.1 of the upstream doc Chrony comments start with: !
let no_space = /[^ \t\r\n!;#%]+/
No spaces or comment characters
let cmd_options = "key" | /maxdelay((dev)?ratio)?/ | /(min|max)poll/ | "polltarget" | "port" | "presend"
Server/Peer options with values
let cmd_flags = "auto_offline"|"iburst"|"noselect"|"offline"|"prefer"
Server/Peer options without values
let server_peer = "server"|"peer"
Server/Peer key names
let flags = "dumponexit" | "generatecommandkey" | "lock_all" | "noclientlog" | "rtconutc" | "rtcsync"
Options without values
let log_flags = /measurements|statistics|tracking|rtc|refclocks|tempcomp/
log has a specific options list
let simple_keys = "acquisitionport" | "allow" | "bindaddress" | "bindcmdaddress" | "cmdallow" | "cmddeny" | "combinelimit" | "commandkey" | "cmdport" | "corrtimeratio" | "deny" | "driftfile" | "dumpdir" | "keyfile" | "leapsectz" | "linux_hz" | "linux_freq_scale" | "logbanner" | "logchange" | "logdir" | "maxclockerror" | "maxsamples" | "maxupdateskew" | "minsamples" | "clientloglimit" | "pidfile" | "port" | "reselectdist" | "rtcdevice" | "rtcfile" | "sched_priority" | "stratumweight" | "user"
Options with single values
let host_flags = [ space . key cmd_flags ]
let host_options = [ space . key cmd_options . space . store integer ]
let log_flag_list = [ space . key log_flags ]
let store_address = [ label "address" . store address_re ]
let all_flags = Build.flag_line flags
match all flags using Build.flag_line
let kv = Build.key_value_line_comment simple_keys space (store no_space) comment
options with only one arg can be directly mapped to key = value
let host_list = [ Util.indent . key server_peer . space . store address_re . ( host_flags | host_options )* . eol ]
Find all ntp servers/peers and their flags/options
let log_list = [ Util.indent . key "log" . log_flag_list+ . eol ]
log has a specific options list
let bcast = [ Util.indent . key "broadcast" . space . [ label "interval" . store integer ] . space . store_address . ( space . [ label "port" . store integer] | eol) ]
broadcast has specific syntax
let fdrift = [ Util.indent . key "fallbackdrift" . space . [ label "min" . store integer ] . space . [ label "max" . store integer ] . eol ]
fallbackdrift has specific syntax
let istepslew = [ Util.indent . key "initstepslew" . space . [ label "threshold" . store number ] . ( space . store_address )+ . eol ]
initstepslew has specific syntax
let local = [ Util.indent . key "local" . space . [ key "stratum" . space . store integer ] . eol ]
local has specific syntax
let email = [ Util.indent . key "mailonchange" . space . [ label "emailaddress" . store email_addr ] . space . [ label "threshold" . store number ] . eol ]
mailonchange has specific syntax
let makestep = [ Util.indent . key "makestep" . space . [ label "threshold" . store number ] . space . [ label "limit" . store integer ] . eol ]
makestep has specific syntax
let maxchange = [ Util.indent . key "maxchange" . space . [ label "threshold" . store number ] . space . [ label "delay" . store integer ] . space . [ label "limit" . store integer ] . eol ]
maxchange has specific syntax
let settings = host_list | log_list | bcast | fdrift | istepslew | local | email | makestep | maxchange | kv | all_flags
All supported chrony settings
let lns = ( empty | comment | settings )*
The crony lens
The files parsed by default
Close