feat(opsserver): add RADIUS and VPN metrics to combined ops stats and overview dashboards, and stream live log buffer entries in follow mode

This commit is contained in:
2026-04-03 14:11:17 +00:00
parent b3296c6522
commit f6a9e344e5
10 changed files with 237 additions and 41 deletions

View File

@@ -3,6 +3,7 @@ import type { OpsServer } from '../classes.opsserver.js';
import * as interfaces from '../../../ts_interfaces/index.js';
import { MetricsManager } from '../../monitoring/index.js';
import { SecurityLogger } from '../../security/classes.securitylogger.js';
import { commitinfo } from '../../00_commitinfo_data.js';
export class StatsHandler {
constructor(private opsServerRef: OpsServer) {
@@ -158,7 +159,7 @@ export class StatsHandler {
};
return acc;
}, {} as any),
version: '2.12.0', // TODO: Get from package.json
version: commitinfo.version,
},
};
}
@@ -314,7 +315,47 @@ export class StatsHandler {
})()
);
}
if (sections.radius) {
promises.push(
(async () => {
const radiusServer = this.opsServerRef.dcRouterRef.radiusServer;
if (!radiusServer) return;
const stats = radiusServer.getStats();
const accountingStats = radiusServer.getAccountingManager().getStats();
metrics.radius = {
running: stats.running,
uptime: stats.uptime,
authRequests: stats.authRequests,
authAccepts: stats.authAccepts,
authRejects: stats.authRejects,
accountingRequests: stats.accountingRequests,
activeSessions: stats.activeSessions,
totalInputBytes: accountingStats.totalInputBytes,
totalOutputBytes: accountingStats.totalOutputBytes,
};
})()
);
}
if (sections.vpn) {
promises.push(
(async () => {
const vpnManager = this.opsServerRef.dcRouterRef.vpnManager;
const vpnConfig = this.opsServerRef.dcRouterRef.options.vpnConfig;
if (!vpnManager) return;
const connected = await vpnManager.getConnectedClients();
metrics.vpn = {
running: vpnManager.running,
subnet: vpnManager.getSubnet(),
registeredClients: vpnManager.listClients().length,
connectedClients: connected.length,
wgListenPort: vpnConfig?.wgListenPort ?? 51820,
};
})()
);
}
await Promise.all(promises);
return {