Duplicati: flag warnings run after run, and forecast how much room backups take
A job whose last three runs in a row all finished with warnings is flagged and raises an alert (on by default, switchable off per job). The size of the destination, and its quota where the storage says, are read from the reports and kept with each run; the Stored column shows the growth and, where the room is known, when it will be full, with an alert inside the disk-forecast window. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
333146e8e3
commit
4f077d4f4a
15 files changed
+10115
-14
No files matched your search
@@ -89,6 +89,7 @@ function History({ backup, onClose }: { backup: DuplicatiBackup; onClose: () =>
|
||||
<th>Result</th>
|
||||
<th className="text-end">Took</th>
|
||||
<th className="text-end">Size</th>
|
||||
<th className="text-end" title={t("How much the backups take up where they are kept")}>{t("Stored")}</th>
|
||||
<th className="text-end">Changed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -109,6 +110,7 @@ function History({ backup, onClose }: { backup: DuplicatiBackup; onClose: () =>
|
||||
</td>
|
||||
<td className="text-end">{took(r.durationSeconds)}</td>
|
||||
<td className="text-end">{r.sizeBytes === null ? "—" : formatBytes(r.sizeBytes)}</td>
|
||||
<td className="text-end">{r.destinationBytes === null ? "—" : formatBytes(r.destinationBytes)}</td>
|
||||
<td className="text-end">{r.filesChanged === null ? "—" : r.filesChanged.toLocaleString()}</td>
|
||||
</tr>
|
||||
))}
|
||||
@@ -157,6 +159,26 @@ function Activity({ s }: { s: DuplicatiSource }) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* How much a backup takes up where it is kept, and — once there is enough history to say — how that is growing: "+3.4 GB a month", "not growing", and, where the storage says how much room it has,
|
||||
* how long until it is full. Nothing is claimed from too little history.
|
||||
*/
|
||||
function stored(b: DuplicatiBackup, forecastDays: number) {
|
||||
if (b.destinationBytes === null) return <span className="text-secondary">—</span>;
|
||||
const g = b.growth;
|
||||
const small = g !== null && Math.abs(g.perMonth) < Math.max(b.destinationBytes * 0.005, 1e6);
|
||||
return (
|
||||
<>
|
||||
{formatBytes(b.destinationBytes)}
|
||||
{b.quotaBytes !== null && <span className="text-secondary small"> {t("of {total}", { total: formatBytes(b.quotaBytes) })}</span>}
|
||||
{g && g.fit >= 0.8 && !small && <div className="text-secondary small">{g.perMonth > 0 ? t("+{size} a month", { size: formatBytes(g.perMonth) }) : t("−{size} a month", { size: formatBytes(-g.perMonth) })}</div>}
|
||||
{g && small && <div className="text-secondary small">{t("not growing")}</div>}
|
||||
{g && g.fit < 0.8 && !small && <div className="text-secondary small">{t("size goes up and down")}</div>}
|
||||
{g && g.daysToFull !== null && g.fit >= 0.8 && <div className={g.daysToFull <= forecastDays ? "text-red small" : "text-secondary small"}>{t("full in about {n} days", { n: g.daysToFull })}</div>}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** What to paste into Duplicati, shown once after a machine is added. */
|
||||
function Address({ path, name, onDone }: { path: string; name: string; onDone: () => void }) {
|
||||
const url = `${window.location.origin}${path}`;
|
||||
@@ -238,7 +260,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
}
|
||||
|
||||
async function patch(b: DuplicatiBackup, change: { expectedHours?: number; alert?: boolean; alertWarnings?: boolean }) {
|
||||
async function patch(b: DuplicatiBackup, change: { expectedHours?: number; alert?: boolean; alertWarnings?: boolean; warnStreakAlert?: boolean }) {
|
||||
try {
|
||||
await api.duplicati.updateBackup(b.id, change);
|
||||
load();
|
||||
@@ -377,6 +399,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<th>Last good backup</th>
|
||||
<th className="text-end">Took</th>
|
||||
<th className="text-end">Size</th>
|
||||
<th className="text-end" title={t("How much the backups take up where they are kept, and how that is growing")}>{t("Stored")}</th>
|
||||
<th className="text-end">Changed</th>
|
||||
<th>Expected every</th>
|
||||
<th>State</th>
|
||||
@@ -400,6 +423,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
</td>
|
||||
<td className="text-end">{took(b.durationSeconds)}</td>
|
||||
<td className="text-end">{b.sizeBytes === null ? "—" : formatBytes(b.sizeBytes)}</td>
|
||||
<td className="text-end">{stored(b, data.forecastDays)}</td>
|
||||
<td className="text-end">{b.addedFiles === null && b.modifiedFiles === null && b.deletedFiles === null ? "—" : ((b.addedFiles ?? 0) + (b.modifiedFiles ?? 0) + (b.deletedFiles ?? 0)).toLocaleString()}</td>
|
||||
<td>
|
||||
{canEdit ? (
|
||||
@@ -420,6 +444,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
{b.problem && <div className="text-secondary small">{b.problem}</div>}
|
||||
{b.state === "warning" && !b.problem && <Warnings count={b.warnings} messages={b.warningMessages} label={`${b.warnings} warning${b.warnings === 1 ? "" : "s"} in the last run`} />}
|
||||
{b.problem && b.state === "warning" && <Warnings count={b.warnings} messages={b.warningMessages} label="All the warnings" />}
|
||||
{b.warningStreak >= data.streakRuns && <div className="text-yellow small">{t("Warnings {n} runs in a row", { n: b.warningStreak })}</div>}
|
||||
{!b.alert && <div className="text-secondary small">no alert</div>}
|
||||
{b.alert && b.alertWarnings && <div className="text-secondary small">alerts on warnings</div>}
|
||||
</td>
|
||||
@@ -433,6 +458,11 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { alert: !b.alert })}>
|
||||
{b.alert ? "Mute" : "Alert"}
|
||||
</button>
|
||||
{b.alert && !b.alertWarnings && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { warnStreakAlert: !b.warnStreakAlert })} title={t("Whether {n} runs in a row with warnings raise an alert (on unless you switch it off; a job that always has a few warnings can be left alone)", { n: data.streakRuns })}>
|
||||
{b.warnStreakAlert ? t("Stop streak alerts") : t("Alert on streaks")}
|
||||
</button>
|
||||
)}
|
||||
{b.alert && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { alertWarnings: !b.alertWarnings })} title="Whether a run that finishes with warnings raises an alert (it counts as a good backup either way)">
|
||||
{b.alertWarnings ? "Stop warning alerts" : "Alert on warnings"}
|
||||
|
||||
Reference in new issue
Block a user