fix(netflow): показывать текущие счётчики приёмника
This commit is contained in:
1 parent
db81cf0f97
commit
0abdac82de
1 file changed
+6
-1
@@ -19,6 +19,7 @@ import {
|
||||
} from "../services/traffic-flow-settings.js"
|
||||
import {
|
||||
getFlowListenerState,
|
||||
getFlowRuntimeCounters,
|
||||
purgeTrafficFlowStore,
|
||||
startTrafficFlowListener,
|
||||
listFlowTalkers,
|
||||
@@ -158,7 +159,11 @@ const trafficFlowRoutes: FastifyPluginAsyncZod = async (app) => {
|
||||
reconcile: () => withFlowConfigurationLock(reconcileFlowHost),
|
||||
}))
|
||||
await app.register(createTrafficFlowSettingsRoutes({
|
||||
read: () => toTrafficFlowSettingsDto(getFlowListenerState()),
|
||||
read: async () => {
|
||||
const settings = await toTrafficFlowSettingsDto(getFlowListenerState())
|
||||
const { packetsReceived, lastExporterIp, lastError, lastDatagramAt } = await getFlowRuntimeCounters()
|
||||
return { ...settings, packetsReceived, lastExporterIp, lastError, lastDatagramAt }
|
||||
},
|
||||
update: async patch => { await withFlowConfigurationLock(async () => {
|
||||
const current = await getTrafficFlowSettingsRow()
|
||||
if (agentSocket() && (["collectorIp", "prefix", "flowListenPort", "wgListenPort"] as const).some(key => patch[key] !== undefined && patch[key] !== current[key])) {
|
||||
|
||||
Reference in new issue
Block a user