The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

ServerUsageHub.cs 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using Microsoft.AspNet.SignalR;
  2. using Microsoft.AspNet.SignalR.Hubs;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.Linq;
  8. using System.Threading;
  9. using System.Web;
  10. using Teknik.Configuration;
  11. using Teknik.SignalR;
  12. namespace Teknik.Hubs
  13. {
  14. [HubName("serverUsage")]
  15. public class ServerUsageHub : Hub
  16. {
  17. private readonly ServerUsageTicker _serverUsageTicker;
  18. public ServerUsageHub() : this(ServerUsageTicker.Instance) { }
  19. public ServerUsageHub(ServerUsageTicker serverUsageTicker)
  20. {
  21. _serverUsageTicker = serverUsageTicker;
  22. }
  23. public class ServerUsage
  24. {
  25. [JsonProperty("cpu")]
  26. public CPUUsage CPU { get; set; }
  27. [JsonProperty("memory")]
  28. public MemoryUsage Memory { get; set; }
  29. [JsonProperty("network")]
  30. public NetworkUsage Network { get; set; }
  31. public ServerUsage()
  32. {
  33. CPU = new CPUUsage();
  34. Memory = new MemoryUsage();
  35. Network = new NetworkUsage();
  36. }
  37. }
  38. public class CPUUsage
  39. {
  40. [JsonProperty("total")]
  41. public float Total { get; set; }
  42. [JsonProperty("website")]
  43. public float Website { get; set; }
  44. [JsonProperty("database")]
  45. public float Database { get; set; }
  46. public CPUUsage()
  47. {
  48. Total = 0;
  49. Website = 0;
  50. Database = 0;
  51. }
  52. }
  53. public class MemoryUsage
  54. {
  55. [JsonProperty("total")]
  56. public float Total { get; set; }
  57. [JsonProperty("available")]
  58. public float Available { get; set; }
  59. [JsonProperty("used")]
  60. public float Used { get; set; }
  61. [JsonProperty("websiteUsed")]
  62. public float WebsiteUsed { get; set; }
  63. [JsonProperty("databaseUsed")]
  64. public float DatabaseUsed { get; set; }
  65. public MemoryUsage()
  66. {
  67. Total = 0;
  68. Available = 0;
  69. Used = 0;
  70. WebsiteUsed = 0;
  71. DatabaseUsed = 0;
  72. }
  73. }
  74. public class NetworkUsage
  75. {
  76. [JsonProperty("sent")]
  77. public float Sent { get; set; }
  78. [JsonProperty("received")]
  79. public float Received { get; set; }
  80. public NetworkUsage()
  81. {
  82. Sent = 0;
  83. Received = 0;
  84. }
  85. }
  86. }
  87. }