Agent diagnostics ("what the agent couldn't collect") and services to ignore per server

- Agents (Linux 6, Windows 5) note each check they couldn't make and why; the server page turns that into tips and fixes, including when the agent is behind
- Linux --prepare leaves its notes for the report; a missing prepare step is itself noted
- Services to ignore are set per server from the Host health card (names or * patterns), applied on the server so alerts and /metrics drop them at once; saving alert limits keeps the list

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 22:16:31 +02:00
1 parent b5384c1e03
commit c3bc6bbf72
26 files changed
+4118 -45

No files matched your search

+18 -2
View File
@@ -32,9 +32,9 @@ function run(snippet: string): unknown {
}
describe("the Windows agent's health parts", { skip: !havePwsh }, () => {
test("it says it is version 4, and stays plain ASCII", () => {
test("it says it is version 5, and stays plain ASCII", () => {
const text = readFileSync(script, "utf8");
assert.match(text, /^\$script:AgentVersion = 4\s*$/m);
assert.match(text, /^\$script:AgentVersion = 5\s*$/m);
assert.ok(!/[^\x00-\x7f]/.test(text));
});
@@ -103,6 +103,22 @@ describe("the Windows agent's health parts", { skip: !havePwsh }, () => {
assert.deepEqual(out.map((p) => [p.name, p.health, p.capacity_percent]), [["Media", "ONLINE", 25], ["Backups", "DEGRADED", 90], ["Broken", "FAULTED", null]]);
});
test("what could not be read is noted, with a word for why and at most a line of what Windows said", () => {
const out = run(`
function Get-CimInstance { throw "WMI is unhappy\`r\`nsecond line" }
$WarningPreference = 'SilentlyContinue'
$null = Get-HostHealth @{ IgnoreServices = @() }
Add-Diag 'hardware' 'unavailable' 'not_found'
Add-Diag 'updates' 'failed' 'error' ('x' * 400)
ConvertTo-Json -InputObject @{ items = @($script:Diag) } -Depth 4 -Compress
`) as { items: { check: string; status: string; reason?: string; detail?: string }[] };
const byCheck = Object.fromEntries(out.items.map((i) => [i.check, i]));
assert.deepEqual([byCheck.failed_units.status, byCheck.failed_units.reason], ["failed", "error"]);
assert.equal(byCheck.failed_units.detail, "WMI is unhappy second line", "line breaks are flattened");
assert.deepEqual(byCheck.hardware, { check: "hardware", status: "unavailable", reason: "not_found" }, "nothing to say about it, no detail");
assert.equal(byCheck.updates.detail!.length, 160, "cut to a line");
});
test("a maker's placeholders aren't a model or a serial number", () => {
const out = run(`
$t = @('To Be Filled By O.E.M.', 'Default string', 'System Serial Number', 'System Product Name', '0000000', ' ', 'None', 'Unknown', 'ASUS', 'ROG STRIX B560-F', 'PF2ABCDE', '0A1B')