-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun_reader.py
executable file
·34 lines (27 loc) · 1.1 KB
/
run_reader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
from __future__ import print_function
from pybindxml import reader
import argparse
def main():
parser = argparse.ArgumentParser(description='Parse BIND XML stats on demand.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--host',
help='hostname to query for DNS statistics')
parser.add_argument('--port',
type=int,
default=8053,
help='BIND statistics port to query')
parser.add_argument('--xml',
help='path to file which contains BIND XML.')
args = parser.parse_args()
if args.xml:
mybind = reader.BindXmlReader(xml_path=args.xml)
else:
mybind = reader.BindXmlReader(host=args.host, port=args.port)
mybind.get_stats()
print("memory stats: %s" % mybind.stats.memory_stats)
print("query stats: %s" % mybind.stats.query_stats)
print("zone list: %s" % mybind.stats.zone_stats)
print("done")
if __name__ == '__main__':
main()