This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dbs_list = db.getMongo().getDBNames(); | |
for(var d in dbs_list){ | |
var name = dbs_list[d]; | |
if(name == 'admin') | |
continue; | |
if(name == 'local') | |
continue; | |
dbOne = db.getSisterDB(name); | |
dbOne.setProfilingLevel(0); | |
dbOne.system.profile.drop(); | |
dbOne.createCollection("system.profile", {capped:true, size:8000000}); | |
dbOne.setProfilingLevel(2); | |
print(name + " --> complete"); | |
}; |
per interrogare tutti i profile con l'elenco delle ultime 5 query che superano i 5 millis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dbs_list = db.getMongo().getDBNames(); | |
for(var d in dbs_list){ | |
var name = dbs_list[d]; | |
if(name == 'admin' || name == 'local') | |
continue; | |
dbOne = db.getSisterDB(name); | |
print("dbname -->" + name); | |
var cursor = dbOne.system.profile.find( { op:"query", millis : { $gte : 5 },ns : { $ne : (name + '.system.profile') } },{ ts:1,millis:1, nscanned:1, nreturned:1, ns:1, query:1} ).sort({ts:-1}).limit(5); | |
cursor.forEach(function(r) { | |
print(JSON.stringify(r)); | |
}); | |
print(); | |
print(); | |
} |
Nessun commento:
Posta un commento