From b88406594c9667a96a2aaf602385399a48d085e1 Mon Sep 17 00:00:00 2001 From: chenjunhong Date: Fri, 2 Mar 2018 16:31:43 +0800 Subject: [PATCH] =?UTF-8?q?Mongo=20v3.4=20=EF=BC=8C=20maybe=20some=20api?= =?UTF-8?q?=20has=20changed=20,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collectors/0/mongo3.py | 18 ++++++++++-------- collectors/etc/mongodb3_conf.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/collectors/0/mongo3.py b/collectors/0/mongo3.py index 41f490d4..7694d575 100755 --- a/collectors/0/mongo3.py +++ b/collectors/0/mongo3.py @@ -217,18 +217,20 @@ def runDbStats(c): continue print 'mongo.db.%s %d %s db=%s' % (metric, ts, cur, db_name) - raw_metrics = res['raw'] - for key, value in raw_metrics.items(): + + # raw_metrics = res['raw'] + # for key, value in raw_metrics.items(): + for key, value in res.items(): replica_name = key.split('/', 1)[0] - replica_desc = key.split('/', 1)[1] + # replica_desc = key.split('/', 1)[1] for metric in MONGOS_RAW_METRICS: cur = value - try: - for m in metric.split('.'): - cur = cur[m] - except KeyError: - continue + # try: + # for m in metric.split('.'): + # cur = cur[m] + # except KeyError: + # continue print 'mongo.rs.%s %d %s replica=%s db=%s' % (metric, ts, cur, replica_name, db_name) def runReplSetGetStatus(c): diff --git a/collectors/etc/mongodb3_conf.py b/collectors/etc/mongodb3_conf.py index 66ffecd9..8cdb769d 100644 --- a/collectors/etc/mongodb3_conf.py +++ b/collectors/etc/mongodb3_conf.py @@ -15,7 +15,7 @@ def get_settings(): return { - "db": "db1,db2", + "db": "argus-alert,argus-statistics,argus-users,argus-web", "config": "192.168.0.10:27017,192.168.0.11:27017", "mongos": "192.168.0.13:27017", "replica": "192.168.0.14:27017",