Nextcloud, NetBox and n8n integrations
Three read-only integrations, each with a monitoring page, alerts, maintenance silencing and held-when-unreadable handling. Nextcloud: database needing upgrade (critical), maintenance mode, and the data disk running low; users, files and app updates with an admin app password. NetBox: no background worker running, counts, and a list of the servers this app manages that have no address in NetBox (a list, not an alert). n8n: an active workflow whose last run failed, clearing when it next succeeds. Disk messages for Immich, Paperless and Nextcloud now use the same units as the pages that show them. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a16996d975
commit
4ff0b44943
46 files changed
+10137
-10
No files matched your search
@@ -34,6 +34,9 @@ const TYPE_LABELS: Record<IntegrationType, string> = {
|
||||
prometheus: "Prometheus",
|
||||
immich: "Immich",
|
||||
paperless: "Paperless-ngx",
|
||||
n8n: "n8n",
|
||||
netbox: "NetBox",
|
||||
nextcloud: "Nextcloud",
|
||||
};
|
||||
|
||||
/** The page each kind of integration gets once it is connected. */
|
||||
@@ -57,6 +60,9 @@ const TYPE_PAGES: Record<IntegrationType, string> = {
|
||||
prometheus: "/prometheus",
|
||||
immich: "/immich",
|
||||
paperless: "/paperless",
|
||||
n8n: "/n8n",
|
||||
netbox: "/netbox",
|
||||
nextcloud: "/nextcloud",
|
||||
};
|
||||
|
||||
/** "pve.example.lan" out of "https://pve.example.lan:8006/", or the text itself when it isn't an address. */
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api, type N8nInfo } 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({ n }: { n: N8nInfo }) {
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!n.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
|
||||
if (!n.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (n.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>;
|
||||
}
|
||||
|
||||
const failed = (status: string | null) => status === "error" || status === "crashed";
|
||||
|
||||
function LastRun({ status, at }: { status: string | null; at: string | null }) {
|
||||
if (!status || !at) return <span className="text-secondary">no run seen</span>;
|
||||
return (
|
||||
<>
|
||||
<span className={`badge ${failed(status) ? "bg-red-lt text-red" : status === "success" ? "bg-green-lt text-green" : "bg-secondary-lt text-secondary"}`}>{failed(status) ? (status === "crashed" ? "Crashed" : "Failed") : status === "success" ? "Succeeded" : status}</span>{" "}
|
||||
<span className="text-secondary">
|
||||
<TimeAgo value={at} />
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Card({ n }: { n: N8nInfo }) {
|
||||
const s = n.state;
|
||||
const workflows = s ? [...s.workflows].sort((a, b) => Number(failed(b.lastStatus) && b.active) - Number(failed(a.lastStatus) && a.active) || Number(b.active) - Number(a.active) || a.name.localeCompare(b.name)) : [];
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">
|
||||
{n.name} <Badge n={n} />
|
||||
</h3>
|
||||
<div className="card-actions text-secondary small">{n.status ? <>read <TimeAgo value={n.status.at} /></> : "not read yet"}</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{n.status && !n.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {n.status.error ?? "no answer"}.</div>}
|
||||
{n.problems.length > 0 && (
|
||||
<ul className="mb-3">
|
||||
{n.problems.map((x) => (
|
||||
<li key={x.key}>{x.message}</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
{s && (
|
||||
<>
|
||||
{!s.executionsKnown && <div className="text-yellow mb-2">n8n did not give its runs, so what each workflow last did is not known.</div>}
|
||||
<div className="text-secondary small mb-2">
|
||||
{s.workflows.length} workflow{s.workflows.length === 1 ? "" : "s"}, {s.workflows.filter((w) => w.active).length} switched on — judged from the newest 250 runs
|
||||
</div>
|
||||
{workflows.length === 0 ? (
|
||||
<div className="text-secondary">No workflows.</div>
|
||||
) : (
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Workflow</th>
|
||||
<th>On</th>
|
||||
<th>Last run</th>
|
||||
<th className="text-end">Failed in the last day</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{workflows.map((w) => (
|
||||
<tr key={w.id} className={w.active ? "" : "text-secondary"}>
|
||||
<td>{w.name}</td>
|
||||
<td>{w.active ? "yes" : "off"}</td>
|
||||
<td>{s.executionsKnown ? <LastRun status={w.lastStatus} at={w.lastAt} /> : "—"}</td>
|
||||
<td className={`text-end ${w.failed24h > 0 ? "text-red fw-bold" : ""}`}>{w.failed24h}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** n8n: which automations have quietly stopped working — an active workflow whose last run failed. */
|
||||
export default function N8n() {
|
||||
const [data, setData] = useState<N8nInfo[] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
const load = () =>
|
||||
api.n8n
|
||||
.list()
|
||||
.then((r) => {
|
||||
setData(r.n8ns);
|
||||
setError(null);
|
||||
})
|
||||
.catch((err) => setError(readableError(err)));
|
||||
void load();
|
||||
const t = setInterval(load, 60_000);
|
||||
return () => clearInterval(t);
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">n8n</h2>
|
||||
<p className="text-secondary">
|
||||
Which automations have quietly stopped working. It is read every few minutes with an API key (see <Link to="/integrations">Integrations</Link>). A <strong>workflow that is switched on and failed on its last run</strong> is an alert — see <Link to="/alerts">Alerts</Link>; it clears when the workflow next succeeds.
|
||||
</p>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={4} />}
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No n8n connected" hint="Add one under Integrations with its address and an API key (Settings → n8n API)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{data?.map((n) => <Card key={n.id} n={n} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api, type NetBoxInfo } 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({ n }: { n: NetBoxInfo }) {
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!n.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
|
||||
if (!n.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (n.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>;
|
||||
}
|
||||
|
||||
const count = (v: number | null) => (v === null ? "—" : v.toLocaleString());
|
||||
|
||||
function Tile({ label, value, bad }: { label: string; value: string; bad?: 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 ${bad ? "text-red" : ""}`}>{value}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Card({ n }: { n: NetBoxInfo }) {
|
||||
const s = n.state;
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">
|
||||
{n.name} <Badge n={n} />
|
||||
</h3>
|
||||
<div className="card-actions text-secondary small">{n.status ? <>read <TimeAgo value={n.status.at} /></> : "not read yet"}</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{n.status && !n.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {n.status.error ?? "no answer"}.</div>}
|
||||
{n.problems.length > 0 && (
|
||||
<ul className="mb-3">
|
||||
{n.problems.map((x) => (
|
||||
<li key={x.key}>{x.message}</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
{s && (
|
||||
<>
|
||||
<div className="text-secondary small mb-3">{s.version ? `version ${s.version}` : ""}</div>
|
||||
<div className="row g-3 mb-3">
|
||||
<Tile label="Workers running" value={count(s.workersRunning)} bad={s.workersRunning === 0} />
|
||||
<Tile label="Devices" value={count(s.devices)} />
|
||||
<Tile label="Virtual machines" value={count(s.virtualMachines)} />
|
||||
<Tile label="IP addresses" value={count(s.ipAddresses)} />
|
||||
</div>
|
||||
|
||||
<h4>Servers with no address in NetBox</h4>
|
||||
{s.missing === null ? (
|
||||
<div className="text-secondary">NetBox’s addresses could not be listed, so nothing can be said about what is missing.</div>
|
||||
) : s.missing.length === 0 ? (
|
||||
<div className="text-secondary">Every server this app manages has an address in NetBox.</div>
|
||||
) : (
|
||||
<>
|
||||
<ul className="mb-2">
|
||||
{s.missing.map((m) => (
|
||||
<li key={m.id}>
|
||||
<Link to={`/servers/${m.id}`}>{m.name}</Link> <span className="text-secondary">({m.ips.slice(0, 3).join(", ")}{m.ips.length > 3 ? ", …" : ""})</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div className="text-secondary small">
|
||||
A list, not an alert: documentation that is behind is not an outage.{s.truncated ? " NetBox has more addresses than were read, so some of these may be in the part that was not." : ""}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** NetBox: whether it is working — above all its background workers — and which of the servers you run are not written down in it. */
|
||||
export default function NetBox() {
|
||||
const [data, setData] = useState<NetBoxInfo[] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
const load = () =>
|
||||
api.netbox
|
||||
.list()
|
||||
.then((r) => {
|
||||
setData(r.netboxes);
|
||||
setError(null);
|
||||
})
|
||||
.catch((err) => setError(readableError(err)));
|
||||
void load();
|
||||
const t = setInterval(load, 60_000);
|
||||
return () => clearInterval(t);
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">NetBox</h2>
|
||||
<p className="text-secondary">
|
||||
Whether NetBox is working, and whether it is complete. It is read every few minutes with an API token (see <Link to="/integrations">Integrations</Link>). <strong>No background worker running</strong> is an alert — see <Link to="/alerts">Alerts</Link>; the servers missing from NetBox are only listed.
|
||||
</p>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={4} />}
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No NetBox connected" hint="Add one under Integrations with its address and an API token (your profile → API Tokens; read-only is enough)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{data?.map((n) => <Card key={n.id} n={n} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api, type NextcloudInfo } from "../api/client";
|
||||
import EmptyState from "../components/EmptyState";
|
||||
import TimeAgo from "../components/TimeAgo";
|
||||
import { BlockSkeleton } from "../components/Skeleton";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { formatBytes } from "./settings/StorageSettings";
|
||||
import { readableError } from "../utils/errors";
|
||||
|
||||
function Badge({ n }: { n: NextcloudInfo }) {
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!n.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
|
||||
if (!n.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (n.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
|
||||
if (n.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>;
|
||||
}
|
||||
|
||||
const count = (v: number | null) => (v === null ? "—" : v.toLocaleString());
|
||||
|
||||
function Card({ n }: { n: NextcloudInfo }) {
|
||||
const s = n.state;
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">
|
||||
{n.name} <Badge n={n} />
|
||||
</h3>
|
||||
<div className="card-actions text-secondary small">{n.status ? <>read <TimeAgo value={n.status.at} /></> : "not read yet"}</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{n.status && !n.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {n.status.error ?? "no answer"}.</div>}
|
||||
{n.problems.length > 0 && (
|
||||
<ul className="mb-3">
|
||||
{n.problems.map((x) => (
|
||||
<li key={x.key} className={x.severity === "critical" ? "text-red" : ""}>
|
||||
{x.message}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
{s && (
|
||||
<>
|
||||
<div className="text-secondary small mb-3">
|
||||
{[s.version ? `version ${s.version}` : null, s.maintenance ? "in maintenance mode" : null, s.needsUpgrade ? "needs its database upgrading" : null].filter(Boolean).join(" · ")}
|
||||
</div>
|
||||
{s.detail ? (
|
||||
<div className="row g-3">
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Free for data</div>
|
||||
<div className="h2 mb-0">{s.freeBytes === null ? "—" : formatBytes(s.freeBytes)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Users</div>
|
||||
<div className="h2 mb-0">{count(s.users)}</div>
|
||||
<div className="text-secondary small">{s.active24h === null ? "" : `${s.active24h} active in the last day`}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Files</div>
|
||||
<div className="h2 mb-0">{count(s.files)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">App updates waiting</div>
|
||||
<div className="h2 mb-0">{count(s.appUpdates)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-secondary">
|
||||
Only its status is read. Give the integration an administrator’s name and an <strong>app password</strong> (Personal settings → Security → Devices & sessions) and the room left for the data, the users and the app updates are read too.
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Nextcloud: whether people can sign in — maintenance mode, a database that wants upgrading — and how much room is left for the data. */
|
||||
export default function Nextcloud() {
|
||||
const [data, setData] = useState<NextcloudInfo[] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
const load = () =>
|
||||
api.nextcloud
|
||||
.list()
|
||||
.then((r) => {
|
||||
setData(r.nextclouds);
|
||||
setError(null);
|
||||
})
|
||||
.catch((err) => setError(readableError(err)));
|
||||
void load();
|
||||
const t = setInterval(load, 60_000);
|
||||
return () => clearInterval(t);
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">Nextcloud</h2>
|
||||
<p className="text-secondary">
|
||||
Whether people can sign in. It is read every few minutes (see <Link to="/integrations">Integrations</Link>). <strong>Maintenance mode left on</strong>, <strong>a database that wants upgrading</strong> and <strong>the data disk running low</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 Nextcloud connected" hint="Add one under Integrations with its address; an administrator's name and an app password add the disk, the users and the app updates." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{data?.map((n) => <Card key={n.id} n={n} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -32,6 +32,9 @@ const INTEGRATION_NAMES: Record<string, string> = {
|
||||
prometheus: "Prometheus",
|
||||
immich: "Immich",
|
||||
paperless: "Paperless-ngx",
|
||||
n8n: "n8n",
|
||||
netbox: "NetBox",
|
||||
nextcloud: "Nextcloud",
|
||||
};
|
||||
|
||||
function ColorList({
|
||||
|
||||
Reference in new issue
Block a user