diff options
-rw-r--r-- | sos/plugins/pulp.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sos/plugins/pulp.py b/sos/plugins/pulp.py index e947c174..4faa4f0d 100644 --- a/sos/plugins/pulp.py +++ b/sos/plugins/pulp.py @@ -53,9 +53,38 @@ class Pulp(Plugin, RedHatPlugin): r'.shellPrint()"' % num_tasks ) + # prints mongo collection sizes sorted from biggest and in human + # readable output + csizes = self.build_mongo_cmd( + '\"function humanReadable(bytes) {' + ' var i = -1;' + ' var byteUnits = [\'kB\', \'MB\', \'GB\', \'TB\', \'PB\', ' + ' \'EB\', \'ZB\', \'YB\'];' + ' do {' + ' bytes = bytes / 1024;' + ' i++;' + ' } while (bytes > 1024);' + ' return Math.max(bytes, 0.1).toFixed(1) + \' \' + byteUnits[i];' + '};' + 'var collectionNames = db.getCollectionNames(), stats = [];' + 'collectionNames.forEach(function (n) {' + ' stats.push(db[n].stats());' + ' });' + 'stats = stats.sort(function(a, b) {' + ' return b[\'size\'] - a[\'size\']; });' + 'for (var c in stats) {' + ' print(stats[c][\'ns\'] + \': \' +' + ' humanReadable(stats[c][\'size\']) + \' (\' +' + ' humanReadable(stats[c][\'storageSize\']) + \')\'); }\"' + ) + + dbstats = self.build_mongo_cmd('\"db.stats()\"') + self.add_cmd_output(mtasks, suggest_filename="mongo-task_status") self.add_cmd_output(mres, suggest_filename="mongo-reserved_resources") self.add_cmd_output(prun, suggest_filename="pulp-running_tasks") + self.add_cmd_output(csizes, suggest_filename="mongo-collection_sizes") + self.add_cmd_output(dbstats, suggest_filename="mongo-db_stats") def build_mongo_cmd(self, query): _cmd = "bash -c %s" |