Fix last commit

This commit is contained in:
Nicola Carminati
2018-12-28 15:36:17 +01:00
parent 9994ba10c0
commit e130d2bfa5
6 changed files with 19 additions and 2 deletions
+12 -1
View File
@@ -1,4 +1,5 @@
using CMS_CORE_Library.Models;
using Step.Config;
using Step.Core;
using Step.Model.DTOModels;
using Step.Model.DTOModels.AlarmModels;
@@ -722,9 +723,19 @@ public static class ThreadsFunctions
float SumRec, SumSen;
Stopwatch sw = new Stopwatch();
DTONetworkMonitor Monitor = new DTONetworkMonitor();
int CardId = ServerConfig.ServerStartupConfig.NetworkCardId - 1;
PerformanceCounterCategory performanceCounterCategory = new PerformanceCounterCategory("Network Interface");
Monitor.Name = performanceCounterCategory.GetInstanceNames()[0]; // 1st NIC !
if(CardId<0 || CardId > performanceCounterCategory.GetInstanceNames().Length )
{
Monitor.Name = "No card to monitor";
MessageServices.Current.Publish(NETWORK_USAGE, null, Monitor);
return;
}
Monitor.Name = performanceCounterCategory.GetInstanceNames()[0];
PerformanceCounter PC_Bandwith = new PerformanceCounter("Network Interface", "Current Bandwidth", Monitor.Name);
PerformanceCounter PC_RecievedBytes = new PerformanceCounter("Network Interface", "Bytes Received/sec", Monitor.Name);