Compare commits
No commits in common. "8990114eb33e021947ed997f11960dfabfd11474" and "36312cb6d20d9412fa3c1f8e1bb8722e88656443" have entirely different histories.
8990114eb3
...
36312cb6d2
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Antoine Van Elstraete
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
52
README.md
52
README.md
@ -1,53 +1,3 @@
|
||||
# knot_
|
||||
|
||||
Knot munin stats
|
||||
|
||||
## Install
|
||||
|
||||
### Knot config
|
||||
|
||||
Add a "mod-stats" section, e.g. :
|
||||
|
||||
mod-stats:
|
||||
- id: custom-stats
|
||||
request-protocol: on
|
||||
server-operation: on
|
||||
request-bytes: on
|
||||
response-bytes: on
|
||||
edns-presence: on
|
||||
flag-presence: on
|
||||
response-code: on
|
||||
request-edns-option: on
|
||||
response-edns-option: on
|
||||
reply-nodata: on
|
||||
query-type: on
|
||||
query-size: on
|
||||
reply-size: on
|
||||
|
||||
|
||||
Add a "statistics" section, e.g. :
|
||||
|
||||
statistics:
|
||||
timer: 60
|
||||
file: /tmp/knot-stats.yaml
|
||||
append: false
|
||||
|
||||
In your zone template, add a "mod-stats", e.g. :
|
||||
|
||||
template:
|
||||
- id: signed
|
||||
storage: "/var/db/knot"
|
||||
semantic-checks: on
|
||||
dnssec-signing: on
|
||||
dnssec-policy: shared
|
||||
module: mod-stats/custom-stats
|
||||
|
||||
### Munin config
|
||||
|
||||
Create "knot" in the plugin-conf.d directory and put :
|
||||
|
||||
[knot_*]
|
||||
user root
|
||||
env.stats_file_path /tmp/knot-stats.yaml
|
||||
|
||||
Please adapt the path of the stats file, according to knot config, statistics section.
|
||||
Knot munin stats
|
52
knot_
52
knot_
@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import yaml
|
||||
from sys import argv
|
||||
from os import getenv
|
||||
|
||||
|
||||
def responses(stats, config):
|
||||
'''
|
||||
This will show what knot have responded.
|
||||
'''
|
||||
responses_stats = {}
|
||||
if 'response-code' not in stats['mod-stats']:
|
||||
responses_stats.update({'NOERROR': 0})
|
||||
else:
|
||||
for code in stats['mod-stats']['response-code']:
|
||||
responses_stats.update(
|
||||
{
|
||||
code:
|
||||
stats['mod-stats']['response-code'][code]
|
||||
}
|
||||
)
|
||||
# Configure the plugin :
|
||||
if config:
|
||||
print("graph_title Knot responses")
|
||||
print("graph_category dns")
|
||||
print("graph_vlabel responses")
|
||||
print("graph_args --base 1000 --lower-limit 0")
|
||||
for code in responses_stats:
|
||||
print(f"{code}.label {code}")
|
||||
print(f"{code}.type DERIVE")
|
||||
print(f"{code}.min 0")
|
||||
else: # Send the values
|
||||
for code in responses_stats:
|
||||
print(f"{code}.value {responses_stats[code]}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Retrieve datas :
|
||||
file = getenv('stats_file_path')
|
||||
with open(file, "r") as stats_file:
|
||||
stats = yaml.safe_load(stats_file)
|
||||
if len(argv) > 1 and argv[1] == "config":
|
||||
config = True
|
||||
else:
|
||||
config = False
|
||||
if "responses" in argv[0]:
|
||||
responses(stats, config)
|
||||
elif "proto" in argv[0]:
|
||||
pass
|
||||
else:
|
||||
pass # Nothing happens if no "munin underscore args"
|
@ -1 +0,0 @@
|
||||
knot_
|
Loading…
x
Reference in New Issue
Block a user