2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Adding custom label and vlabel environment variables support

This commit is contained in:
iborodikhin 2012-09-24 15:40:28 +06:00
parent 42a11debca
commit 86847af6d8

View File

@ -39,6 +39,8 @@
# env.database mysql
# env.table user
# env.field Host
# env.label Mysql users
# env.vlabel users
#
#%# capabilities=autoconf
#%# family=contrib
@ -127,17 +129,28 @@ if field != "":
if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
print "yes"
elif len(sys.argv) == 2 and sys.argv[1] == "config":
if "label" in os.environ:
label = os.environ["label"]
else:
label = "Aggregate - %s" % table
if "vlabel" in os.environ:
vlabel = os.environ["vlabel"]
else:
vlabel = "count(*)"
if field == "":
print "graph mysql_aggregate_%s" % table
print "graph_title Aggregate - %s" % table
print "graph_vlabel count(*)"
print "graph_title %s" % label
print "graph_vlabel %s" % vlabel
print "graph_category mysql"
print ""
print "values_count.label count"
else:
print "multigraph mysql_aggregate_%s" % table
print "graph_title Aggregate - %s" % table
print "graph_vlabel count(*)"
print "graph_title %s" % label
print "graph_vlabel %s" % vlabel
print "graph_category mysql"
print ""
@ -147,8 +160,8 @@ elif len(sys.argv) == 2 and sys.argv[1] == "config":
for key in values.keys():
print ""
print "multigraph mysql_aggregate_%s.%s" % (table, key.replace(".", "_"))
print "graph_title Agregate - %s, value %s" % (table, key.replace(".", "_"))
print "graph_vlabel count(*)"
print "graph_title %s, value %s" % (label, key.replace(".", "_"))
print "graph_vlabel %s" % vlabel
print "graph_category mysql"
print ""
print "%s_count.label %s" % (key.replace(".", "_"), key)