Managing ZoneControl

Controlling the ZoneControl service

ZoneControl comes with scripts and files relevant to the service management system for the Operating System it is installed on.

Note that ZoneControl does not support run-time reloading of its configuration.

systemd (RHEL/CentOS 7+, Debian 8+, Ubuntu 15.04+)

ZoneControl’s service is called (unsurprisingly) zonecontrol.service and can be controlled in the normal fashion.

Starting:

systemctl start zonecontrol.service

Stopping:

systemctl stop zonecontrol.service

Restarting:

systemctl restart zonecontrol.service

Managing ZoneControl

ZoneControl comes with a tool called zonecontrol-manage, which is a wrapper around the Django manage.py script.

This script supports all the default commands from Django and some ZoneControl related ones.

zonecontrol-manage addserver

This command can be used to add PowerDNS Authoritative Servers to the configuration without logging in as an admin to the web-interface. It can be invoked as follows:

zonecontrol-manage addserver Server1 https://192.0.2.3:8083 MySecretAPIKey

This will add a new server called “Server1”. This server is connected to on https://192.0.2.3:8083 and “MySecretAPIKey” is used as the shared secret to connect.

This command also supports some other options, please refer to the output of

zonecontrol-manage addserver --help

zonecontrol-manage runscheduled

Run all scheduled tasks.

zonecontrol-manage prunedb

When trying out this script make sure to backup your DB first!

This command supports -dry-run to see what will happen without doing any actual changes to the database. See:

zonecontrol-manage prunedb --help

The prunedb command can be used to clean up the audit log and zone history tables. Depending on how ZoneControl is used and managed these two tables can accumulate a lot of data.

The most common, and safest, usage is:

zonecontrol-manage prunedb --history

This will only prune zones that have been explicitly marked as safe to prune in the ZoneControl front-end. By default the last 1000 days will be kept.

Running the following commands will prune the audit log or zone history for all zones:

zonecontrol-manage prunedb --audit
zonecontrol-manage prunedb --history-all

The number of days to keep can be adjusted with the --keep parameter, for example:

pipenv run ./manage.py prunedb --audit --keep 5

This script can be run by hand or put in a cron job.