コード例 #1
0
        print 'Finished!'
        sys.exit(0)

    if args.show_database_storage_usage:
        f = open('db_results.txt', 'w')
        sys.stdout = f

        theStep = 1000 * 60 * 15
        print 'Running in show database storage mode, update every %dms' % theStep
        print
        f.flush()

        updateTimer = Timer(theStep,True)
        try:
            while True:
                updateTimer.waitForTick()

                collections = getCollections()
                print 'The time: %s'%  unicode(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
                print 'Available collections: %s' % unicode(collections)
                print
                print
                print 'Database statistics: %s' % unicode(getDatabase().command({'dbStats' : 1}))

                for collection in collections:
                    print '%*s collection statistics: %s' % (20, collection, unicode(getDatabase().command({'collStats' : collection})))

                print
                print

                for collection in collections: