Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

feat(agent): add option to disable Docker update checks

rcourtmane3b3785582ed
diff --git a/cmd/pulse-agent/main.go b/cmd/pulse-agent/main.go
index 0cc3b6107a..10e7ee4942 100644
--- a/cmd/pulse-agent/main.go
+++ b/cmd/pulse-agent/main.go
@@ -174,22 +174,23 @@ func main() {
var dockerAgent *dockeragent.Agent
if cfg.EnableDocker {
dockerCfg := dockeragent.Config{
- PulseURL: cfg.PulseURL,
- APIToken: cfg.APIToken,
- Interval: cfg.Interval,
- HostnameOverride: cfg.HostnameOverride,
- AgentID: cfg.AgentID,
- AgentType: "unified",
- AgentVersion: Version,
- InsecureSkipVerify: cfg.InsecureSkipVerify,
- DisableAutoUpdate: cfg.DisableAutoUpdate,
- LogLevel: cfg.LogLevel,
- Logger: &logger,
- SwarmScope: "node",
- IncludeContainers: true,
- IncludeServices: true,
- IncludeTasks: true,
- CollectDiskMetrics: false,
+ PulseURL: cfg.PulseURL,
+ APIToken: cfg.APIToken,
+ Interval: cfg.Interval,
+ HostnameOverride: cfg.HostnameOverride,
+ AgentID: cfg.AgentID,
+ AgentType: "unified",
+ AgentVersion: Version,
+ InsecureSkipVerify: cfg.InsecureSkipVerify,
+ DisableAutoUpdate: cfg.DisableAutoUpdate,
+ DisableUpdateChecks: cfg.DisableDockerUpdateChecks,
+ LogLevel: cfg.LogLevel,
+ Logger: &logger,
+ SwarmScope: "node",
+ IncludeContainers: true,
+ IncludeServices: true,
+ IncludeTasks: true,
+ CollectDiskMetrics: false,
}
dockerAgent, err = dockeragent.New(dockerCfg)
@@ -218,17 +219,17 @@ func main() {
// 10. Start Kubernetes Agent (if enabled)
if cfg.EnableKubernetes {
kubeCfg := kubernetesagent.Config{
- PulseURL: cfg.PulseURL,
- APIToken: cfg.APIToken,
- Interval: cfg.Interval,
- AgentID: cfg.AgentID,
- AgentType: "unified",
- AgentVersion: Version,
- InsecureSkipVerify: cfg.InsecureSkipVerify,
- LogLevel: cfg.LogLevel,
- Logger: &logger,
- KubeconfigPath: cfg.KubeconfigPath,
- KubeContext: cfg.KubeContext,
+ PulseURL: cfg.PulseURL,
+ APIToken: cfg.APIToken,
+ Interval: cfg.Interval,
+ AgentID: cfg.AgentID,
+ AgentType: "unified",
+ AgentVersion: Version,
+ InsecureSkipVerify: cfg.InsecureSkipVerify,
+ LogLevel: cfg.LogLevel,
+ Logger: &logger,
+ KubeconfigPath: cfg.KubeconfigPath,
+ KubeContext: cfg.KubeContext,
IncludeNamespaces: cfg.KubeIncludeNamespaces,
ExcludeNamespaces: cfg.KubeExcludeNamespaces,
IncludeAllPods: cfg.KubeIncludeAllPods,
@@ -354,10 +355,11 @@ type Config struct {
ProxmoxType string // "pve", "pbs", or "" for auto-detect
// Auto-update
- DisableAutoUpdate bool
+ DisableAutoUpdate bool
+ DisableDockerUpdateChecks bool // Disable Docker image update detection
// Security
- EnableCommands bool // Enable command execution for AI auto-fix (disabled by default)
+ EnableCommands bool // Enable command execution for AI auto-fix (disabled by default)
// Disk filtering
DiskExclude []string // Mount points or patterns to exclude from disk monitoring
@@ -370,8 +372,8 @@ type Config struct {
HealthAddr string
// Kubernetes
- KubeconfigPath string
- KubeContext string
+ KubeconfigPath string
+ KubeContext string
KubeIncludeNamespaces []string
KubeExcludeNamespaces []string
KubeIncludeAllPods bool
@@ -395,6 +397,7 @@ func loadConfig() Config {
envEnableProxmox := utils.GetenvTrim("PULSE_ENABLE_PROXMOX")
envProxmoxType := utils.GetenvTrim("PULSE_PROXMOX_TYPE")
envDisableAutoUpdate := utils.GetenvTrim("PULSE_DISABLE_AUTO_UPDATE")
+ envDisableDockerUpdateChecks := utils.GetenvTrim("PULSE_DISABLE_DOCKER_UPDATE_CHECKS")
envEnableCommands := utils.GetenvTrim("PULSE_ENABLE_COMMANDS")
envDisableCommands := utils.GetenvTrim("PULSE_DISABLE_COMMANDS") // deprecated
envHealthAddr := utils.GetenvTrim("PULSE_HEALTH_ADDR")
@@ -457,6 +460,7 @@ func loadConfig() Config {
enableProxmoxFlag := flag.Bool("enable-proxmox", defaultEnableProxmox, "Enable Proxmox mode (creates API token, registers node)")
proxmoxTypeFlag := flag.String("proxmox-type", envProxmoxType, "Proxmox type: pve or pbs (auto-detected if not specified)")
disableAutoUpdateFlag := flag.Bool("disable-auto-update", utils.ParseBool(envDisableAutoUpdate), "Disable automatic updates")
+ disableDockerUpdateChecksFlag := flag.Bool("disable-docker-update-checks", utils.ParseBool(envDisableDockerUpdateChecks), "Disable Docker image update detection (avoids Docker Hub rate limits)")
enableCommandsFlag := flag.Bool("enable-commands", utils.ParseBool(envEnableCommands), "Enable command execution for AI auto-fix (disabled by default)")
disableCommandsFlag := flag.Bool("disable-commands", false, "[DEPRECATED] Commands are now disabled by default; use --enable-commands to enable")
healthAddrFlag := flag.String("health-addr", defaultHealthAddr, "Health/metrics server address (empty to disable)")
@@ -519,25 +523,26 @@ func loadConfig() Config {
}
return Config{
- PulseURL: pulseURL,
- APIToken: token,
- Interval: *intervalFlag,
- HostnameOverride: strings.TrimSpace(*hostnameFlag),
- AgentID: strings.TrimSpace(*agentIDFlag),
- Tags: tags,
- InsecureSkipVerify: *insecureFlag,
- LogLevel: logLevel,
- EnableHost: *enableHostFlag,
- EnableDocker: *enableDockerFlag,
- DockerConfigured: dockerConfigured,
- EnableKubernetes: *enableKubernetesFlag,
- EnableProxmox: *enableProxmoxFlag,
- ProxmoxType: strings.TrimSpace(*proxmoxTypeFlag),
- DisableAutoUpdate: *disableAutoUpdateFlag,
- EnableCommands: resolveEnableCommands(*enableCommandsFlag, *disableCommandsFlag, envEnableCommands, envDisableCommands),
- HealthAddr: strings.TrimSpace(*healthAddrFlag),
- KubeconfigPath: strings.TrimSpace(*kubeconfigFlag),
- KubeContext: strings.TrimSpace(*kubeContextFlag),
+ PulseURL: pulseURL,
+ APIToken: token,
+ Interval: *intervalFlag,
+ HostnameOverride: strings.TrimSpace(*hostnameFlag),
+ AgentID: strings.TrimSpace(*agentIDFlag),
+ Tags: tags,
+ InsecureSkipVerify: *insecureFlag,
+ LogLevel: logLevel,
+ EnableHost: *enableHostFlag,
+ EnableDocker: *enableDockerFlag,
+ DockerConfigured: dockerConfigured,
+ EnableKubernetes: *enableKubernetesFlag,
+ EnableProxmox: *enableProxmoxFlag,
+ ProxmoxType: strings.TrimSpace(*proxmoxTypeFlag),
+ DisableAutoUpdate: *disableAutoUpdateFlag,
+ DisableDockerUpdateChecks: *disableDockerUpdateChecksFlag,
+ EnableCommands: resolveEnableCommands(*enableCommandsFlag, *disableCommandsFlag, envEnableCommands, envDisableCommands),
+ HealthAddr: strings.TrimSpace(*healthAddrFlag),
+ KubeconfigPath: strings.TrimSpace(*kubeconfigFlag),
+ KubeContext: strings.TrimSpace(*kubeContextFlag),
KubeIncludeNamespaces: kubeIncludeNamespaces,
KubeExcludeNamespaces: kubeExcludeNamespaces,
KubeIncludeAllPods: *kubeIncludeAllPodsFlag,
diff --git a/docs/UNIFIED_AGENT.md b/docs/UNIFIED_AGENT.md
index f111ed0ac8..4fcbb88f36 100644
--- a/docs/UNIFIED_AGENT.md
+++ b/docs/UNIFIED_AGENT.md
@@ -59,11 +59,13 @@ curl -fsSL http://<pulse-ip>:7655/install.sh | \
| `--kube-include-all-deployments` | `PULSE_KUBE_INCLUDE_ALL_DEPLOYMENTS` | Include all deployments, not just problems | `false` |
| `--kube-max-pods` | `PULSE_KUBE_MAX_PODS` | Max pods per report | `200` |
| `--disable-auto-update` | `PULSE_DISABLE_AUTO_UPDATE` | Disable auto-updates | `false` |
+| `--disable-docker-update-checks` | `PULSE_DISABLE_DOCKER_UPDATE_CHECKS` | Disable Docker image update detection | `false` |
| `--insecure` | `PULSE_INSECURE_SKIP_VERIFY` | Skip TLS verification | `false` |
| `--hostname` | `PULSE_HOSTNAME` | Override hostname | *(OS hostname)* |
| `--agent-id` | `PULSE_AGENT_ID` | Unique agent identifier | *(machine-id)* |
| `--health-addr` | `PULSE_HEALTH_ADDR` | Health/metrics server address | `:9191` |
+
## Auto-Detection
The installer automatically detects available platforms on the target machine:
diff --git a/internal/dockeragent/agent.go b/internal/dockeragent/agent.go
index cef18d2361..3ff398f2c5 100644
--- a/internal/dockeragent/agent.go
+++ b/internal/dockeragent/agent.go
@@ -31,25 +31,26 @@ type TargetConfig struct {
// Config describes runtime configuration for the Docker agent.
type Config struct {
- PulseURL string
- APIToken string
- Interval time.Duration
- HostnameOverride string
- AgentID string
- AgentType string // "unified" when running as part of pulse-agent, empty for standalone
- AgentVersion string // Version to report; if empty, uses dockeragent.Version
- InsecureSkipVerify bool
- DisableAutoUpdate bool
- Targets []TargetConfig
- ContainerStates []string
- SwarmScope string
- Runtime string
- IncludeServices bool
- IncludeTasks bool
- IncludeContainers bool
- CollectDiskMetrics bool
- LogLevel zerolog.Level
- Logger *zerolog.Logger
+ PulseURL string
+ APIToken string
+ Interval time.Duration
+ HostnameOverride string
+ AgentID string
+ AgentType string // "unified" when running as part of pulse-agent, empty for standalone
+ AgentVersion string // Version to report; if empty, uses dockeragent.Version
+ InsecureSkipVerify bool
+ DisableAutoUpdate bool
+ DisableUpdateChecks bool // Disable Docker image update detection (registry checks)
+ Targets []TargetConfig
+ ContainerStates []string
+ SwarmScope string
+ Runtime string
+ IncludeServices bool
+ IncludeTasks bool
+ IncludeContainers bool
+ CollectDiskMetrics bool
+ LogLevel zerolog.Level
+ Logger *zerolog.Logger
}
var allowedContainerStates = map[string]string{
@@ -246,7 +247,7 @@ func New(cfg Config) (*Agent, error) {
stateFilters: stateFilters,
prevContainerCPU: make(map[string]cpuSample),
reportBuffer: buffer.New[agentsdocker.Report](bufferCapacity),
- registryChecker: NewRegistryChecker(*logger),
+ registryChecker: newRegistryCheckerWithConfig(*logger, !cfg.DisableUpdateChecks),
}
for _, state := range stateFilters {
@@ -766,7 +767,6 @@ func (a *Agent) handleCheckUpdatesCommand(ctx context.Context, target TargetConf
return nil
}
-
func (a *Agent) handleStopCommand(ctx context.Context, target TargetConfig, command agentsdocker.Command) error {
a.logger.Info().Str("commandID", command.ID).Msg("Received stop command from Pulse")
@@ -958,7 +958,6 @@ func newHTTPClient(insecure bool) *http.Client {
}
}
-
func (a *Agent) Close() error {
return a.docker.Close()
}
@@ -998,8 +997,6 @@ func readSystemUptime() int64 {
return int64(seconds)
}
-
-
// detectHostRemovedError checks if the response body contains a host removal error
func detectHostRemovedError(body []byte) string {
if len(body) == 0 {
diff --git a/internal/dockeragent/registry.go b/internal/dockeragent/registry.go
index 4fab3b7e5d..69592c0ed2 100644
--- a/internal/dockeragent/registry.go
+++ b/internal/dockeragent/registry.go
@@ -61,6 +61,11 @@ type ImageUpdateResult struct {
// NewRegistryChecker creates a new registry checker for the Docker agent.
func NewRegistryChecker(logger zerolog.Logger) *RegistryChecker {
+ return newRegistryCheckerWithConfig(logger, true)
+}
+
+// newRegistryCheckerWithConfig creates a registry checker with the enabled state set.
+func newRegistryCheckerWithConfig(logger zerolog.Logger, enabled bool) *RegistryChecker {
return &RegistryChecker{
httpClient: &http.Client{
Timeout: 30 * time.Second,
@@ -78,7 +83,7 @@ func NewRegistryChecker(logger zerolog.Logger) *RegistryChecker {
entries: make(map[string]cacheEntry),
},
logger: logger,
- enabled: true,
+ enabled: enabled,
checkInterval: defaultCheckInterval,
}
}
@@ -127,7 +132,6 @@ func (r *RegistryChecker) ForceCheck() {
r.cache.entries = make(map[string]cacheEntry)
}
-
// CheckImageUpdate checks if a newer version of the image is available.
func (r *RegistryChecker) CheckImageUpdate(ctx context.Context, image, currentDigest, arch, os, variant string) *ImageUpdateResult {
if !r.Enabled() {
@@ -365,7 +369,7 @@ func (r *RegistryChecker) resolveManifestList(ctx context.Context, registry, rep
// We matched arch and os. Variant is tricky as it's not always passed or available clearly.
// We'll prioritize exact match including variant (if we had it), but for now standard match.
// Since we strictly want to match what the local image is, and we'll get that from ImageInspect.
-
+
// Simple matching logic for now: exact match on Arch and OS
for _, m := range list.Manifests {
if m.Platform.Architecture == arch && m.Platform.OS == os {