I have a monitoring script that looks something like this
client = pymongo.MongoClient()
for database in client.database_names():
iterator = client[database].command({"serverStatus":1})["opcounters"].iteritems()
for key, value in iterator:
log(key, data=value, database=database)
This has been giving me the same result for all of my opcounters. Looking at my graphs, I get data like this:
opcounters.command_per_second on test_database: 53.32K
opcounters.command_per_second on log_database: 53.32K
Obviously, "serverStatus" is indicative of the entire server, not just the database.
Is it possible to get opcounters for each database?