Racks, notes and to-do, OS support, suggested dependencies, Nginx Proxy Manager and Home Assistant
- Racks page and a network diagram (UniFi tree with servers, printable) - Notes on servers and devices; To do list shown in Coming up and My work - Agents report the operating system (Linux 7, Windows 6); end-of-life badge and alert - Suggested dependencies from where a service is reached - Nginx Proxy Manager integration: proxy hosts page, certificate and host alerts, suggested checks - Home Assistant integration: watch chosen entities, history chart, limit and unavailable alerts - TimeChart gets a "value" scale that fits negatives; docs updated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68b41b5586
commit
18ceed62e8
77 files changed
+20432
-35
No files matched your search
@@ -17,7 +17,7 @@ set -euo pipefail
|
||||
# 4 = also reports failed services, disk health (SMART) and ZFS pools, reads pacman, and can update itself when told to
|
||||
# 5 = also says what the machine is (maker, model, serial number), from the firmware, for the inventory
|
||||
# 6 = also says what it could not collect and why (no smartctl, no systemd, a package manager that failed ...), so the server can say what to fix
|
||||
AGENT_VERSION=6
|
||||
AGENT_VERSION=7
|
||||
|
||||
ENV_FILE="${ENV_FILE:-/etc/homelab-manager-agent.env}"
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
@@ -356,6 +356,30 @@ collect_hardware() {
|
||||
'{} | (if $maker != "" then . + {manufacturer: $maker} else . end) | (if $model != "" then . + {model: $model} else . end) | (if $serial != "" then . + {serial: $serial} else . end)') || HARDWARE_JSON="null"
|
||||
}
|
||||
|
||||
# What the machine runs, as /etc/os-release says (OS_RELEASE_FILE is for the tests): the distribution's id and version, so the app can say when that release stops
|
||||
# being supported. Proxmox VE is Debian underneath, so it is asked by its own command. "null" when there is nothing to say.
|
||||
collect_os() {
|
||||
OS_JSON="null"
|
||||
local file="${OS_RELEASE_FILE:-/etc/os-release}" id="" version="" pretty=""
|
||||
if [[ -r "$file" ]]; then
|
||||
id=$(sed -n 's/^ID=//p' "$file" | head -n 1 | tr -d '"' | tr 'A-Z' 'a-z' | head -c 40)
|
||||
version=$(sed -n 's/^VERSION_ID=//p' "$file" | head -n 1 | tr -d '"' | head -c 40)
|
||||
pretty=$(sed -n 's/^PRETTY_NAME=//p' "$file" | head -n 1 | tr -d '"' | head -c 80)
|
||||
fi
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
local pve
|
||||
pve=$(pveversion 2>/dev/null | sed -n 's#^pve-manager/\([0-9]*\.[0-9]*\).*#\1#p' | head -n 1)
|
||||
if [[ -n "$pve" ]]; then
|
||||
id="proxmox-ve"
|
||||
version="$pve"
|
||||
pretty="Proxmox VE $pve"
|
||||
fi
|
||||
fi
|
||||
[[ -n "$id" ]] || return 0
|
||||
OS_JSON=$(jq -n -c --arg id "$id" --arg version "$version" --arg name "$pretty" \
|
||||
'{id: $id} | (if $version != "" then . + {version: $version} else . end) | (if $name != "" then . + {name: $name} else . end)') || OS_JSON="null"
|
||||
}
|
||||
|
||||
# Services (systemd units) that have failed. systemctl is asked the way the timers are, so this works inside the sandbox.
|
||||
collect_failed_units() {
|
||||
FAILED_UNITS_JSON="null"
|
||||
@@ -604,6 +628,8 @@ collect_system_info() {
|
||||
fi
|
||||
HARDWARE_JSON="null"
|
||||
collect_hardware || HARDWARE_JSON="null"
|
||||
OS_JSON="null"
|
||||
collect_os || OS_JSON="null"
|
||||
collect_diagnostics
|
||||
HEALTH_JSON=$(jq -n -c --argjson failed "$FAILED_UNITS_JSON" --argjson smart "$SMART_JSON" --argjson zfs "$ZFS_JSON" \
|
||||
'{} | (if $failed != null then . + {failed_units: $failed} else . end) | (if $smart != null then . + {smart: $smart} else . end) | (if $zfs != null then . + {zfs: $zfs} else . end)') || HEALTH_JSON="{}"
|
||||
@@ -613,6 +639,7 @@ collect_system_info() {
|
||||
--argjson updates "$UPDATES_JSON" \
|
||||
--argjson health "$HEALTH_JSON" \
|
||||
--argjson hardware "$HARDWARE_JSON" \
|
||||
--argjson os "$OS_JSON" \
|
||||
--argjson diagnostics "$DIAGNOSTICS_JSON" \
|
||||
--argjson ip_addresses "$ip_json" \
|
||||
--argjson listening_ports "$ports_json" \
|
||||
@@ -631,6 +658,7 @@ collect_system_info() {
|
||||
updates: $updates,
|
||||
health: $health,
|
||||
hardware: $hardware,
|
||||
os: $os,
|
||||
diagnostics: $diagnostics
|
||||
}')
|
||||
}
|
||||
@@ -652,6 +680,9 @@ if [[ "$MODE" != "report" ]]; then
|
||||
echo "ZFS pools (null means there is no zpool here):"
|
||||
jq . <<<"$ZFS_JSON"
|
||||
collect_hardware || true
|
||||
collect_os || true
|
||||
echo "What it runs (null means there is no os-release to read):"
|
||||
jq . <<<"$OS_JSON"
|
||||
echo "What could not be collected (empty means nothing was missed):"
|
||||
diag_json | jq .
|
||||
self_update
|
||||
|
||||
Reference in new issue
Block a user