1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

add a servername to the graph to support multiple graphs per munin-node

This commit is contained in:
@RubenKelevra 2016-06-22 01:23:34 +02:00 committed by GitHub
parent 3fab7aca7a
commit 05d8c7c808

View file

@ -7,7 +7,7 @@
AGPL 3.0 RubenKelevra AGPL 3.0 RubenKelevra
Author: @RubenKelevra - <ruben@vfn-nrw.de> Author: @RubenKelevra - <ruben@vfn-nrw.de>

This plugin is written with the known limitation to a single instance per This plugin is written with the known limitation to a single instance per
host. Patches which remove this limitation are very welcome. host. Patches which remove this limitation are very welcome.
@ -35,6 +35,7 @@ from sys import argv
from sys import exit as fatal_ from sys import exit as fatal_
from sys import stderr from sys import stderr
# functions # functions
def fatal(status): def fatal(status):
fatal_("ERROR: " + status) fatal_("ERROR: " + status)
@ -64,8 +65,8 @@ def getFirstLine(respond):
return e return e
def print_config(): def print_config(servername):
print("graph_title RethinkDB - Local Database IOPS and Queries") print("graph_title RethinkDB on '%s'- Local Database IOPS and Queries" % servername)
print("graph_args --base 1000 -l 0") print("graph_args --base 1000 -l 0")
print("graph_vlabel Operations / second") print("graph_vlabel Operations / second")
print("graph_category rethinkdb") print("graph_category rethinkdb")
@ -86,11 +87,16 @@ def check_autoconf() -> bool:
if __name__ == '__main__': if __name__ == '__main__':
try:
RETHINKDB_SERVERNAME = env['rethinkdb_servername']
except:
RETHINKDB_SERVERNAME = gethostname()
if len(argv) > 2: if len(argv) > 2:
fatal("unsupported argument count") fatal("unsupported argument count")
elif len(argv) == 2: elif len(argv) == 2:
if str(argv[1]) == "config": if str(argv[1]) == "config":
print_config() print_config(RETHINKDB_SERVERNAME)
elif str(argv[1]) == "autoconf": elif str(argv[1]) == "autoconf":
if check_autoconf(): if check_autoconf():
print("yes") print("yes")
@ -118,11 +124,6 @@ if __name__ == '__main__':
except: except:
RETHINKDB_HOST = "localhost" RETHINKDB_HOST = "localhost"
try:
RETHINKDB_SERVERNAME = env['rethinkdb_servername']
except:
RETHINKDB_SERVERNAME = gethostname()
try: try:
conn = connect(RETHINKDB_HOST, RETHINKDB_PORT) conn = connect(RETHINKDB_HOST, RETHINKDB_PORT)
except: except: