diff --git a/contrib/munin/lokinet-munin.py b/contrib/munin/lokinet-munin.py index bdcae3c9a..63c0bfc95 100644 --- a/contrib/munin/lokinet-munin.py +++ b/contrib/munin/lokinet-munin.py @@ -17,14 +17,14 @@ def jsonrpc(method, **args): {'method': method, 'params': args, 'id': 'munin'}), headers={'content-type': 'application/json'}).json() -def exit_sessions_main(exe): +def exit_sessions_main(): if len(sys.argv) == 2 and sys.argv[1] == 'config': print("graph_title lokinet exit sessions") print("graph_vlabel sessions") print("graph_category network") print("graph_info This graph shows the number of exit sessions on a lokinet exit") - print("{}.sessions.info Number of exit sessions".format(exe)) - print("{}.sessions.label sessions".format(exe)) + print("_exit_sessions.info Number of exit sessions") + print("_exit_sessions.label sessions") else: count = 0 try: @@ -32,19 +32,19 @@ def exit_sessions_main(exe): count = len(j['result']) except RequestException: pass - print("{}.sessions.value {}".format(exe, count)) + print("_exit_sessions.value {}".format(count)) -def peers_main(exe): +def peers_main(): if len(sys.argv) == 2 and sys.argv[1] == 'config': print("graph_title lokinet peers") print("graph_vlabel peers") print("graph_category network") print("graph_info This graph shows the number of node to node sessions of this lokinet router") - print("{}.outbound.info Number of outbound lokinet peers".format(exe)) - print("{}.inbound.info Number of inbound lokinet peers".format(exe)) - print("{}.outbound.label outbound peers".format(exe)) - print("{}.inbound.label inbound peers".format(exe)) + print("_peers_outbound.info Number of outbound lokinet peers") + print("_peers_inbound.info Number of inbound lokinet peers") + print("_peers_outbound.label outbound peers") + print("_peers_inbound.label inbound peers") else: inbound = Dict(int) outbound = Dict(int) @@ -58,16 +58,16 @@ def peers_main(exe): except RequestException: pass - print("{}.outbound.value {}".format(exe, len(outbound))) - print("{}.inbound.value {}".format(exe, len(inbound))) + print("_peers_outbound.value {}".format(len(outbound))) + print("_peers_inbound.value {}".format(len(inbound))) if __name__ == '__main__': exe = os.path.basename(sys.argv[0]).lower() if exe == 'lokinet_peers': - peers_main(exe) + peers_main() elif exe == 'lokinet_exit': - exit_sessions_main(exe) + exit_sessions_main() else: print( 'please symlink this as `lokinet_peers` or `lokinet_exit` in munin plugins dir')