Last active
August 29, 2015 14:10
-
-
Save davemackintosh/77c017e3882485918c37 to your computer and use it in GitHub Desktop.
Mongo database currentOp() helper. Makes it a bit nicer
This file contains 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
db.currentOp().inprog.forEach(function(op) { | |
if (op.progress) { | |
var remaining = op.progress.total - op.progress.done; | |
var running_for = op.secs_running / 60 / 60; | |
print(op.ns, op.opid, 'running for', running_for.toPrecision(4), 'hours') | |
print('job "'+ op.insert.name +'" running in background?', op.insert.background ? 'yes' : 'no'); | |
print(op.msg) | |
print('Remaining records', remaining, 'finished', op.progress.done, 'docs') | |
print('Estimated', ((running_for / op.progress.done) * remaining).toPrecision(4), 'hours remaining') | |
print('\n') | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment