Add Hetzner Robot: dedicated servers and storage boxes, with shutting-down, locked and rescue-left-on alerts

Read every 15 minutes (Robot allows 200 requests an hour; read-only): each server's product, addresses, status, rescue system and paid-until, and the storage boxes. Adapter, sync service, hetzner_robot_state table, /api/hetzner-robot, Infrastructure → Hetzner Robot page, metrics and docs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-04 23:26:26 +01:00
1 parent 7618bf0f0a
commit 01acbaf831
31 files changed
+10105 -10

No files matched your search

+2
View File
@@ -23,6 +23,7 @@ import Hetzner from "./pages/Hetzner";
import GameServers from "./pages/GameServers";
import Media from "./pages/Media";
import Downloads from "./pages/Downloads";
import HetznerRobot from "./pages/HetznerRobot";
import AdguardHome from "./pages/AdguardHome";
import TechnitiumDns from "./pages/TechnitiumDns";
import Grafana from "./pages/Grafana";
@@ -187,6 +188,7 @@ function Shelled({ user }: { user: CurrentUser }) {
<Route path="/game-servers" element={<GameServers user={user} />} />
<Route path="/media" element={<Media />} />
<Route path="/downloads" element={<Downloads />} />
<Route path="/hetzner-robot" element={<HetznerRobot />} />
<Route path="/versions" element={<Versions user={user} />} />
<Route path="/adguard" element={<AdguardHome />} />
<Route path="/technitium" element={<TechnitiumDns />} />
+39 -1
View File
@@ -1564,6 +1564,41 @@ export interface DownloadItem {
message: string | null;
}
/** One Hetzner Robot account (an integration of type hetznerrobot), as the dedicated servers page shows it. */
export interface RobotAccount {
id: number;
name: string;
enabled: boolean;
status: { at: string; ok: boolean; error: string | null } | null;
fresh: boolean;
state: {
servers: {
number: number;
name: string;
ip: string | null;
ipv6: string | null;
product: string | null;
dc: string | null;
traffic: string | null;
status: string;
cancelled: boolean;
paidUntil: string | null;
/** Null when it could not be asked. */
rescue: boolean | null;
rescueSince: string | null;
notReadySince: string | null;
}[];
/** Null when they could not be read. */
storageBoxes: { id: number; name: string; login: string | null; product: string | null; location: string | null; cancelled: boolean; locked: boolean; paidUntil: string | null; linkedServer: number | null }[] | null;
skippedDetail: number;
updatedAt: string;
/** Calendar days to the end of each cancelled server (by number) and storage box (by id): 0 on the day it ends, negative after. */
serverDays: Record<string, number | null>;
boxDays: Record<string, number | null>;
} | null;
problems: { key: string; message: string; severity: "warning" | "critical" }[];
}
/** One qBittorrent or SABnzbd (an integration of that type), as the download clients page shows it. */
export interface DownloadClient {
id: number;
@@ -2981,7 +3016,7 @@ export interface ManualTaskInput {
enabled?: boolean;
}
export type IntegrationType = "proxmox" | "synology" | "semaphore" | "tailscale" | "gitea" | "dockhand" | "uptimekuma" | "phpipam" | "pbs" | "osticket" | "unifi" | "npm" | "homeassistant" | "ups" | "jellyfin" | "authentik" | "prometheus" | "immich" | "paperless" | "nextcloud" | "netbox" | "n8n" | "hetzner" | "speedtest" | "fragnet" | "sonarr" | "radarr" | "prowlarr" | "adguard" | "technitium" | "grafana" | "lidarr" | "readarr" | "qbittorrent" | "sabnzbd";
export type IntegrationType = "proxmox" | "synology" | "semaphore" | "tailscale" | "gitea" | "dockhand" | "uptimekuma" | "phpipam" | "pbs" | "osticket" | "unifi" | "npm" | "homeassistant" | "ups" | "jellyfin" | "authentik" | "prometheus" | "immich" | "paperless" | "nextcloud" | "netbox" | "n8n" | "hetzner" | "speedtest" | "fragnet" | "sonarr" | "radarr" | "prowlarr" | "adguard" | "technitium" | "grafana" | "lidarr" | "readarr" | "qbittorrent" | "sabnzbd" | "hetznerrobot";
export interface IntegrationField {
key: string;
@@ -3603,6 +3638,9 @@ export const api = {
downloads: {
list: () => request<{ clients: DownloadClient[] }>("/api/downloads"),
},
hetznerRobot: {
list: () => request<{ accounts: RobotAccount[] }>("/api/hetzner-robot"),
},
fragnet: {
list: () => request<{ accounts: FragnetAccount[] }>("/api/fragnet"),
power: (integrationId: number, serverId: string, signal: FragnetSignal) => request<void>(`/api/fragnet/${integrationId}/servers/${serverId}/power`, { method: "POST", body: JSON.stringify({ signal }) }),
+1
View File
@@ -41,6 +41,7 @@ const TYPE_LABELS: Record<string, string> = {
readarr: "Readarr",
qbittorrent: "qBittorrent",
sabnzbd: "SABnzbd",
hetznerrobot: "Hetzner Robot",
};
export type WallLevel = "critical" | "warning" | "ok" | "unsure";
+2
View File
@@ -44,6 +44,7 @@ import {
IconBooks,
IconDownload,
IconCloudDownload,
IconCpu,
IconBox,
IconHeartbeat,
IconGitCommit,
@@ -102,6 +103,7 @@ export const NAV: NavEntry[] = [
{ to: "/synology", label: "Synology", icon: <IconDatabase size={20} /> },
{ to: "/docker", label: "Docker", icon: <IconBrandDocker size={20} /> },
{ to: "/hetzner", label: "Hetzner Cloud", icon: <IconServerBolt size={20} /> },
{ to: "/hetzner-robot", label: "Hetzner Robot", icon: <IconCpu size={20} /> },
{ to: "/game-servers", label: "Game servers", icon: <IconDeviceGamepad2 size={20} /> },
{ to: "/tailscale", label: "Tailscale", icon: <IconAffiliate size={20} /> },
],
+221
View File
@@ -0,0 +1,221 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { api, type RobotAccount } from "../api/client";
import EmptyState from "../components/EmptyState";
import TimeAgo from "../components/TimeAgo";
import { BlockSkeleton } from "../components/Skeleton";
import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
function Badge({ a }: { a: RobotAccount }) {
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can&rsquo;t be read</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
}
function Tile({ label, value, sub, warn }: { label: string; value: string; sub?: string | null; warn?: boolean }) {
return (
<div className="col-6 col-lg-3">
<div className="card card-sm h-100">
<div className="card-body">
<div className="text-secondary small">{label}</div>
<div className={`h2 mb-0 ${warn ? "text-yellow" : ""}`}>{value}</div>
{sub && <div className="text-secondary small">{sub}</div>}
</div>
</div>
</div>
);
}
/** "Paid until 2026-12-01", or, for one that is cancelled, when it ends and how long that is. */
function Until({ date, cancelled, days }: { date: string | null; cancelled: boolean; days: number | null | undefined }) {
if (!date) return <span className="text-secondary">—</span>;
if (!cancelled) return <span className="text-secondary">paid until {date}</span>;
const urgent = days !== null && days !== undefined && days <= 7;
const soon = days !== null && days !== undefined && days <= 30;
return (
<>
<span className={`badge ${urgent ? "bg-red-lt text-red" : soon ? "bg-yellow-lt text-yellow" : "bg-secondary-lt text-secondary"}`}>cancelled</span>
<div className={`small ${urgent ? "text-red" : soon ? "text-yellow" : "text-secondary"}`}>
ends {date}
{days !== null && days !== undefined ? (days < 0 ? " — has ended" : days === 0 ? " — today" : ` — ${days} day${days === 1 ? "" : "s"} left`) : ""}
</div>
</>
);
}
function Card({ a }: { a: RobotAccount }) {
const s = a.state;
const rescue = s?.servers.filter((v) => v.rescue === true).length ?? 0;
const cancelled = (s?.servers.filter((v) => v.cancelled).length ?? 0) + (s?.storageBoxes?.filter((b) => b.cancelled).length ?? 0);
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">
{a.name} <Badge a={a} />
</h3>
<div className="card-actions text-secondary small">{a.status ? <>read <TimeAgo value={a.status.at} /></> : "not read yet"}</div>
</div>
<div className="card-body">
{a.status && !a.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {a.status.error ?? "no answer"}.</div>}
{a.problems.length > 0 && (
<ul className="mb-3">
{a.problems.map((x) => (
<li key={x.key} className={x.severity === "critical" ? "text-red" : ""}>
{x.message}
</li>
))}
</ul>
)}
{s && (
<>
<div className="row g-3 mb-3">
<Tile label="Dedicated servers" value={String(s.servers.length)} sub={s.servers.length === 0 ? "none on this account" : null} />
<Tile label="Rescue system on" value={String(rescue)} sub={rescue > 0 ? "the next boot is into it" : "none"} warn={rescue > 0} />
<Tile label="Cancelled" value={String(cancelled)} sub={cancelled > 0 ? "servers and storage boxes shutting down" : "nothing shutting down"} warn={cancelled > 0} />
<Tile label="Storage boxes" value={s.storageBoxes === null ? "—" : String(s.storageBoxes.length)} sub={s.storageBoxes === null ? "could not be read" : s.storageBoxes.some((b) => b.locked) ? "one is locked" : null} warn={!!s.storageBoxes?.some((b) => b.locked)} />
</div>
{s.skippedDetail > 0 && <div className="text-secondary small mb-2">{s.skippedDetail} server{s.skippedDetail === 1 ? "" : "s"} beyond the first 25 were not asked about their rescue system (Hetzner allows 200 requests an hour).</div>}
{s.servers.length > 0 && (
<div className="table-responsive mb-3">
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Server</th>
<th>Product</th>
<th>Address</th>
<th>Traffic</th>
<th>Status</th>
<th>Rescue</th>
<th>Paid</th>
</tr>
</thead>
<tbody>
{s.servers.map((v) => (
<tr key={v.number}>
<td>
{v.name}
<div className="small text-secondary">#{v.number}</div>
</td>
<td className="text-secondary">
{v.product ?? "—"}
{v.dc && <div className="small">{v.dc}</div>}
</td>
<td className="text-secondary">
{v.ip ? <code>{v.ip}</code> : "—"}
{v.ipv6 && (
<div className="small">
<code>{v.ipv6}</code>
</div>
)}
</td>
<td className="text-secondary">{v.traffic ?? "—"}</td>
<td>{v.status === "ready" ? <span className="badge bg-green-lt text-green">ready</span> : <span className="badge bg-yellow-lt text-yellow">{v.status}</span>}</td>
<td>
{v.rescue === null ? (
<span className="text-secondary">—</span>
) : v.rescue ? (
<>
<span className="badge bg-yellow-lt text-yellow">on</span>
{v.rescueSince && (
<div className="small text-secondary">
since <TimeAgo value={v.rescueSince} />
</div>
)}
</>
) : (
<span className="text-secondary">off</span>
)}
</td>
<td>
<Until date={v.paidUntil} cancelled={v.cancelled} days={s.serverDays[String(v.number)]} />
</td>
</tr>
))}
</tbody>
</table>
</div>
)}
{s.storageBoxes && s.storageBoxes.length > 0 && (
<>
<h4>Storage boxes</h4>
<div className="table-responsive">
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Storage box</th>
<th>Product</th>
<th>Location</th>
<th>Linked to</th>
<th>State</th>
<th>Paid</th>
</tr>
</thead>
<tbody>
{s.storageBoxes.map((b) => (
<tr key={b.id}>
<td>
{b.name}
<div className="small text-secondary">{b.login ?? `#${b.id}`}</div>
</td>
<td className="text-secondary">{b.product ?? "—"}</td>
<td className="text-secondary">{b.location ?? "—"}</td>
<td className="text-secondary">{b.linkedServer !== null ? (s.servers.find((v) => v.number === b.linkedServer)?.name ?? `server ${b.linkedServer}`) : "—"}</td>
<td>{b.locked ? <span className="badge bg-red-lt text-red">locked</span> : <span className="badge bg-green-lt text-green">open</span>}</td>
<td>
<Until date={b.paidUntil} cancelled={b.cancelled} days={s.boxDays[String(b.id)]} />
</td>
</tr>
))}
</tbody>
</table>
</div>
</>
)}
</>
)}
</div>
</div>
);
}
/** Hetzner Robot: the account's dedicated servers (rescue system, cancellation) and storage boxes. */
export default function HetznerRobot() {
const [data, setData] = useState<RobotAccount[] | null>(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const load = () =>
api.hetznerRobot
.list()
.then((r) => {
setData(r.accounts);
setError(null);
})
.catch((err) => setError(readableError(err)));
void load();
const t = setInterval(load, 60_000);
return () => clearInterval(t);
}, []);
return (
<>
<h2 className="page-title">Hetzner Robot</h2>
<p className="text-secondary">
Dedicated servers and storage boxes at Hetzner (Robot — the cloud servers are on <Link to="/hetzner">Hetzner Cloud</Link>), read every fifteen minutes (see <Link to="/integrations">Integrations</Link>) — nothing is reset, ordered or cancelled.{" "}
<strong>A server or storage box that is cancelled and about to shut down</strong>, <strong>a locked storage box</strong>, <strong>a rescue system left on</strong> and <strong>a server stuck being set up</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
</p>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
{data && data.length === 0 && (
<div className="card">
<div className="card-body">
<EmptyState title="No Hetzner Robot account connected" hint="Add one under Integrations with a webservice user (Robot → Settings → Webservice and app settings) and its password." />
</div>
</div>
)}
{data?.map((a) => <Card key={a.id} a={a} />)}
</>
);
}
+5
View File
@@ -29,6 +29,11 @@ const KIND_WORDS: Record<string, string> = {
"readarr-health": "Readarr reporting a problem",
"readarr-queue": "stuck downloads in Readarr",
"prowlarr-health": "Prowlarr reporting a problem",
"hetznerrobot-ending": "a Hetzner dedicated server about to shut down",
"hetznerrobot-rescue": "a Hetzner rescue system left on",
"hetznerrobot-setup": "a Hetzner dedicated server stuck being set up",
"hetznerrobot-boxlocked": "a locked Hetzner storage box",
"hetznerrobot-boxending": "a Hetzner storage box about to shut down",
"qbittorrent-stuck": "stuck torrents in qBittorrent",
"qbittorrent-connection": "qBittorrent with no connection",
"qbittorrent-disk": "a qBittorrent download disk filling up",
+4 -2
View File
@@ -37,6 +37,7 @@ export const TYPE_LABELS: Record<IntegrationType, string> = {
readarr: "Readarr",
qbittorrent: "qBittorrent",
sabnzbd: "SABnzbd",
hetznerrobot: "Hetzner Robot",
};
/** The page each kind of integration gets once it is connected. */
@@ -76,11 +77,12 @@ export const TYPE_PAGES: Record<IntegrationType, string> = {
readarr: "/media",
qbittorrent: "/downloads",
sabnzbd: "/downloads",
hetznerrobot: "/hetzner-robot",
};
/** The kinds of integration grouped the way the sidebar groups their pages, in the same order. */
export const TYPE_GROUPS: { id: string; label: string; types: IntegrationType[] }[] = [
{ id: "infrastructure", label: "Infrastructure", types: ["proxmox", "synology", "dockhand", "hetzner", "fragnet", "tailscale"] },
{ id: "infrastructure", label: "Infrastructure", types: ["proxmox", "synology", "dockhand", "hetzner", "hetznerrobot", "fragnet", "tailscale"] },
{ id: "apps", label: "Apps", types: ["homeassistant", "jellyfin", "sonarr", "radarr", "lidarr", "readarr", "prowlarr", "qbittorrent", "sabnzbd", "immich", "paperless", "nextcloud", "authentik"] },
{ id: "backups", label: "Backups", types: ["pbs"] },
{ id: "network", label: "Network", types: ["unifi", "npm", "phpipam", "netbox", "adguard", "technitium"] },
@@ -89,7 +91,7 @@ export const TYPE_GROUPS: { id: string; label: string; types: IntegrationType[]
];
/** The kinds whose reader can be inspected (Settings → Integrations → Check what can be read): the ones that read through the shared HTTP helper and have a reader to run. */
export const INSPECTABLE: IntegrationType[] = ["authentik", "immich", "jellyfin", "netbox", "nextcloud", "paperless", "prometheus", "hetzner", "speedtest", "fragnet", "sonarr", "radarr", "prowlarr", "lidarr", "readarr", "qbittorrent", "sabnzbd", "adguard", "technitium", "grafana"];
export const INSPECTABLE: IntegrationType[] = ["authentik", "immich", "jellyfin", "netbox", "nextcloud", "paperless", "prometheus", "hetzner", "speedtest", "fragnet", "sonarr", "radarr", "prowlarr", "lidarr", "readarr", "qbittorrent", "sabnzbd", "hetznerrobot", "adguard", "technitium", "grafana"];
/** The group a kind belongs to; a kind nobody has placed yet falls in "Other" rather than vanishing. */
export function groupOfType(type: IntegrationType): { id: string; label: string } {