Expose each zone's last refresh time via rndc and the stats channel

When a zone is refreshed its file is touched by `named`. Checking the
zone file's modification time is a good way to verify that secondary
refreshes are working correctly. The last refresh time is good for
this purpose since it can give the operator a reasonably prompt
notification that somthing has broken with plenty of time to
remediate, e.g. 24h after a zone stops updating is typically several
days before the zone will break. If you try to alert based on the
expiry time you either need to accommodate different expiry intervals
in different zones (which is duplicating logic that already exists
inside `named`), or set the alert to occur much closer to the time
when a zone will break.

This patch adds the last refresh time alongside the other zone timing
parameters in the output of `rndc zonestatus`, and it adds a similar
selection of zone timing parameters to the statschannel output.

In servers that have a static configuration, `named-checkconf -px` is
a handy way for a script to find out what zones are configured and
where their files are, so that they can be checked for freshness. In a
server with a dynamic configuration (using `rndc addzone` or catalog
zones) the best way to get a list of zones is from the statschannel.
This change gives monitoring scripts a simple one-stop shop for
checking that all zones are reasonably fresh. For example, this script
lists stale zones and when they were last refreshed:

	curl -Ssf http://localhost:8053/json/v1/zones |
	jq -r '.views[].zones[] |
		select(has("lastrefresh") and
			.lastrefresh < (now - 86400 | todate)) |
		"\(.lastrefresh) \(.name)"'
80 jobs for !3075 with u/fanf2/last-refresh in 22 minutes and 31 seconds (queued for 10 seconds)
latest detached
Status Job ID Name Coverage
  Precheck
passed #684985
amd64 linux
🐞:sid:amd64

00:03:19

failed #684984
amd64 linux
💾:sid:amd64

00:00:25

passed #684982
amd64 linux
autoreconf:sid:amd64

00:00:39

failed #684983
amd64 linux
misc:sid:amd64

00:00:14

 
  Build
passed #685001
amd64 linux
asan:sid:amd64

00:05:00

passed #685008
amd64 freebsd
clang:freebsd11.3:amd64

00:01:20

passed #685009
amd64 freebsd
clang:freebsd12.0:amd64

00:01:11

passed #685010
amd64 libvirt
clang:openbsd6.6:amd64

00:06:08

passed #685005
amd64 linux
clang:stretch:amd64

00:03:49

passed #685006
i386 linux
clang:stretch:i386

00:03:41

passed #684986
amd64 linux
gcc:alpine3.11:amd64

00:02:57

passed #685000
amd64 linux
gcc:bionic:amd64

00:03:12

passed #684992
amd64 linux
gcc:buster:amd64

00:02:47

passed #684987
amd64 linux
gcc:centos6:amd64

00:02:37

passed #684988
amd64 linux
gcc:centos7:amd64

00:02:44

passed #684989
amd64 linux
gcc:centos8:amd64

00:02:59

passed #684998
amd64 linux
gcc:fedora31:amd64

00:02:59

passed #684990
amd64 linux
gcc:jessie:amd64

00:03:07

passed #684993
amd64 linux
gcc:sid:amd64

00:04:27

passed #684995
arm64 linux
gcc:sid:arm64

00:08:00

passed #684996
i386 linux
gcc:sid:i386

00:03:14

passed #684991
amd64 linux
gcc:stretch:amd64

00:03:24

passed #684997
amd64 linux
gcc:tumbleweed:amd64

00:03:00

passed #684999
amd64 linux
gcc:xenial:amd64

00:03:20

failed #685012
amd64 windows
msvc:windows:amd64

00:02:02

passed #685004
amd64 linux
mutexatomics:sid:amd64

00:03:19

passed #685011
amd64 linux
nolibtool:sid:amd64

00:03:25

passed #684994
amd64 linux
oot:sid:amd64

00:03:17

passed #685007
amd64 linux
pkcs11:sid:amd64

00:03:17

passed #685003
amd64 linux
rwlock:sid:amd64

00:03:09

passed #685002
amd64 linux
tsan:buster:amd64

00:03:48

 
  Unit
passed #685027
amd64 linux
unit:asan:sid:amd64

00:01:06

passed #685033
amd64 freebsd
unit:clang:freebsd11.3:amd64

00:00:34

passed #685034
amd64 freebsd
unit:clang:freebsd12.0:amd64

00:00:26

passed #685031
amd64 linux
unit:clang:stretch:amd64

00:00:56

passed #685013
amd64 linux
unit:gcc:alpine3.11:amd64

00:00:55

passed #685026
amd64 linux
unit:gcc:bionic:amd64

00:00:57

passed #685019
amd64 linux
unit:gcc:buster:amd64

00:00:55

passed #685014
amd64 linux
unit:gcc:centos6:amd64

00:00:54

passed #685015
amd64 linux
unit:gcc:centos7:amd64

00:00:54

passed #685016
amd64 linux
unit:gcc:centos8:amd64

00:00:54

passed #685024
amd64 linux
unit:gcc:fedora31:amd64

00:00:58

passed #685017
amd64 linux
unit:gcc:jessie:amd64

00:00:34

passed #685020
amd64 linux
unit:gcc:sid:amd64

00:00:57

passed #685021
arm64 linux
unit:gcc:sid:arm64

00:01:19

passed #685022
i386 linux
unit:gcc:sid:i386

00:01:02

passed #685018
amd64 linux
unit:gcc:stretch:amd64

00:00:51

passed #685023
amd64 linux
unit:gcc:tumbleweed:amd64

00:00:52

passed #685025
amd64 linux
unit:gcc:xenial:amd64

00:00:58

failed #685030
amd64 linux allowed to fail
unit:mutexatomics:sid:amd64

00:10:44

passed #685035
amd64 linux
unit:nolibtool:sid:amd64

00:01:10

passed #685032
amd64 linux
unit:pkcs11:sid:amd64

00:00:55

passed #685029
amd64 linux
unit:rwlock:sid:amd64

00:00:56

failed #685028
amd64 linux allowed to fail
unit:tsan:buster:amd64

00:02:37

 
  System
passed #685050
amd64 linux
system:asan:sid:amd64

00:10:48

passed #685055
amd64 freebsd
system:clang:freebsd11.3:amd64

00:09:05

passed #685056
amd64 freebsd
system:clang:freebsd12.0:amd64

00:08:57

passed #685036
amd64 linux
system:gcc:alpine3.11:amd64

00:09:13

passed #685049
amd64 linux
system:gcc:bionic:amd64

00:08:45

passed #685042
amd64 linux
system:gcc:buster:amd64

00:09:01

passed #685037
amd64 linux
system:gcc:centos6:amd64

00:08:41

passed #685038
amd64 linux
system:gcc:centos7:amd64

00:09:00

passed #685039
amd64 linux
system:gcc:centos8:amd64

00:08:54

passed #685047
amd64 linux
system:gcc:fedora31:amd64

00:08:53

passed #685040
amd64 linux
system:gcc:jessie:amd64

00:09:31

passed #685043
amd64 linux
system:gcc:sid:amd64

00:08:47

passed #685044
arm64 linux
system:gcc:sid:arm64

00:09:55

passed #685045
i386 linux
system:gcc:sid:i386

00:09:05

passed #685041
amd64 linux
system:gcc:stretch:amd64

00:08:43

passed #685046
amd64 linux
system:gcc:tumbleweed:amd64

00:09:41

passed #685048
amd64 linux
system:gcc:xenial:amd64

00:08:41

passed #685053
amd64 linux
system:mutexatomics:sid:amd64

00:08:43

passed #685057
amd64 linux
system:nolibtool:sid:amd64

00:09:06

passed #685054
amd64 linux
system:pkcs11:sid:amd64

00:09:32

passed #685052
amd64 linux
system:rwlock:sid:amd64

00:10:55

failed #685051
amd64 linux allowed to fail
system:tsan:buster:amd64

00:12:48

 
  Docs
passed #685058
amd64 linux
docs:sid:amd64

00:00:36

 
  Postcheck
passed #685060
amd64 linux
cppcheck:gcc:sid:amd64

00:03:42

passed #685061
arm64 linux
cppcheck:gcc:sid:arm64

00:03:40

passed #685059
amd64 linux
scan-build:buster:amd64

00:12:39

 
Name Stage Failure
failed
system:tsan:buster:amd64 System
make: *** [Makefile:486: test] Error 1
Running after script...
$ find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts...
bin/tests/system/*/tsan.*: found 18 matching files
bin/tests/system/*/*/tsan.*: found 243 matching files

tsan/: found 179 matching files

Uploading artifacts to coordinator... ok
id=685051 responseStatus=201 Created token=tE56qivg
ERROR: Job failed: exit code 1
failed
unit:mutexatomics:sid:amd64 Unit
Generating kyua_html/lib_ns_tests_query_test_main.html
Generating kyua_html/report.css
Generating kyua_html/index.html
Uploading artifacts...
kyua.log: found 1 matching files
kyua.results: found 1 matching files

kyua_html/: found 69 matching files

Uploading artifacts to coordinator... ok
id=685030 responseStatus=201 Created token=zvodc3C8
ERROR: Job failed: exit code 1
failed
unit:tsan:buster:amd64 Unit
$ find lib -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts...
WARNING: lib/*/tests/tsan.*: no matching files
WARNING: tsan/: no matching files
kyua.log: found 1 matching files

kyua.results: found 1 matching files

WARNING: kyua_html/: no matching files
Uploading artifacts to coordinator... ok
id=685028 responseStatus=201 Created token=o_bGxRj3
ERROR: Job failed: exit code 1
failed
msvc:windows:amd64 Build
         server.obj : error LNK2019: unresolved external symbol dns_zone_getlastrefreshtime referenced in function named_server_zonestatus [C:\builds\fanf\bind9\bin\named\win32\named.vcxproj]
statschannel.obj : error LNK2001: unresolved external symbol dns_zone_getlastrefreshtime [C:\builds\fanf\bind9\bin\named\win32\named.vcxproj]
..\..\..\Build\Release\named.exe : fatal error LNK1120: 1 unresolved externals [C:\builds\fanf\bind9\bin\named\win32\named.vcxproj]

740 Warning(s)
3 Error(s)

Time Elapsed 00:01:20.77
ERROR: Job failed: exit status 1
failed
💾:sid:amd64 Precheck
Checking out b8881469 as u/fanf2/last-refresh...

Skipping Git submodules setup
Authenticating with credentials from job payload (GitLab Registry)
$ if [ -r .clang-format ]; then "${CLANG_FORMAT}" -i -style=file $(git ls-files '*.c' '*.h'); fi
$ if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
M bin/named/server.c
M bin/named/statschannel.c
ERROR: Job failed: exit code 1
failed
misc:sid:amd64 Precheck
Skipping Git submodules setup
Authenticating with credentials from job payload (GitLab Registry)
$ sh util/check-ans-prereq.sh
$ sh util/checklibs.sh > checklibs.out
Uploading artifacts...
WARNING: util/newcopyrights: no matching files
checklibs.out: found 1 matching files

Uploading artifacts to coordinator... ok
id=684983 responseStatus=201 Created token=ieT9oGEC
ERROR: Job failed: exit code 1