Hetzner Cloud integration: servers, traffic quota, backups, volumes and cost

One integration per project (read-only API token, read every 5 minutes).
Alerts for a server that was running and is off, stuck statuses, traffic
at 80%/100% of the monthly quota, rescue mode left on, and late backups.
The Hetzner page lists servers, volumes, snapshots and a cost estimate; a
server the app knows by its agent gets a Hetzner card on its own page.
/metrics and docs updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-25 22:51:17 +01:00
1 parent 5a2b320175
commit 24b708abbe
35 files changed
+9430 -7

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { api, type HetznerForServer } from "../api/client";
import TimeAgo from "./TimeAgo";
import { StatusBadge, TrafficBar } from "../pages/Hetzner";
/** On a server's page: the Hetzner Cloud server it is (matched by address, else by name), when there is one. Nothing is shown for a server that is not at Hetzner. */
export default function HetznerServerCard({ serverId }: { serverId: number }) {
const [match, setMatch] = useState<HetznerForServer["match"]>(null);
useEffect(() => {
let live = true;
api.hetzner
.forServer(serverId)
.then((r) => live && setMatch(r.match))
.catch(() => live && setMatch(null));
return () => {
live = false;
};
}, [serverId]);
if (!match) return null;
const s = match.server;
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Hetzner Cloud</h3>
<div className="card-actions">
<Link to="/hetzner" className="btn btn-sm btn-outline-secondary">
{match.integrationName}
</Link>
</div>
</div>
<div className="card-body">
{match.problems.length > 0 && (
<ul className="mb-3">
{match.problems.map((p) => (
<li key={p.key} className={p.severity === "critical" ? "text-red" : ""}>
{p.message}
</li>
))}
</ul>
)}
<div className="row g-3">
<div className="col-6 col-lg-3">
<div className="text-secondary small">Status</div>
<StatusBadge status={s.status} />
{s.rescueEnabled && <span className="badge bg-yellow-lt text-yellow ms-1">rescue on</span>}
</div>
<div className="col-6 col-lg-3">
<div className="text-secondary small">Type and place</div>
{s.type ?? "—"} · {s.location ?? "?"}
</div>
<div className="col-6 col-lg-3">
<div className="text-secondary small">Backups</div>
{s.backupWindow ? (match.newestBackup ? <>newest <TimeAgo value={match.newestBackup} /></> : "on, none made yet") : "off"}
{match.snapshots > 0 && <span className="text-secondary small"> · {match.snapshots} snapshot{match.snapshots === 1 ? "" : "s"}</span>}
</div>
<div className="col-6 col-lg-3">
<div className="text-secondary small">Traffic this month</div>
<TrafficBar used={s.outgoingTraffic} included={s.includedTraffic} />
</div>
</div>
<div className="text-secondary small mt-2">
{match.fresh ? <>read <TimeAgo value={match.updatedAt} /></> : "Hetzner could not be read lately — this is how it was"}
</div>
</div>
</div>
);
}