Protocols stats
This commit is contained in:
parent
d7f2926222
commit
3a1845d8cd
30
knot_
30
knot_
@ -34,6 +34,34 @@ def responses(stats, config):
|
|||||||
for code in responses_stats:
|
for code in responses_stats:
|
||||||
print(f"{code}.value {responses_stats[code]}")
|
print(f"{code}.value {responses_stats[code]}")
|
||||||
|
|
||||||
|
def proto(stats, config):
|
||||||
|
'''
|
||||||
|
This will show if ipv4 or ipv6 and if tcp or udp are used.
|
||||||
|
'''
|
||||||
|
proto_stats = {}
|
||||||
|
if 'request-protocol' not in stats['mod-stats']:
|
||||||
|
proto_stats.update({'udp4': 0})
|
||||||
|
else:
|
||||||
|
for proto in stats['mod-stats']['request-protocol']:
|
||||||
|
proto_stats.update(
|
||||||
|
{
|
||||||
|
proto:
|
||||||
|
stats['mod-stats']['request-protocol'][proto]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if config: # Configure the plugin
|
||||||
|
print("graph_title Knot protocols")
|
||||||
|
print("graph_category dns")
|
||||||
|
print("graph_vlabel numbers of requests")
|
||||||
|
print("graph_args --base 1000 --lower-limit 0")
|
||||||
|
for proto in proto_stats:
|
||||||
|
print(f"{proto}.label {proto}")
|
||||||
|
print(f"{proto}.type DERIVE")
|
||||||
|
print(f"{proto}.min 0")
|
||||||
|
else: # Send the values
|
||||||
|
for proto in proto_stats:
|
||||||
|
print(f"{proto}.value {proto_stats[proto]}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Retrieve datas :
|
# Retrieve datas :
|
||||||
@ -49,6 +77,6 @@ if __name__ == '__main__':
|
|||||||
if "responses" in argv[0]:
|
if "responses" in argv[0]:
|
||||||
responses(stats, config)
|
responses(stats, config)
|
||||||
elif "proto" in argv[0]:
|
elif "proto" in argv[0]:
|
||||||
pass
|
proto(stats, config)
|
||||||
else:
|
else:
|
||||||
pass # Nothing happens if no "munin underscore args"
|
pass # Nothing happens if no "munin underscore args"
|
||||||
|
1
knot_proto
Symbolic link
1
knot_proto
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
knot_
|
Loading…
Reference in New Issue
Block a user