munin plugin for djbdns' DNS cache
If you run a DNS cache with djbdns, you might want to see pretty graphs of the number of requests your cache received (queries/second).
Here's a very simple munin plugin that does just that:
#!/usr/local/bin/python import sys logfile = '/etc/dnscache/log/main/current' if len(sys.argv) == 2 and sys.argv[1] == "autoconf": print "yes" elif len(sys.argv) == 2 and sys.argv[1] == "config": print 'graph_title djbdns dnscache queries' print 'graph_vlabel Queries/s' print 'graph_category DNS' print 'queries.label Queries/s' print 'queries.type COUNTER' print 'graph_args --base 1000 -l 0' else: f = open(logfile) for line in f: txt = line.split(' ') try: if txt[1] == 'query': query_count = txt[2] except IndexError: continue f.close() print 'queries.value %s' % query_count
Adjust the "logfile" on line 4 to fit your installation.
Python 3.x users will probably need to make slight adjustments to the code.
Install it like any other munin plugin, then restart munin_node. It doesn't require any additional configuration.
EDIT: Here's how it looks: