Another alternative is to use bind'
s own XML format statistics, if you have enabled the statistics-channel
and have zone-statistics enabled (e.g. in the global options { }
). This method also lets you easily select/show views, zone types and zone data (e.g. serial number), as well as statistics per-zone of course.
Using wget
and xml
(xmlstarlet):
wget -O - http://127.0.0.1:1080/xml/v3/zones |
xml select -I -t -m '/statistics/views/view[@name="_default"]/zones/zone[type="master"]' \
-v @name -nl
The above shows a list of all master domains in the _default view.
wget ... |
xml select -I -t -m '/statistics/views/view/zones/zone' \
-v @name -o , -v ../../@name -o , -v type -o , -v serial -nl
The above shows all zones in CSV form: zone, view, type, serial.
To select only a specific view and zone type:
wget ... |
xml select -I -t -m '/statistics/views/view[@name="_bind"]/zones/zone[type="builtin"]' \
-v @name -nl
(This statistics facility is available since bind-9.6.0, December 2008. The /v3/
format used above is only available since bind-9.10, April 2014. JSON format may also be available, so something analogous should be possible with jot
.)