xref: /netbsd-src/external/mpl/bind/dist/bin/tests/system/statschannel/zones-json.pl (revision 5dd36a3bc8bf2a9dec29ceb6349550414570c447)
1#!/usr/bin/perl
2#
3# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4#
5# This Source Code Form is subject to the terms of the Mozilla Public
6# License, v. 2.0. If a copy of the MPL was not distributed with this
7# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8#
9# See the COPYRIGHT file distributed with this work for additional
10# information regarding copyright ownership.
11
12# zones-json.pl:
13# Parses the JSON version of the dnssec sign stats for the
14# "dnssec" zone in the default view into a normalized format.
15
16use JSON;
17
18my $file = $ARGV[0];
19open(INPUT, "<$file");
20my $text = do{local$/;<INPUT>};
21close(INPUT);
22
23my $ref = decode_json($text);
24
25
26my $dnssecsign = $ref->{views}->{_default}->{zones}[0]->{"dnssec-sign"};
27my $type = "dnssec-sign operations ";
28foreach $key (keys %{$dnssecsign}) {
29    print $type . $key . ": ". $dnssecsign->{$key} ."\n";
30}
31my $dnssecrefresh = $ref->{views}->{_default}->{zones}[0]->{"dnssec-refresh"};
32my $type = "dnssec-refresh operations ";
33foreach $key (keys %{$dnssecrefresh}) {
34    print $type . $key . ": ". $dnssecrefresh->{$key} ."\n";
35}
36