Show System metrics in hosts page

Implement simple collection of basic real time system metrics of hosts
and the controller for the purpose of displaying them in the Web UI. The
metrics are collected by the controller at a configurable interval and
pushed out to web clients currently subscribed to the metrics.
This commit is contained in:
Hornwitser committed 2024-01-14 09:57:44 +01:00
1 parent 69bdc8e884
commit d64bf6015e
13 files changed
+409 -7

No files matched your search

+5
View File
@@ -347,6 +347,7 @@ export default class Host extends lib.Link {
this.snoopEvent(lib.InstanceWhitelistUpdateEvent, this.handleWhitelistUpdateEvent.bind(this));
this.handle(lib.InstanceAssignInternalRequest, this.handleInstanceAssignInternalRequest.bind(this));
this.handle(lib.InstanceUnassignInternalRequest, this.handleInstanceUnassignInternalRequest.bind(this));
this.handle(lib.SystemMetricsRequest, this.handleSystemMetricsRequest.bind(this));
this.handle(lib.HostMetricsRequest, this.handleHostMetricsRequest.bind(this));
this.fallbackRequest(
lib.InstanceSaveDetailsListRequest, this.fallbackInstanceSaveDetailsListRequest.bind(this),
@@ -723,6 +724,10 @@ export default class Host extends lib.Link {
return instanceConnection;
}
async handleSystemMetricsRequest() {
return lib.gatherSystemMetrics(this.config.get("host.id"));
}
async handleHostMetricsRequest() {
let requests: Promise<InstanceType<typeof lib.InstanceMetricsRequest["Response"]>>[] = [];
for (let instanceConnection of this.instanceConnections.values()) {