title: How to get the current CPU/RAM/Disk usage in a C# web application using .NET CORE?
body: <p>I am currently looking for a way to get the current CPU/RAM/Disk usage in a C# web application using .NET CORE.</p>
  
  <p>For CPU and ram usage, I use PerformanceCounter Class from System.Diagnostics.
  These are the codes:</p>
  
  <pre><code> PerformanceCounter cpuCounter;
   PerformanceCounter ramCounter;
  
   cpuCounter = new PerformanceCounter();
  
  cpuCounter.CategoryName = "Processor";
  cpuCounter.CounterName = "% Processor Time";
  cpuCounter.InstanceName = "_Total";
  
  ramCounter = new PerformanceCounter("Memory", "Available MBytes");
  
  
  public string getCurrentCpuUsage(){
          cpuCounter.NextValue()+"%";
  }
  
  public string getAvailableRAM(){
          ramCounter.NextValue()+"MB";
  }
  </code></pre>
  
  <p>For disk usage, I use the DriveInfo class. These are the codes:</p>
  
  <pre><code> using System;
   using System.IO;
  
   class Info {
   public static void Main() {
      DriveInfo[] drives = DriveInfo.GetDrives();
      foreach (DriveInfo drive in drives) {
          //There are more attributes you can use.
          //Check the MSDN link for a complete example.
          Console.WriteLine(drive.Name);
          if (drive.IsReady) Console.WriteLine(drive.TotalSize);
      }
    }
   }
  </code></pre>
  
  <p>Unfortunately .NET Core does not support DriveInfo and PerformanceCounter classes, hence the codes above do not work.</p>
  
  <p>Does anyone know how I can get the current CPU/RAM/Disk usage in a C# web application using .NET CORE?</p>