コード例 #1
0
ファイル: GetPage.cs プロジェクト: yhtsnda/MagicMongoDBTool
        /// <summary>
        ///
        /// </summary>
        /// <param name="DBTag"></param>
        /// <returns></returns>
        public static string GetConnection(String DBTag)
        {
            SystemManager.SelectObjectTag = DBTag;
            BsonDocument cr = new BsonDocument();

            cr = MongoDBHelper.ExecuteMongoSvrCommand(MongoDBHelper.serverStatus_Command, SystemManager.GetCurrentServer()).Response;
            return(MongoDBHelper.ConvertBsonTozTreeJson("Connection Status", cr, true));
        }
コード例 #2
0
        void M_Tick(object sender, EventArgs e)
        {
            var DocStatus = MongoDBHelper.ExecuteMongoSvrCommand(MongoDBHelper.serverStatus_Command, SystemManager.GetCurrentServer()).Response;

            DataPoint queryPoint = new DataPoint();

            queryPoint.SetValueXY(DateTime.Now.ToString(), DocStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("query").Value);
            MonitorGrap.Series[0].Points.Add(queryPoint);

            DataPoint insertPoint = new DataPoint();

            insertPoint.SetValueXY(DateTime.Now.ToString(), DocStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("insert").Value);
            MonitorGrap.Series[1].Points.Add(insertPoint);
        }
コード例 #3
0
        private void frmStatus_Load(object sender, EventArgs e)
        {
            this.Icon = GetSystemIcon.ConvertImgToIcon(MagicMongoDBTool.Properties.Resources.KeyInfo);
            String strType = SystemManager.SelectTagType;
            List <BsonDocument> SrvDocList = new List <BsonDocument>();
            BsonDocument        cr         = new BsonDocument();

            switch (strType)
            {
            case MongoDBHelper.SERVER_TAG:
            case MongoDBHelper.SINGLE_DB_SERVER_TAG:
                if (SystemManager.GetCurrentServerConfig().LoginAsAdmin)
                {
                    cr = MongoDBHelper.ExecuteMongoSvrCommand(MongoDBHelper.serverStatus_Command, SystemManager.GetCurrentServer()).Response;
                }
                break;

            case MongoDBHelper.DATABASE_TAG:
            case MongoDBHelper.SINGLE_DATABASE_TAG:
                cr = SystemManager.GetCurrentDataBase().GetStats().Response.ToBsonDocument();
                break;

            case MongoDBHelper.COLLECTION_TAG:
                cr = SystemManager.GetCurrentCollection().GetStats().Response.ToBsonDocument();
                break;

            default:
                if (SystemManager.GetCurrentServerConfig().LoginAsAdmin)
                {
                    cr = MongoDBHelper.ExecuteMongoSvrCommand(MongoDBHelper.serverStatus_Command, SystemManager.GetCurrentServer()).Response;
                }
                break;
            }
            if (!SystemManager.IsUseDefaultLanguage)
            {
                this.Text = SystemManager.mStringResource.GetText(StringResource.TextType.Main_Menu_Mangt_Status);
            }
            SrvDocList.Add(cr);
            MongoDBHelper.FillDataToTreeView(strType, this.trvStatus, SrvDocList, 0);
            this.trvStatus.DatatreeView.Nodes[0].Expand();
        }
コード例 #4
0
ファイル: frmStatus.cs プロジェクト: qiezi89/MagicMongoDBTool
        private void frmStatus_Load(object sender, EventArgs e)
        {
            this.Icon = GetSystemIcon.ConvertImgToIcon(MagicMongoDBTool.Properties.Resources.KeyInfo);
            String       strType   = SystemManager.SelectTagType;
            BsonDocument DocStatus = new BsonDocument();

            cmbChartField.Visible = false;
            chartResult.Visible   = false;
            switch (strType)
            {
            case MongoDBHelper.SERVER_TAG:
            case MongoDBHelper.SINGLE_DB_SERVER_TAG:
                if (SystemManager.GetCurrentServerConfig().LoginAsAdmin)
                {
                    DocStatus             = MongoDBHelper.ExecuteMongoSvrCommand(MongoDBHelper.serverStatus_Command, SystemManager.GetCurrentServer()).Response;
                    this.trvStatus.Height = this.trvStatus.Height * 2;
                }
                break;

            case MongoDBHelper.DATABASE_TAG:
            case MongoDBHelper.SINGLE_DATABASE_TAG:
                DocStatus             = SystemManager.GetCurrentDataBase().GetStats().Response.ToBsonDocument();
                cmbChartField.Visible = true;
                chartResult.Visible   = true;

                cmbChartField.Items.Add("AverageObjectSize");
                cmbChartField.Items.Add("DataSize");
                cmbChartField.Items.Add("ExtentCount");
                cmbChartField.Items.Add("IndexCount");
                cmbChartField.Items.Add("LastExtentSize");
                //MaxDocuments仅在CapedCollection时候有效
                //cmbChartField.Items.Add("MaxDocuments");
                cmbChartField.Items.Add("ObjectCount");
                cmbChartField.Items.Add("PaddingFactor");
                cmbChartField.Items.Add("StorageSize");
                cmbChartField.SelectedIndex = 0;
                try
                {
                    RefreshDBStatusChart("StorageSize");
                }
                catch (Exception ex)
                {
                    SystemManager.ExceptionDeal(ex);
                }
                break;

            case MongoDBHelper.COLLECTION_TAG:
                DocStatus = SystemManager.GetCurrentCollection().GetStats().Response.ToBsonDocument();
                //图形化初始化
                chartResult.Visible = true;

                chartResult.Series.Clear();
                chartResult.Titles.Clear();
                Series    SeriesResult = new Series("Usage");
                DataPoint dpDataSize   = new DataPoint(0, SystemManager.GetCurrentCollection().GetStats().DataSize);
                dpDataSize.LegendText    = "DataSize";
                dpDataSize.LegendToolTip = "DataSize";
                dpDataSize.ToolTip       = "DataSize";
                SeriesResult.Points.Add(dpDataSize);

                DataPoint dpTotalIndexSize = new DataPoint(0, SystemManager.GetCurrentCollection().GetStats().TotalIndexSize);
                dpTotalIndexSize.LegendText    = "TotalIndexSize";
                dpTotalIndexSize.LegendToolTip = "TotalIndexSize";
                dpTotalIndexSize.ToolTip       = "TotalIndexSize";
                SeriesResult.Points.Add(dpTotalIndexSize);

                DataPoint dpFreeSize = new DataPoint(0, SystemManager.GetCurrentCollection().GetStats().StorageSize -
                                                     SystemManager.GetCurrentCollection().GetStats().TotalIndexSize -
                                                     SystemManager.GetCurrentCollection().GetStats().DataSize);
                dpFreeSize.LegendText    = "FreeSize";
                dpFreeSize.LegendToolTip = "FreeSize";
                dpFreeSize.ToolTip       = "FreeSize";
                SeriesResult.Points.Add(dpFreeSize);

                SeriesResult.ChartType = SeriesChartType.Pie;
                chartResult.Series.Add(SeriesResult);
                chartResult.Titles.Add("Usage");

                break;

            default:
                if (SystemManager.GetCurrentServerConfig().LoginAsAdmin)
                {
                    DocStatus             = MongoDBHelper.ExecuteMongoSvrCommand(MongoDBHelper.serverStatus_Command, SystemManager.GetCurrentServer()).Response;
                    this.trvStatus.Height = this.trvStatus.Height * 2;
                }
                break;
            }
            if (!SystemManager.IsUseDefaultLanguage)
            {
                this.Text = SystemManager.mStringResource.GetText(StringResource.TextType.Main_Menu_Mangt_Status);
            }
            MongoDBHelper.FillDataToTreeView(strType, this.trvStatus, DocStatus);
            this.trvStatus.DatatreeView.Nodes[0].Expand();
        }