Skip to content

Probes refresh rate#82

Merged
Kicer86 merged 30 commits into
masterfrom
probes_refresh_rate
May 2, 2026
Merged

Probes refresh rate#82
Kicer86 merged 30 commits into
masterfrom
probes_refresh_rate

Conversation

@Kicer86
Copy link
Copy Markdown
Owner

@Kicer86 Kicer86 commented Apr 6, 2026

No description provided.

@Kicer86 Kicer86 requested review from wkucjas April 6, 2026 19:59
Kicer86 added 22 commits May 1, 2026 21:17
Each probe now declares its refresh policy via GetRefreshPolicy():
- LinGeneralAnalyzer: 1h interval, proactive (log data can roll over)
- SmartHealthAnalyzer: 4h interval, not proactive (data persists)
- WinGeneralAnalyzer: 1h interval, proactive (WMI status transient)

Probes collect data in Refresh() and cache results internally.
GetStatus() and GetRawData() return cached data without I/O.
LinGeneralAnalyzer no longer collects in constructor.

Update IProbeMock and SmartHealthAnalyzer tests accordingly.
Replace monolithic collectAndPublish with per-probe staleness tracking:
- refreshStaleProbes: only refreshes probes past their declared interval
- publishFromCache: builds status from cached probe data without I/O
- refreshAllProbes: used by POST /refresh for manual force-refresh

Agent startup refreshes only proactive probes (log data). Non-proactive
probes (SMART) stay uncollected until a monitor connects.

SSE client connection triggers conditional refresh of stale probes via
new HttpServer::setOnClientConnectedCallback. Background thread checks
proactive probes every minute and pushes SSE updates when data changes.

Graceful shutdown: signal handler sets atomic flag, background thread
joins after server.listen() returns.
LinGeneralAnalyzer now detects journalctl at construction time. When
available, Refresh() runs journalctl -k --cursor-file instead of dmesg.

journalctl with --cursor-file reads only new entries since last cursor,
enabling incremental error accumulation without re-reading the full
kernel ring buffer. The cursor file at /tmp/rdhm-journal-cursor is
naturally cleaned on reboot, matching -k (current boot) semantics.

Falls back to popen(dmesg) on systems without systemd.
Monitor no longer triggers a forced refresh on every observe(). Instead,
connecting the SSE stream is sufficient: the agent-side SSE handler
conditionally refreshes stale probes and pushes a statusChanged event
as the first message. This avoids redundant refreshes when the monitor
reconnects frequently.

POST /api/v1/refresh remains available for manual user-triggered
refresh via the UI button.
@Kicer86 Kicer86 force-pushed the probes_refresh_rate branch from 8ef5c66 to cbee8a6 Compare May 1, 2026 19:21
@Kicer86 Kicer86 merged commit 544c1fd into master May 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant