-1

我正在使用 opserver 工具来监控 SQL 性能一切正常,除了它不显示独立和集群的 CPU 图形火花

4

1 回答 1

1

我用这段代码替换 SQLCPUSpark 函数

public ActionResult SQLCPUSpark(string node)
        {
            var instance = SQLInstance.Get(node);
            if (instance == null) 
                   return ContentNotFound("SQLNode not found with name = '" + node + "'");

            var dataPoints = instance.CPUHistoryLastHour;

            var chart = new Chart();
            var area = new ChartArea();
            area.AxisX.Enabled = AxisEnabled.False;
            area.AxisY.Enabled = AxisEnabled.False;
            area.AxisY.Maximum = 100;

            // configure your chart area (dimensions, etc) here.
            chart.ChartAreas.Add(area);

            // create and customize your data series.
            var series = new Series();
            foreach (var item in dataPoints.Data)
            {
                series.Points.AddXY(item.EventTime.ToOADate(), item.ProcessUtilization);
            }
            series.Label = "";
            series.Font = new Font("Segoe UI", 8.0f, FontStyle.Bold);
            series.ChartType = SeriesChartType.Area;
            chart.Series.Add(series);
            return chart.ToResult();
        }
于 2015-07-16T09:06:01.063 回答