OPserver:SQL CPU 图表未显示
OPserver: SQL CPU Graph Not Displayed
我正在使用 opserver 工具来监控 SQL 性能一切正常,除了它不显示 CPU 独立和集群的图形火花
我用这段代码替换 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();
}
我正在使用 opserver 工具来监控 SQL 性能一切正常,除了它不显示 CPU 独立和集群的图形火花
我用这段代码替换 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();
}