Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Add agent-id support to host agent installers (Related to #721)
rcourtmanf8e59839bad5
diff --git a/docs/HOST_AGENT.md b/docs/HOST_AGENT.mdindex 3b9e81c39a..c8f2f14b03 100644--- a/docs/HOST_AGENT.md+++ b/docs/HOST_AGENT.md@@ -201,6 +201,18 @@ Start-Service -Name PulseHostAgentRun `pulse-host-agent --help` for the full list.+## Avoiding ID collisions++Pulse keys hosts on the identifier supplied by the agent (machine-id by default). Cloned systems frequently share `/etc/machine-id`, which makes Pulse alternate a single row between multiple machines. Keep the ID unique by regenerating the machine-id on each clone or by providing an explicit `--agent-id`/`PULSE_AGENT_ID` when installing:++```bash+sudo rm /etc/machine-id /var/lib/dbus/machine-id+sudo systemd-machine-id-setup+sudo systemctl restart pulse-host-agent+```++Re-running the installer with `--agent-id <unique-name>` achieves the same result if regenerating the machine-id is undesirable.+## Viewing Hosts- **Settings → Agents → Host agents** lists every reporting host and provides ready-made install commands.diff --git a/scripts/install-host-agent.ps1 b/scripts/install-host-agent.ps1index 09b8a339b4..ad2aecd365 100644--- a/scripts/install-host-agent.ps1+++ b/scripts/install-host-agent.ps1@@ -11,6 +11,7 @@ param([string]$PulseUrl = $env:PULSE_URL,[string]$Token = $env:PULSE_TOKEN,[string]$Interval = $env:PULSE_INTERVAL,+ [string]$AgentId = $env:PULSE_AGENT_ID,[string]$InstallPath = "C:\Program Files\Pulse",[string]$Arch = $env:PULSE_ARCH,[switch]$NoService@@ -251,6 +252,7 @@ if (-not $Interval) {PulseInfo "Configuration:"Write-Host " Pulse URL: $PulseUrl"Write-Host " Token: $(if ($Token) { '***' + $Token.Substring([Math]::Max(0, $Token.Length - 4)) } else { 'none' })"+Write-Host " Agent ID: $(if ($AgentId) { $AgentId } else { 'machine-id (default)' })"Write-Host " Interval: $Interval"Write-Host " Install Path: $InstallPath"if ($Arch) {@@ -381,6 +383,9 @@ try {if ($Token) {$agentArgs += @("--token", "`"$Token`"")}+ if ($AgentId) {+ $agentArgs += @("--agent-id", "`"$AgentId`"")+ }$serviceBinaryPath = "`"$agentPath`" $($agentArgs -join ' ')"$manualCommand = "& `"$agentPath`" $($agentArgs -join ' ')"} catch {@@ -397,6 +402,9 @@ $config = @{if ($Token) {$config.token = $Token}+if ($AgentId) {+ $config.agentId = $AgentId+}$config | ConvertTo-Json | Set-Content $configPathPulseSuccess "Created configuration at $configPath"diff --git a/scripts/install-host-agent.sh b/scripts/install-host-agent.shindex ca292ddc1b..0e9794a576 100755--- a/scripts/install-host-agent.sh+++ b/scripts/install-host-agent.sh@@ -71,6 +71,7 @@ KEYCHAIN_ENABLED=trueKEYCHAIN_OPT_OUT=falseKEYCHAIN_OPT_OUT_REASON=""USE_KEYCHAIN=false+AGENT_ID="${PULSE_AGENT_ID:-}"while [[ $# -gt 0 ]]; docase "$1" in@@ -86,6 +87,10 @@ while [[ $# -gt 0 ]]; doINTERVAL="$2"shift 2;;+ --agent-id)+ AGENT_ID="$2"+ shift 2+ ;;--platform)PLATFORM="$2"shift 2@@ -162,9 +167,10 @@ fiif [[ -z "$PULSE_URL" ]]; thenlog_error "Pulse URL is required"- echo "Usage: $0 --url <pulse-url> --token <api-token> [--interval 30s] [--platform linux|darwin|windows] [--force] [--no-keychain]"+ echo "Usage: $0 --url <pulse-url> --token <api-token> [--interval 30s] [--agent-id <id>] [--platform linux|darwin|windows] [--force] [--no-keychain]"echo ""echo " --force Skip interactive prompts and accept secure defaults (including Keychain storage)."+ echo " --agent-id Override the identifier used to deduplicate hosts (defaults to machine-id)."echo " --no-keychain Disable Keychain storage and embed the token in the launch agent plist instead."exit 1fi@@ -234,6 +240,11 @@ if [[ -n "$PULSE_TOKEN" ]]; thenelseecho " Token: none"fi+if [[ -n "$AGENT_ID" ]]; then+ echo " Agent ID: $AGENT_ID"+else+ echo " Agent ID: machine-id (default)"+fiecho " Interval: $INTERVAL"echo " Platform: $PLATFORM/$ARCH"echo ""@@ -406,6 +417,9 @@ if [[ -n "$PULSE_TOKEN" ]]; thenAGENT_CMD="$AGENT_CMD --token $PULSE_TOKEN"fiAGENT_CMD="$AGENT_CMD --interval $INTERVAL"+if [[ -n "$AGENT_ID" ]]; then+ AGENT_CMD="$AGENT_CMD --agent-id $AGENT_ID"+fiMANUAL_START_CMD="$AGENT_CMD"MANUAL_START_WRAPPED="nohup $MANUAL_START_CMD >$LINUX_LOG_FILE 2>&1 &"@@ -529,6 +543,12 @@ elif [[ "$PLATFORM" == "darwin" ]] && command -v launchctl &> /dev/null; thenUSE_KEYCHAIN=falsefi+ LAUNCHD_AGENT_ID_ARGS=""+ if [[ -n "$AGENT_ID" ]]; then+ LAUNCHD_AGENT_ID_ARGS=" <string>--agent-id</string>+ <string>$AGENT_ID</string>"+ fi+# Create wrapper script if using Keychainif [[ "$USE_KEYCHAIN" == true ]]; thenWRAPPER_SCRIPT="/usr/local/bin/pulse-host-agent-wrapper.sh"@@ -588,6 +608,7 @@ WRAPPER_EOF<string>$PULSE_URL</string><string>--interval</string><string>$INTERVAL</string>+$LAUNCHD_AGENT_ID_ARGS</array><key>RunAtLoad</key><true/>@@ -619,6 +640,7 @@ EOF<string>$PULSE_TOKEN</string><string>--interval</string><string>$INTERVAL</string>+$LAUNCHD_AGENT_ID_ARGS</array><key>RunAtLoad</key><true/>