Browse Source

Removed DB and Website CPU from graph due to them being buggy

pull/111/head
Teknikode 5 years ago
parent
commit
d667bf35f7
  1. 14
      Teknik/Areas/Status/Scripts/Status.js
  2. 10
      Teknik/Hubs/ServerUsageHub.cs
  3. 28
      Teknik/SignalR/ServerUsageTicker.cs

14
Teknik/Areas/Status/Scripts/Status.js

@ -66,14 +66,6 @@ $(document).ready(function () { @@ -66,14 +66,6 @@ $(document).ready(function () {
{
name: 'Total',
data: []
},
{
name: 'Website',
data: []
},
{
name: 'Database',
data: []
}
]
});
@ -306,12 +298,6 @@ $(document).ready(function () { @@ -306,12 +298,6 @@ $(document).ready(function () {
// CPU Usage
cpuUsageChart.series[0].addPoint([x, serverUsage.cpu.total], false, cpuUsageChart.series[0].data.length > 20);
if (showWebCPU) {
cpuUsageChart.series[1].addPoint([x, serverUsage.cpu.website], false, cpuUsageChart.series[1].data.length > 20);
}
if (showDatabaseCPU) {
cpuUsageChart.series[2].addPoint([x, serverUsage.cpu.database], false, cpuUsageChart.series[2].data.length > 20);
}
// Database Usage
memUsageChart.series[0].addPoint([x, serverUsage.memory.used], false, memUsageChart.series[0].data.length > 20);

10
Teknik/Hubs/ServerUsageHub.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using Newtonsoft.Json;
using System;
@ -45,16 +45,10 @@ namespace Teknik.Hubs @@ -45,16 +45,10 @@ namespace Teknik.Hubs
{
[JsonProperty("total")]
public float Total { get; set; }
[JsonProperty("website")]
public float Website { get; set; }
[JsonProperty("database")]
public float Database { get; set; }
public CPUUsage()
{
Total = 0;
Website = 0;
Database = 0;
}
}
@ -95,4 +89,4 @@ namespace Teknik.Hubs @@ -95,4 +89,4 @@ namespace Teknik.Hubs
}
}
}
}
}

28
Teknik/SignalR/ServerUsageTicker.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using System;
using System.Collections.Generic;
@ -86,8 +86,6 @@ namespace Teknik.SignalR @@ -86,8 +86,6 @@ namespace Teknik.SignalR
// CPU
PerformanceCounter totalCPU = new PerformanceCounter();
PerformanceCounter webCPU = new PerformanceCounter();
PerformanceCounter dbCPU = new PerformanceCounter();
// Memory
PerformanceCounter totalAvailMem = new PerformanceCounter();
PerformanceCounter webMem = new PerformanceCounter();
@ -100,11 +98,7 @@ namespace Teknik.SignalR @@ -100,11 +98,7 @@ namespace Teknik.SignalR
// CPU
totalCPU = new PerformanceCounter("Processor", "% Processor Time", "_Total", true);
webCPU = new PerformanceCounter("Process", "% Processor Time", processName, true);
if (config.StatusConfig.ShowDatabaseStatus)
{
dbCPU = new PerformanceCounter("Process", "% Processor Time", config.StatusConfig.DatabaseProcessName, true);
}
// Memory
totalAvailMem = new PerformanceCounter("Memory", "Available Bytes", true);
webMem = new PerformanceCounter("Process", "Private Bytes", processName, true);
@ -121,14 +115,6 @@ namespace Teknik.SignalR @@ -121,14 +115,6 @@ namespace Teknik.SignalR
// CPU Sample
totalCPU.NextValue();
if (config.StatusConfig.ShowWebStatus)
{
webCPU.NextValue();
}
if (config.StatusConfig.ShowDatabaseStatus)
{
dbCPU.NextValue();
}
// Network Sample
sentPerf.NextValue();
@ -139,14 +125,6 @@ namespace Teknik.SignalR @@ -139,14 +125,6 @@ namespace Teknik.SignalR
// CPU Values
_serverUsage.CPU.Total = totalCPU.NextValue();
if (config.StatusConfig.ShowWebStatus)
{
_serverUsage.CPU.Website = webCPU.NextValue();
}
if (config.StatusConfig.ShowDatabaseStatus)
{
_serverUsage.CPU.Database = dbCPU.NextValue();
}
// Memory Values
_serverUsage.Memory.Total = config.StatusConfig.TotalMemory;
@ -176,4 +154,4 @@ namespace Teknik.SignalR @@ -176,4 +154,4 @@ namespace Teknik.SignalR
return false;
}
}
}
}

Loading…
Cancel
Save