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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user