Repository navigation
Shared statistics and query history in two AdGuard Home panels #8704
czernihoviensis
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I run two AdGuard Home resolvers for redundancy and wanted both native panels to show the combined statistics and query history. This recipe describes the gateway that serves those shared reads. AdGuard Home Sync continues to apply configuration from the origin to its replicas. This gateway supplies shared reads to the existing native panels. AdGuard Home Sync · Statistics FAQ
Layout
Keep the native web APIs on loopback. Serve each native UI, login, logout and settings through its existing private origin. Intercept authenticated
GET /control/statsandGET /control/querylog. For each intercepted request, validate the browser session against the same node that issued it before returning shared data. The merger uses a separate restricted transport and a server-side credential. Keep session cookies bound to their respective origins. AdGuard Home APIPrivate transport example
The example uses two local listeners on A, an SSH Unix socket on A for B's native API, and a reverse TCP listener on B for the shared read endpoint. Adapt the addresses and port numbers to your deployment.
127.0.0.1:18053on each node127.0.0.1:18651on each node127.0.0.2:18651on A127.0.0.1:18652on BCreate a dedicated public-key account on B. The following OpenSSH match block restricts its TCP targets and disables shell sessions. Validate the effective configuration for this account and for the existing administrator with
sshd -T -Cbefore reloading SSH. Use a dedicated authorized-keys file and a pre-verified host key. OpenSSH server configurationRun a supervised SSH client on A with an owner-private runtime directory and pinned known-hosts file.
192.0.2.20is a documentation address.Build the shared reads
For a synthetic ranking example, suppose both resolvers report 30 and 20 requests for the same domain. Its combined count is 50 within the reported data. If resolver B omits a second domain and its published list stops at 4 requests, the second domain may have up to 4 additional requests on B. Show the first domain's known count and keep the second count out of the exact-count view. Compare query-log coverage against the native counters before using log-derived rankings.
Accept and roll out
Verification from a two-node deployment
The recipe was exercised with two AdGuard Home v0.107.80 instances. Separate logins worked on both native origins. The shared results matched for 1 h, 24 h, 7 days and 365 days, and the same query-log cursor returned the same page. Tests also covered anonymous access, HTTPS, DNS over UDP and TCP, and the labelled relay fallback.
Reproduce a basic API comparison
Use two test origins configured with the gateway. Set
ADGUARD_NETRCto a private, mode-0600 netrc file with onemachineentry per test hostname. The requests run without interactive prompts so they can share a live cache interval. This example uses the gateway'sX-AdGuard-Preview-Statusheader to verify freshness. Repeat both reads together if a snapshot boundary intervenes.Use synthetic domains, clients and traffic in public examples. Report the windows, freshness and any ranking limitations. Keep hostnames, credentials, raw logs and infrastructure backups private.
All reactions