Add "per second" (if it's per second... use munin graph_period)

This commit is contained in:
Antoine Van Elstraete 2021-12-28 00:14:51 +01:00
parent 3a1845d8cd
commit 3e3608960f
Signed by: AntoineVe
GPG Key ID: E36069A977E2A9ED

9
knot_
View File

@ -24,7 +24,7 @@ def responses(stats, config):
if config: if config:
print("graph_title Knot responses") print("graph_title Knot responses")
print("graph_category dns") print("graph_category dns")
print("graph_vlabel responses") print("graph_vlabel responses / ${graph_period}")
print("graph_args --base 1000 --lower-limit 0") print("graph_args --base 1000 --lower-limit 0")
for code in responses_stats: for code in responses_stats:
print(f"{code}.label {code}") print(f"{code}.label {code}")
@ -52,7 +52,7 @@ def proto(stats, config):
if config: # Configure the plugin if config: # Configure the plugin
print("graph_title Knot protocols") print("graph_title Knot protocols")
print("graph_category dns") print("graph_category dns")
print("graph_vlabel numbers of requests") print("graph_vlabel numbers of requests / ${graph_period}")
print("graph_args --base 1000 --lower-limit 0") print("graph_args --base 1000 --lower-limit 0")
for proto in proto_stats: for proto in proto_stats:
print(f"{proto}.label {proto}") print(f"{proto}.label {proto}")
@ -66,6 +66,7 @@ def proto(stats, config):
if __name__ == '__main__': if __name__ == '__main__':
# Retrieve datas : # Retrieve datas :
file = getenv('stats_file_path') file = getenv('stats_file_path')
munin_time = getenv('munin_time', 300)
with open(file, "r") as stats_file: with open(file, "r") as stats_file:
stats = yaml.safe_load(stats_file) stats = yaml.safe_load(stats_file)
if not "mod-stats" in stats: if not "mod-stats" in stats:
@ -75,8 +76,8 @@ if __name__ == '__main__':
else: else:
config = False config = False
if "responses" in argv[0]: if "responses" in argv[0]:
responses(stats, config) responses(stats, config, munin_time)
elif "proto" in argv[0]: elif "proto" in argv[0]:
proto(stats, config) proto(stats, config, munin_time)
else: else:
pass # Nothing happens if no "munin underscore args" pass # Nothing happens if no "munin underscore args"