Integrate plugin with local monitor bridge

This commit is contained in:
zhi
2026-03-21 16:07:01 +00:00
parent 9f649e2b39
commit 78a61e0fb2
12 changed files with 225 additions and 5 deletions

41
plugin/core/monitor-bridge.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
/**
* Monitor Bridge Client
*
* Queries the local HarborForge.Monitor bridge endpoint on MONITOR_PORT
* to enrich plugin telemetry with host/hardware data.
*
* If the bridge is unreachable, all methods return null gracefully —
* the plugin continues to function without Monitor data.
*/
export interface MonitorHealth {
status: string;
monitor_version: string;
identifier: string;
}
export interface MonitorTelemetryResponse {
status: string;
monitor_version: string;
identifier: string;
telemetry?: {
identifier: string;
plugin_version: string;
cpu_pct: number;
mem_pct: number;
disk_pct: number;
swap_pct: number;
load_avg: number[];
uptime_seconds: number;
nginx_installed: boolean;
nginx_sites: string[];
};
last_updated?: string;
}
export declare class MonitorBridgeClient {
private baseUrl;
private timeoutMs;
constructor(port: number, timeoutMs?: number);
health(): Promise<MonitorHealth | null>;
telemetry(): Promise<MonitorTelemetryResponse | null>;
private fetchJson;
}
//# sourceMappingURL=monitor-bridge.d.ts.map