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# server-json.pl: 15# Parses the JSON version of the server stats into a normalized format. 16 17use JSON; 18 19open(INPUT, "<json.stats"); 20my $text = do{local$/;<INPUT>}; 21close(INPUT); 22 23my $ref = decode_json($text); 24foreach $key (keys %{$ref->{opcodes}}) { 25 print "opcode " . $key . ": " . $ref->{opcodes}->{$key} . "\n"; 26} 27foreach $key (keys %{$ref->{rcodes}}) { 28 print "rcode " . $key . ": " . $ref->{rcodes}->{$key} . "\n"; 29} 30foreach $key (keys %{$ref->{qtypes}}) { 31 print "qtype " . $key . ": " . $ref->{qtypes}->{$key} . "\n"; 32} 33foreach $key (keys %{$ref->{nsstats}}) { 34 print "nsstat " . $key . ": " . $ref->{nsstats}->{$key} . "\n"; 35} 36