Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to enable remote monitoring #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ chrony will be configured to:
> be reported using the clients command in chronyc. This option also effectively disables server support
> for the NTP interleaved mode.

### Remote monitoring

If you'd like to enable remote monitoring, you can pass the environment variable `ALLOW_REMOTE_MON` set to
`true` to the container. This will let you run `chronyc` commands from another host.

You can use this to check the status of the NTP server without the need to run docker commands.

## Logging

Expand Down
11 changes: 11 additions & 0 deletions assets/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ for N in $NTP_SERVERS; do
fi
done

# Remote access to the chrony server
if [ "${ALLOW_REMOTE_MON:-false}" = true ]; then
{
echo
echo "# allow remote monitoring"
echo "cmdallow all"
echo "bindcmdaddress 0.0.0.0"
echo "bindcmdaddress ::"
} >> ${CHRONY_CONF_FILE}
fi

# final bits for the config file
{
echo
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ services:
# - TZ=America/Vancouver
# - NOCLIENTLOG=true
# - ENABLE_NTS=true
# - ALLOW_REMOTE_MON=true
1 change: 1 addition & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function start_container() {
--env=ENABLE_NTS=${ENABLE_NTS} \
--env=NOCLIENTLOG=${NOCLIENTLOG} \
--env=LOG_LEVEL=${LOG_LEVEL} \
--env=ALLOW_REMOTE_MON=${ALLOW_REMOTE_MON} \
--read-only=true \
--tmpfs=/etc/chrony:rw,mode=1750 \
--tmpfs=/run/chrony:rw,mode=1750 \
Expand Down
3 changes: 3 additions & 0 deletions vars
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ LOG_LEVEL=0

# (optional) additional docker run options you may want
DOCKER_OPTS=""

# (optional) allow remote access to chronyd
ALLOW_REMOTE_MON=false