Add a weekly digest and report which version of the agent each server runs
- Weekly digest through the notification channels: alerts now, a week of uptime, what happened, disks heading for full, expiring secrets and domains, updates waiting, planned maintenance. Off until switched on in Settings -> Notifications; Preview and Send it now there. Setting key 'digest'. - Agents say their version in every report (Linux and Windows scripts are version 2); the server compares it with the scripts it serves and marks agents that are behind on the Servers, server and Updates pages. servers.agent_version, migration 0026. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3da5c639b1
commit
aa94d84f6c
28 files changed
+3179
-19
No files matched your search
@@ -10,6 +10,11 @@
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
# Which version of this script this is, sent with every report so Homelab Manager can tell which agents are behind. Raise it whenever a
|
||||
# change here is worth installing the agent again for (and add it to the list at the top of server/src/services/agentVersions.ts).
|
||||
# 1 = before the number was reported 2 = reports pending updates, and its own version
|
||||
AGENT_VERSION=2
|
||||
|
||||
ENV_FILE="${ENV_FILE:-/etc/homelab-manager-agent.env}"
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
@@ -333,9 +338,10 @@ PAYLOAD=$(jq -n \
|
||||
--arg hostname "$HOSTNAME_VALUE" \
|
||||
--arg os_type "linux" \
|
||||
--arg reported_at "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
|
||||
--argjson agent_version "$AGENT_VERSION" \
|
||||
--argjson system "$SYSTEM_JSON" \
|
||||
--argjson tasks "$TASKS_JSON" \
|
||||
'{hostname: $hostname, os_type: $os_type, reported_at: $reported_at, system: $system, tasks: $tasks}')
|
||||
'{hostname: $hostname, os_type: $os_type, reported_at: $reported_at, agent_version: $agent_version, system: $system, tasks: $tasks}')
|
||||
|
||||
if [[ "$DRY_RUN" == "1" ]]; then
|
||||
echo "$PAYLOAD" | jq .
|
||||
|
||||
@@ -31,6 +31,10 @@ param(
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Which version of this script this is, sent with every report so Homelab Manager can tell which agents are behind. Raise it whenever a
|
||||
# change here is worth installing the agent again for. 1 = before the number was reported 2 = reports pending updates, and its own version
|
||||
$script:AgentVersion = 2
|
||||
|
||||
$script:DefaultConfigPath = Join-Path $env:ProgramData 'HomelabManager\agent.json'
|
||||
|
||||
# ---- configuration ------------------------------------------------------------
|
||||
@@ -374,6 +378,7 @@ function Invoke-Agent {
|
||||
hostname = Get-Fqdn
|
||||
os_type = 'windows'
|
||||
reported_at = (Get-Date).ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss'Z'")
|
||||
agent_version = $script:AgentVersion
|
||||
system = $system
|
||||
tasks = @($tasks)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user