Bandwith
This commit is contained in:
parent
cac3225224
commit
ae7ad63d52
38
knot_
38
knot_
@ -64,6 +64,42 @@ def proto(stats, config):
|
|||||||
print(f"{proto}.value {proto_stats[proto]}")
|
print(f"{proto}.value {proto_stats[proto]}")
|
||||||
|
|
||||||
|
|
||||||
|
def bandwith(stats, config):
|
||||||
|
'''
|
||||||
|
This will show query and responses used bandwith.
|
||||||
|
'''
|
||||||
|
bandwith_stats = {}
|
||||||
|
if 'request-bytes' not in stats['mod-stats']:
|
||||||
|
bandwith_stats.update({'received': 0})
|
||||||
|
else:
|
||||||
|
bandwith_stats.update({'received':
|
||||||
|
stats['mod-stats']['request-bytes']['query']})
|
||||||
|
if 'response-bytes' not in stats['mod-stats']:
|
||||||
|
bandwith_stats.update({'sent': 0})
|
||||||
|
else:
|
||||||
|
bandwith_stats.update({'sent':
|
||||||
|
stats['mod-stats']['response-bytes']['reply']})
|
||||||
|
if config: # Configure the plugin
|
||||||
|
print("graph_title Knot bandwith")
|
||||||
|
print("graph_category dns")
|
||||||
|
print("graph_vlabel bits in (-) / out (+) per ${graph_period}")
|
||||||
|
print("graph_args --base 1000")
|
||||||
|
print("graph_order down up")
|
||||||
|
print("down.label received")
|
||||||
|
print("down.type DERIVE")
|
||||||
|
print("down.min 0")
|
||||||
|
print("down.graph no")
|
||||||
|
print("down.cdef down,8,*")
|
||||||
|
print("up.label bps")
|
||||||
|
print("up.type DERIVE")
|
||||||
|
print("up.min 0")
|
||||||
|
print("up.negative down")
|
||||||
|
print("up.cdef up,8,*")
|
||||||
|
else: # Send the values
|
||||||
|
print(f"down.value {bandwith_stats['received']}")
|
||||||
|
print(f"up.value {bandwith_stats['sent']}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Retrieve datas :
|
# Retrieve datas :
|
||||||
file = getenv('stats_file_path')
|
file = getenv('stats_file_path')
|
||||||
@ -79,5 +115,7 @@ if __name__ == '__main__':
|
|||||||
responses(stats, config)
|
responses(stats, config)
|
||||||
elif "proto" in argv[0]:
|
elif "proto" in argv[0]:
|
||||||
proto(stats, config)
|
proto(stats, config)
|
||||||
|
elif "bandwith" in argv[0]:
|
||||||
|
bandwith(stats, config)
|
||||||
else:
|
else:
|
||||||
pass # Nothing happens if no "munin underscore args"
|
pass # Nothing happens if no "munin underscore args"
|
||||||
|
1
knot_bandwith
Symbolic link
1
knot_bandwith
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
knot_
|
Loading…
Reference in New Issue
Block a user