diff --git a/INTEGRATIONS.md b/INTEGRATIONS.md index 9c57b74..ff57f46 100644 --- a/INTEGRATIONS.md +++ b/INTEGRATIONS.md @@ -15,7 +15,7 @@ the dashboard views themselves load fine. (UniFi, Nginx Proxy Manager, Home Assi ### Reading one now -Every integration has a **Read now** button on the Integrations page (operators and administrators; the pages of Media managers, Download clients and Hetzner Robot have it too, on each card). `POST /api/integrations/{id}/read-now` answers `{ kind, ok, error, at, latencyMs }`: +Every integration has a **Read now** button on the Integrations page (operators and administrators; the pages of Media managers, Download clients, Hetzner Robot, Hetzner Cloud, Game servers, AdGuard Home, Technitium DNS, Grafana and Speedtest Tracker have it too, on each card). `POST /api/integrations/{id}/read-now` answers `{ kind, ok, error, at, latencyMs }`: - **`kind: "stored"`** — the integration has a reading that is kept (everything but the ones below): it is read the way its schedule reads it, stored, and the alerts are worked out again at once. A read that fails says why and leaves what was stored as it was. - **`kind: "live"`** — Proxmox, Synology, Tailscale, Gitea, Semaphore, Uptime Kuma, Proxmox Backup Server, osTicket, phpIPAM and Nginx Proxy Manager keep nothing: their pages and the health pass read them live every time. Here it asks whether the integration answers (the question *Test* asks, with what is saved) and brings its Working/Failing mark up to date; the alerts, which read it live, are worked out again at the next look. diff --git a/README.md b/README.md index 6e4e6aa..0924b35 100644 --- a/README.md +++ b/README.md @@ -573,7 +573,7 @@ The page also shows the users, the files and the app updates waiting. Whether it **App versions** (Operations → App versions). The version each connected application runs — as its integration last read it — against the newest release of it, with how far behind it is (a patch, a minor update, a major version) and how long the newer release has been out. It looks the newest releases up on GitHub once a day, and **that is the only thing this app asks of an address that is not yours, so it is switched off until an administrator switches it on**. A number of days (0 = never) makes a newer release that has been out that long a warning. Sonarr, Radarr, Prowlarr, Lidarr, Readarr, AdGuard Home, Grafana, Jellyfin, Immich, Paperless-ngx, Nextcloud, NetBox, Authentik and Prometheus are compared. See docs/MONITORING.md. -**Read now** (Integrations → *Read now* on each integration, and on the pages of Media managers, Download clients and Hetzner Robot; operators and administrators). Reads one integration at once instead of waiting for its next turn, and says how it went. An integration that is read on a schedule and stored (most of them) is read the way the schedule reads it, and what it says is judged again at once, so an alert that has cleared clears and a new one appears without waiting. One that is read live (Proxmox, Synology, Tailscale, Gitea, Semaphore, Uptime Kuma, Proxmox Backup Server, osTicket, phpIPAM, Nginx Proxy Manager) is asked whether it answers — the question *Test* asks — which also brings its Working/Failing mark up to date. The same integration is not read again within 20 seconds, since some systems limit how often they may be asked (Hetzner Robot allows 200 requests an hour). See INTEGRATIONS.md. +**Read now** (Integrations → *Read now* on each integration, and on the card of each integration on its own page — Media managers, Download clients, Hetzner Robot, Hetzner Cloud, Game servers, AdGuard Home, Technitium DNS, Grafana and Speedtest Tracker; operators and administrators). Reads one integration at once instead of waiting for its next turn, and says how it went. An integration that is read on a schedule and stored (most of them) is read the way the schedule reads it, and what it says is judged again at once, so an alert that has cleared clears and a new one appears without waiting. One that is read live (Proxmox, Synology, Tailscale, Gitea, Semaphore, Uptime Kuma, Proxmox Backup Server, osTicket, phpIPAM, Nginx Proxy Manager) is asked whether it answers — the question *Test* asks — which also brings its Working/Failing mark up to date. The same integration is not read again within 20 seconds, since some systems limit how often they may be asked (Hetzner Robot allows 200 requests an hour). See INTEGRATIONS.md. **Inspect an integration** (Integrations → *Inspect*, administrators). Runs the integration's reader once, now, and shows what each request asked and got back — the **shape** of every answer (the names and kinds of its fields, never the values) — beside what the reader made of it and the fields that came out empty. It is how an integration written from documentation is checked against the real system: an answer with a field the reader did not expect shows up as an empty field. *Copy the report* gives plain text that can be pasted into a message. Each inspection is written to the audit log; nothing is stored or changed. diff --git a/web/src/App.tsx b/web/src/App.tsx index bb33133..884f67b 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -184,16 +184,16 @@ function Shelled({ user }: { user: CurrentUser }) { } /> } /> } /> - } /> + } /> } /> } /> } /> } /> } /> - } /> - } /> - } /> - } /> + } /> + } /> + } /> + } /> } /> } /> } /> diff --git a/web/src/pages/AdguardHome.tsx b/web/src/pages/AdguardHome.tsx index bf62434..a717084 100644 --- a/web/src/pages/AdguardHome.tsx +++ b/web/src/pages/AdguardHome.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; -import { api, type AdguardInstance } from "../api/client"; +import ReadNowButton from "../components/ReadNowButton"; +import { api, type CurrentUser, type AdguardInstance } from "../api/client"; import EmptyState from "../components/EmptyState"; import TimeAgo from "../components/TimeAgo"; import { BlockSkeleton } from "../components/Skeleton"; @@ -52,7 +53,7 @@ function Counted({ title, items, empty }: { title: string; items: { name: string ); } -function Card({ a }: { a: AdguardInstance }) { +function Card({ a, canRead, onRead }: { a: AdguardInstance; canRead: boolean; onRead: () => void }) { const s = a.state; const st = s?.stats ?? null; const lists = s?.filters?.lists ?? []; @@ -64,7 +65,10 @@ function Card({ a }: { a: AdguardInstance }) {

{a.name} {s?.version ?? ""}

-
{a.status ? <>read : "not read yet"}
+
+ {a.status ? <>read : "not read yet"} + {canRead && a.enabled && } +
{a.status && !a.status.ok &&
The last attempt to read it failed: {a.status.error ?? "no answer"}.
} @@ -141,7 +145,9 @@ function Card({ a }: { a: AdguardInstance }) { } /** AdGuard Home: whether DNS really answers, whether it protects, what it has done and whether its lists are kept up to date. */ -export default function AdguardHome() { +export default function AdguardHome({ user }: { user: CurrentUser }) { + const canRead = user.role === "admin" || user.role === "operator"; + const [tick, setTick] = useState(0); const [data, setData] = useState(null); const [error, setError] = useState(null); useEffect(() => { @@ -156,7 +162,7 @@ export default function AdguardHome() { void load(); const t = setInterval(load, 60_000); return () => clearInterval(t); - }, []); + }, [tick]); return ( <>

AdGuard Home

@@ -173,7 +179,7 @@ export default function AdguardHome() {
)} - {data?.map((a) => )} + {data?.map((a) => setTick((n) => n + 1)} />)} ); } diff --git a/web/src/pages/GameServers.tsx b/web/src/pages/GameServers.tsx index 43ab9ec..11ad707 100644 --- a/web/src/pages/GameServers.tsx +++ b/web/src/pages/GameServers.tsx @@ -1,5 +1,6 @@ import { Fragment, useEffect, useState } from "react"; import { Link } from "react-router-dom"; +import ReadNowButton from "../components/ReadNowButton"; import { api, type CurrentUser, type FragnetAccount, type FragnetServerInfo, type FragnetSignal } from "../api/client"; import EmptyState from "../components/EmptyState"; import TimeAgo from "../components/TimeAgo"; @@ -357,7 +358,10 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa

{a.name}

-
{a.status ? <>read : "not read yet"}
+
+ {a.status ? <>read : "not read yet"} + {canAct && a.enabled && } +
{a.status && !a.status.ok &&
The last attempt to read it failed: {a.status.error ?? "no answer"}.
} diff --git a/web/src/pages/Grafana.tsx b/web/src/pages/Grafana.tsx index 8d08e60..6d9bb21 100644 --- a/web/src/pages/Grafana.tsx +++ b/web/src/pages/Grafana.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; -import { api, type GrafanaInstance } from "../api/client"; +import ReadNowButton from "../components/ReadNowButton"; +import { api, type CurrentUser, type GrafanaInstance } from "../api/client"; import EmptyState from "../components/EmptyState"; import TimeAgo from "../components/TimeAgo"; import { BlockSkeleton } from "../components/Skeleton"; @@ -30,7 +31,7 @@ function Tile({ label, value, sub, warn }: { label: string; value: string; sub?: ); } -function Card({ g }: { g: GrafanaInstance }) { +function Card({ g, canRead, onRead }: { g: GrafanaInstance; canRead: boolean; onRead: () => void }) { const s = g.state; const rules = s?.rules ?? null; const firing = rules?.items.filter((r) => r.state === "firing") ?? []; @@ -44,7 +45,10 @@ function Card({ g }: { g: GrafanaInstance }) {

{g.name} {s?.version ?? ""}

-
{g.status ? <>read : "not read yet"}
+
+ {g.status ? <>read : "not read yet"} + {canRead && g.enabled && } +
{g.status && !g.status.ok &&
The last attempt to read it failed: {g.status.error ?? "no answer"}.
} @@ -124,7 +128,9 @@ function Card({ g }: { g: GrafanaInstance }) { } /** Grafana: which alert rules are firing or cannot be evaluated, and which data sources fail their check. */ -export default function Grafana() { +export default function Grafana({ user }: { user: CurrentUser }) { + const canRead = user.role === "admin" || user.role === "operator"; + const [tick, setTick] = useState(0); const [data, setData] = useState(null); const [error, setError] = useState(null); useEffect(() => { @@ -139,7 +145,7 @@ export default function Grafana() { void load(); const t = setInterval(load, 60_000); return () => clearInterval(t); - }, []); + }, [tick]); return ( <>

Grafana

@@ -156,7 +162,7 @@ export default function Grafana() {
)} - {data?.map((g) => )} + {data?.map((g) => setTick((n) => n + 1)} />)} ); } diff --git a/web/src/pages/Hetzner.tsx b/web/src/pages/Hetzner.tsx index 67a4ded..11967b5 100644 --- a/web/src/pages/Hetzner.tsx +++ b/web/src/pages/Hetzner.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; -import { api, type HetznerProject, type HetznerTrafficForecast } from "../api/client"; +import ReadNowButton from "../components/ReadNowButton"; +import { api, type CurrentUser, type HetznerProject, type HetznerTrafficForecast } from "../api/client"; import EmptyState from "../components/EmptyState"; import TimeAgo from "../components/TimeAgo"; import { BlockSkeleton } from "../components/Skeleton"; @@ -100,7 +101,7 @@ function ServerRow({ s }: { s: NonNullable["servers"][n ); } -function Card({ p }: { p: HetznerProject }) { +function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onRead: () => void }) { const s = p.state; const cost = s?.cost ?? null; const gb = (s?.volumes ?? []).reduce((sum, v) => sum + v.size, 0); @@ -112,7 +113,10 @@ function Card({ p }: { p: HetznerProject }) {

{p.name}

-
{p.status ? <>read : "not read yet"}
+
+ {p.status ? <>read : "not read yet"} + {canRead && p.enabled && } +
{p.status && !p.status.ok &&
The last attempt to read it failed: {p.status.error ?? "no answer"}.
} @@ -327,7 +331,9 @@ function Card({ p }: { p: HetznerProject }) { } /** Hetzner Cloud: each project's servers, what is close to its traffic quota, which have backups, and roughly what it all costs. */ -export default function Hetzner() { +export default function Hetzner({ user }: { user: CurrentUser }) { + const canRead = user.role === "admin" || user.role === "operator"; + const [tick, setTick] = useState(0); const [data, setData] = useState(null); const [error, setError] = useState(null); useEffect(() => { @@ -342,7 +348,7 @@ export default function Hetzner() { void load(); const t = setInterval(load, 60_000); return () => clearInterval(t); - }, []); + }, [tick]); return ( <>

Hetzner Cloud

@@ -359,7 +365,7 @@ export default function Hetzner() {
)} - {data?.map((p) => )} + {data?.map((p) => setTick((n) => n + 1)} />)} ); } diff --git a/web/src/pages/Speedtest.tsx b/web/src/pages/Speedtest.tsx index 6f5509b..b505e84 100644 --- a/web/src/pages/Speedtest.tsx +++ b/web/src/pages/Speedtest.tsx @@ -1,6 +1,7 @@ import { useEffect, useMemo, useState } from "react"; import { Link } from "react-router-dom"; -import { api, type SpeedtestHistory, type SpeedtestInfo } from "../api/client"; +import ReadNowButton from "../components/ReadNowButton"; +import { api, type CurrentUser, type SpeedtestHistory, type SpeedtestInfo } from "../api/client"; import EmptyState from "../components/EmptyState"; import RangeSelect from "../components/RangeSelect"; import TimeAgo from "../components/TimeAgo"; @@ -86,7 +87,7 @@ function History({ id, name }: { id: number; name: string }) { ); } -function Card({ s }: { s: SpeedtestInfo }) { +function Card({ s, canRead, onRead }: { s: SpeedtestInfo; canRead: boolean; onRead: () => void }) { const st = s.state; const latest = st?.latest ?? null; const dl = s.expected.downloadMbps; @@ -97,7 +98,10 @@ function Card({ s }: { s: SpeedtestInfo }) {

{s.name}

-
{s.status ? <>read : "not read yet"}
+
+ {s.status ? <>read : "not read yet"} + {canRead && s.enabled && } +
{s.status && !s.status.ok &&
The last attempt to read it failed: {s.status.error ?? "no answer"}.
} @@ -143,7 +147,9 @@ function Card({ s }: { s: SpeedtestInfo }) { } /** Speedtest Tracker: how fast the internet has been, against what it is sold at. */ -export default function Speedtest() { +export default function Speedtest({ user }: { user: CurrentUser }) { + const canRead = user.role === "admin" || user.role === "operator"; + const [tick, setTick] = useState(0); const [data, setData] = useState(null); const [error, setError] = useState(null); useEffect(() => { @@ -158,7 +164,7 @@ export default function Speedtest() { void load(); const t = setInterval(load, 60_000); return () => clearInterval(t); - }, []); + }, [tick]); return ( <>

Speedtest

@@ -174,7 +180,7 @@ export default function Speedtest() {
)} - {data?.map((s) => )} + {data?.map((s) => setTick((n) => n + 1)} />)} ); } diff --git a/web/src/pages/TechnitiumDns.tsx b/web/src/pages/TechnitiumDns.tsx index c80316a..527680d 100644 --- a/web/src/pages/TechnitiumDns.tsx +++ b/web/src/pages/TechnitiumDns.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; -import { api, type TechnitiumInstance } from "../api/client"; +import ReadNowButton from "../components/ReadNowButton"; +import { api, type CurrentUser, type TechnitiumInstance } from "../api/client"; import EmptyState from "../components/EmptyState"; import TimeAgo from "../components/TimeAgo"; import { BlockSkeleton } from "../components/Skeleton"; @@ -71,7 +72,7 @@ const HOW: { key: "cached" | "recursive" | "authoritative" | "blocked" | "droppe { key: "dropped", label: "dropped", className: "bg-red" }, ]; -function Card({ a }: { a: TechnitiumInstance }) { +function Card({ a, canRead, onRead }: { a: TechnitiumInstance; canRead: boolean; onRead: () => void }) { const s = a.state; const st = s?.stats ?? null; const cacheMax = s?.settings.cacheMaximumEntries ?? null; @@ -82,7 +83,10 @@ function Card({ a }: { a: TechnitiumInstance }) {

{a.name} {s?.version ? `v${s.version}` : ""}

-
{a.status ? <>read : "not read yet"}
+
+ {a.status ? <>read : "not read yet"} + {canRead && a.enabled && } +
{a.status && !a.status.ok &&
The last attempt to read it failed: {a.status.error ?? "no answer"}.
} @@ -223,7 +227,9 @@ function Card({ a }: { a: TechnitiumInstance }) { } /** Technitium DNS Server: whether DNS really answers, whether it blocks, what it has done in the last day, how its zones and block lists are, and how it is doing. */ -export default function TechnitiumDns() { +export default function TechnitiumDns({ user }: { user: CurrentUser }) { + const canRead = user.role === "admin" || user.role === "operator"; + const [tick, setTick] = useState(0); const [data, setData] = useState(null); const [error, setError] = useState(null); useEffect(() => { @@ -238,7 +244,7 @@ export default function TechnitiumDns() { void load(); const t = setInterval(load, 60_000); return () => clearInterval(t); - }, []); + }, [tick]); return ( <>

Technitium DNS

@@ -255,7 +261,7 @@ export default function TechnitiumDns() {
)} - {data?.map((a) => )} + {data?.map((a) => setTick((n) => n + 1)} />)} ); }