1#!/usr/bin/perl 2 3# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4# 5# SPDX-License-Identifier: MPL-2.0 6# 7# This Source Code Form is subject to the terms of the Mozilla Public 8# License, v. 2.0. If a copy of the MPL was not distributed with this 9# file, you can obtain one at https://mozilla.org/MPL/2.0/. 10# 11# See the COPYRIGHT file distributed with this work for additional 12# information regarding copyright ownership. 13 14# zones-xml.pl: 15# Parses the XML version of the dnssec sign stats for the 16# "dnssec" zone in the default view into a normalized format. 17 18use XML::Simple; 19 20my $file = $ARGV[0]; 21my $zone = $ARGV[1]; 22 23my $ref = XMLin($file); 24 25my $counters = $ref->{views}->{view}->{_default}->{zones}->{zone}->{$zone}->{counters}; 26 27foreach $group (@$counters) { 28 29 my $type = $group->{type}; 30 31 if ($type eq "dnssec-sign" || $type eq "dnssec-refresh") { 32 if (exists $group->{counter}->{name}) { 33 print $type . " operations " . $group->{counter}->{name} . ": " . $group->{counter}->{content} . "\n"; 34 } else { 35 foreach $key (keys %{$group->{counter}}) { 36 print $type . " operations " . $key . ": ". $group->{counter}->{$key}->{content} ."\n"; 37 } 38 } 39 } 40} 41