Skip to content

Commit

Permalink
mongo_collection_ configurable graph_category
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmsgit authored and sumpfralle committed Mar 25, 2021
1 parent 7fd554f commit 105ff59
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions plugins/mongodb/mongo_collection_
Expand Up @@ -35,6 +35,7 @@

import pymongo
from operator import itemgetter
from os import getenv

settings_host = '127.0.0.1'
settings_port = 27017
Expand All @@ -44,6 +45,7 @@ settings_db = 'admin'
settings_user = ''
settings_password = ''
settings_ignoredb = {}
settings_graph_category = getenv('graph_category', 'db')

typeIndex = {}
typeIndex['collcount'] = {}
Expand All @@ -52,39 +54,39 @@ 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'
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'
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'
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'
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):
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 105ff59

Please sign in to comment.