• mongodb库表信息监控脚本


    var collnames=db.getCollectionNames();
    //print(collnames)
    var indexsize="";
    var collline="";
    var storagesize=""
    var size=""
    var count=""
    /*print("|--------------------------------------------totalIndexSize----------------------------------------|")
    for (coll in collnames)
    {
        if(collnames[coll].substr(0,7)=='system.')
            continue;
        collline+=collnames[coll]+"   ";
        stats=db[collnames[coll]].stats();
    //    print(collnames[coll]+": "+stats["totalIndexSize"]);
        indexsize=indexsize+"   "+stats["totalIndexSize"]
    }
    print("|"+collline+"|")
    print("|"+indexsize+"|")
    print("|--------------------------------------------totalIndexSize----------------------------------------|")
    */
    print("******************"+db.getName()+"*******************")
    for (coll in collnames)
    {
            if(collnames[coll].substr(0,7)=='system.')
                    continue;
        collline+=collnames[coll]+"   ";
            stats=db[collnames[coll]].stats();
        printjson(stats);
        indexsize=indexsize+"   "+stats["totalIndexSize"]
        storagesize=storagesize+"   "+stats["storageSize"]
        count=count+"   "+stats["count"]
        size=size+"   "+stats["size"]
    }
    print("******************"+db.getName()+"*******************")
    print("|"+db.getName())
    print("|-------------------------------------------[totalIndexSize]---------------------------------------|")
    print("|"+collline+"|")
    print("|"+indexsize+"|")
    print("|-------------------------------------------[totalIndexSize]---------------------------------------|")
    print("|-------------------------------------------[storageSize]------------------------------------------|")
    print("|"+collline+"|")
    print("|"+storagesize+"|")
    print("|-------------------------------------------[storageSize]------------------------------------------|")
    print("|-------------------------------------------[count]------------------------------------------------|")
    print("|"+collline+"|")
    print("|"+count+"|")
    print("|-------------------------------------------[count]------------------------------------------------|")
    print("|-------------------------------------------[size]-------------------------------------------------|")
    print("|"+collline+"|")
    print("|"+size+"|")
    print("|-------------------------------------------[size]-------------------------------------------------|")
  • 相关阅读:
    谈谈Oracle基本操作(下)
    谈谈Oracle基本操作(上)
    java理论之java多线程与网络编程
    java理论之java--GUI(图形用户管理)与 IO/流
    java理论之java数组和集合
    存图片的
    .html()渲染后的内容还是带标签的字符串的问题
    Vuejs报错error: Unexpected console statement (no-console) at src... 解决办法
    常用正则表达式
    移动WEB---01.关于屏幕像素
  • 原文地址:https://www.cnblogs.com/mytech/p/3499403.html
Copyright © 2020-2023  润新知