From 105ff59c11eb8ccf719b58e44c544e58848906de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jerem=C3=ADas?= Date: Tue, 16 Mar 2021 14:31:11 -0300 Subject: [PATCH] mongo_collection_ configurable graph_category --- plugins/mongodb/mongo_collection_ | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/mongodb/mongo_collection_ b/plugins/mongodb/mongo_collection_ index df901c82..0bf2f5ac 100755 --- a/plugins/mongodb/mongo_collection_ +++ b/plugins/mongodb/mongo_collection_ @@ -35,6 +35,7 @@ import pymongo from operator import itemgetter +from os import getenv settings_host = '127.0.0.1' settings_port = 27017 @@ -44,6 +45,7 @@ settings_db = 'admin' settings_user = '' settings_password = '' settings_ignoredb = {} +settings_graph_category = getenv('graph_category', 'db') typeIndex = {} typeIndex['collcount'] = {} @@ -52,7 +54,7 @@ typeIndex['collcount']['title'] = 'per collection document count' typeIndex['collcount']['yaxis'] = 'documents' typeIndex['collcount']['base'] = '1000' typeIndex['collcount']['scale'] = '--logarithmic -l1' -typeIndex['collcount']['category'] = 'db' +typeIndex['collcount']['category'] = settings_graph_category typeIndex['collsize'] = {} typeIndex['collsize']['index'] = 'size' @@ -60,7 +62,7 @@ typeIndex['collsize']['title'] = 'per collection data size' typeIndex['collsize']['yaxis'] = 'Byte' typeIndex['collsize']['base'] = '1024' typeIndex['collsize']['scale'] = '--logarithmic -l1 --units=si' -typeIndex['collsize']['category'] = 'db' +typeIndex['collsize']['category'] = settings_graph_category typeIndex['avgsize'] = {} typeIndex['avgsize']['index'] = 'avgObjSize' @@ -68,7 +70,7 @@ typeIndex['avgsize']['title'] = 'average object size' typeIndex['avgsize']['yaxis'] = 'Byte' typeIndex['avgsize']['base'] = '1024' typeIndex['avgsize']['scale'] = '--logarithmic --units=si' -typeIndex['avgsize']['category'] = 'db' +typeIndex['avgsize']['category'] = settings_graph_category typeIndex['storage'] = {} typeIndex['storage']['index'] = 'storageSize' @@ -76,7 +78,7 @@ typeIndex['storage']['title'] = 'per collection storage size' typeIndex['storage']['yaxis'] = 'Byte' typeIndex['storage']['base'] = '1024' typeIndex['storage']['scale'] = '--logarithmic -l1 --units=si' -typeIndex['storage']['category'] = 'db' +typeIndex['storage']['category'] = settings_graph_category typeIndex['indexsize'] = {} typeIndex['indexsize']['index'] = 'totalIndexSize' @@ -84,7 +86,7 @@ typeIndex['indexsize']['title'] = 'per collection index size' typeIndex['indexsize']['yaxis'] = 'Byte' typeIndex['indexsize']['base'] = '1024' typeIndex['indexsize']['scale'] = '--logarithmic -l 1 --units=si' -typeIndex['indexsize']['category'] = 'db' +typeIndex['indexsize']['category'] = settings_graph_category def getCollstats(graphtype): @@ -139,7 +141,7 @@ def doConfig(base, graphtype): print("graph_title MongoDB " + typeIndex[graphtype]['title'] + " for database " + d) print("graph_args --base " + typeIndex[graphtype]['base'] + " " + typeIndex[graphtype]['scale']) print("graph_vlabel " + typeIndex[graphtype]['yaxis']) - print("graph_category db") + print("graph_category %s" % settings_graph_category) print("%s_%s.label %s" % (graphtype, k, k)) print("%s_%s.min 0" % (graphtype, k)) print("%s_%s.draw LINE1" % (graphtype, k))