using System; using Newtonsoft.Json; namespace PSProxmox.Models { /// /// Represents a node in a Proxmox VE cluster. /// public class ProxmoxNode { /// /// Gets or sets the node name. /// [JsonProperty("node")] public string Name { get; set; } /// /// Gets or sets the node status. /// [JsonProperty("status")] public string Status { get; set; } /// /// Gets or sets the node uptime in seconds. /// [JsonProperty("uptime")] public long Uptime { get; set; } /// /// Gets or sets the node CPU usage. /// [JsonProperty("cpu")] public double CPU { get; set; } /// /// Gets or sets the node memory usage. /// [JsonProperty("mem")] public long Memory { get; set; } /// /// Gets or sets the node total memory. /// [JsonProperty("maxmem")] public long MaxMemory { get; set; } /// /// Gets or sets the node disk usage. /// [JsonProperty("disk")] public long Disk { get; set; } /// /// Gets or sets the node total disk space. /// [JsonProperty("maxdisk")] public long MaxDisk { get; set; } /// /// Gets or sets the node SSL fingerprint. /// [JsonProperty("ssl_fingerprint")] public string SSLFingerprint { get; set; } /// /// Gets or sets the node IP address. /// [JsonProperty("ip")] public string IP { get; set; } /// /// Gets or sets the node level. /// [JsonProperty("level")] public string Level { get; set; } /// /// Gets or sets the node ID. /// [JsonProperty("id")] public string ID { get; set; } /// /// Gets or sets the node type. /// [JsonProperty("type")] public string Type { get; set; } /// /// Gets a value indicating whether the node is online. /// [JsonIgnore] public bool IsOnline => Status == "online"; /// /// Gets the node uptime as a TimeSpan. /// [JsonIgnore] public TimeSpan UptimeSpan => TimeSpan.FromSeconds(Uptime); /// /// Gets the node memory usage percentage. /// [JsonIgnore] public double MemoryUsagePercent => MaxMemory > 0 ? (double)Memory / MaxMemory * 100 : 0; /// /// Gets the node disk usage percentage. /// [JsonIgnore] public double DiskUsagePercent => MaxDisk > 0 ? (double)Disk / MaxDisk * 100 : 0; /// /// Gets the node memory in gigabytes. /// [JsonIgnore] public double MemoryGB => MaxMemory / 1024.0 / 1024.0 / 1024.0; /// /// Gets the node disk space in gigabytes. /// [JsonIgnore] public double DiskGB => MaxDisk / 1024.0 / 1024.0 / 1024.0; } }