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 DisableCeph toggle, report_ip remote config, and improved IP detection (#929)

rcourtman5c4399d69f05
diff --git a/.github/workflows/deploy-demo-server.yml b/.github/workflows/deploy-demo-server.yml
new file mode 100644
index 0000000000..976edc70fa
--- /dev/null
+++ b/.github/workflows/deploy-demo-server.yml
@@ -0,0 +1,70 @@
+name: Deploy Demo Server
+
+on:
+ push:
+ branches: [main]
+ workflow_dispatch:
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: '1.22'
+
+ - name: Build static binary
+ run: CGO_ENABLED=0 go build -ldflags="-s -w" -o pulse cmd/pulse/main.go
+
+ - name: Tailscale
+ uses: tailscale/github-action@v2
+ with:
+ oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
+ oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
+ tags: tag:infra
+
+ - name: Deploy to server
+ run: |
+ # Upload new binary
+ scp -o StrictHostKeyChecking=no pulse root@pulse-relay:/tmp/pulse-new
+
+ # Health check: Run on test port 8082 and verify
+ # We use a subshell to background the process and then kill it after the check
+ ssh -o StrictHostKeyChecking=no root@pulse-relay "
+ chmod +x /tmp/pulse-new &&
+ PULSE_DATA_DIR=/tmp/pulse-demo-test \
+ PULSE_ADDR=127.0.0.1:8082 \
+ PULSE_MOCK_MODE=true \
+ PULSE_AUTH_USER=test \
+ PULSE_AUTH_PASS=test \
+ nohup /tmp/pulse-new > /tmp/demo-deploy-test.log 2>&1 &
+ PID=\$!
+ sleep 5
+ if curl -f http://127.0.0.1:8082/api/health; then
+ echo 'Health check passed!'
+ kill \$PID
+ rm -rf /tmp/pulse-demo-test
+ rm /tmp/demo-deploy-test.log
+ else
+ echo 'Health check failed! Error log:'
+ cat /tmp/demo-deploy-test.log
+ kill \$PID
+ rm -rf /tmp/pulse-demo-test
+ exit 1
+ fi
+ "
+
+ # Swap and restart production service
+ ssh -o StrictHostKeyChecking=no root@pulse-relay "
+ systemctl stop pulse &&
+ mv /tmp/pulse-new /opt/pulse/bin/pulse &&
+ systemctl start pulse
+ "
+
+ - name: Verify production
+ run: |
+ sleep 5
+ curl -f https://demo.pulserelay.pro/api/health
diff --git a/cmd/pulse-agent/main.go b/cmd/pulse-agent/main.go
index ae0f3d12c9..5e69b60ebf 100644
--- a/cmd/pulse-agent/main.go
+++ b/cmd/pulse-agent/main.go
@@ -477,8 +477,9 @@ type Config struct {
DiskExclude []string // Mount points or patterns to exclude from disk monitoring
// Network configuration
- ReportIP string // IP address to report (for multi-NIC systems)
- SelfTest bool // Perform self-test and exit
+ ReportIP string // IP address to report (for multi-NIC systems)
+ DisableCeph bool // Disable local Ceph status polling
+ SelfTest bool // Perform self-test and exit
// Health/metrics server
HealthAddr string
@@ -527,6 +528,7 @@ func loadConfig(args []string, getenv func(string) string) (Config, error) {
envKubeMaxPods := strings.TrimSpace(getenv("PULSE_KUBE_MAX_PODS"))
envDiskExclude := strings.TrimSpace(getenv("PULSE_DISK_EXCLUDE"))
envReportIP := strings.TrimSpace(getenv("PULSE_REPORT_IP"))
+ envDisableCeph := strings.TrimSpace(getenv("PULSE_DISABLE_CEPH"))
// Defaults
defaultInterval := 30 * time.Second
@@ -589,6 +591,7 @@ func loadConfig(args []string, getenv func(string) string) (Config, error) {
kubeIncludeAllDeploymentsFlag := fs.Bool("kube-include-all-deployments", utils.ParseBool(envKubeIncludeAllDeployments), "Include all deployments, not just problem ones")
kubeMaxPodsFlag := fs.Int("kube-max-pods", defaultInt(envKubeMaxPods, 200), "Max pods included in report")
reportIPFlag := fs.String("report-ip", envReportIP, "IP address to report (for multi-NIC systems)")
+ disableCephFlag := fs.Bool("disable-ceph", utils.ParseBool(envDisableCeph), "Disable local Ceph status polling")
showVersion := fs.Bool("version", false, "Print the agent version and exit")
selfTest := fs.Bool("self-test", false, "Perform self-test and exit (used during auto-update)")
@@ -671,6 +674,7 @@ func loadConfig(args []string, getenv func(string) string) (Config, error) {
KubeMaxPods: *kubeMaxPodsFlag,
DiskExclude: diskExclude,
ReportIP: strings.TrimSpace(*reportIPFlag),
+ DisableCeph: *disableCephFlag,
SelfTest: *selfTest,
}, nil
}
@@ -948,6 +952,16 @@ func applyRemoteSettings(cfg *Config, settings map[string]interface{}, logger *z
cfg.Interval = time.Duration(f) * time.Second
logger.Info().Float64("val", f).Msg("Remote config: interval (s)")
}
+ case "report_ip":
+ if s, ok := v.(string); ok {
+ cfg.ReportIP = s
+ logger.Info().Str("val", s).Msg("Remote config: report_ip")
+ }
+ case "disable_ceph":
+ if b, ok := v.(bool); ok {
+ cfg.DisableCeph = b
+ logger.Info().Bool("val", b).Msg("Remote config: disable_ceph")
+ }
}
}
}
diff --git a/internal/config/config.go b/internal/config/config.go
index ad36ae9c66..3deb932d29 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -449,7 +449,8 @@ type PVEInstance struct {
ClusterEndpoints []ClusterEndpoint // All discovered cluster nodes
// Agent tracking
- Source string // "agent" or "script" - how this node was registered (empty = legacy/manual)
+ Source string // "agent" or "script" - how this node was registered (empty = legacy/manual)
+ DisableCeph bool // Disable Ceph status polling for this instance
}
// ClusterEndpoint represents a single node in a cluster
@@ -500,7 +501,8 @@ type PBSInstance struct {
SSHPort int // SSH port for temperature monitoring (0 = use global default)
// Agent tracking
- Source string // "agent" or "script" - how this node was registered (empty = legacy/manual)
+ Source string // "agent" or "script" - how this node was registered (empty = legacy/manual)
+ DisableCeph bool // Disable Ceph status polling for this instance
}
// PMGInstance represents a Proxmox Mail Gateway connection
diff --git a/internal/hostagent/agent.go b/internal/hostagent/agent.go
index 2e975a726a..8d97b93e88 100644
--- a/internal/hostagent/agent.go
+++ b/internal/hostagent/agent.go
@@ -53,7 +53,8 @@ type Config struct {
DiskExclude []string // Mount points or path prefixes to exclude from disk monitoring
// Network configuration
- ReportIP string // IP address to report instead of auto-detected (for multi-NIC systems)
+ ReportIP string // IP address to report instead of auto-detected (for multi-NIC systems)
+ DisableCeph bool // If true, disables local Ceph status polling
}
// Agent is responsible for collecting host metrics and shipping them to Pulse.
@@ -630,6 +631,9 @@ func (a *Agent) collectRAIDArrays(ctx context.Context) []agentshost.RAIDArray {
// collectCephStatus attempts to collect Ceph cluster status.
// Returns nil if Ceph is not available or not configured on this host.
func (a *Agent) collectCephStatus(ctx context.Context) *agentshost.CephCluster {
+ if a.cfg.DisableCeph {
+ return nil
+ }
// Only collect on Linux
if runtime.GOOS != "linux" {
return nil
diff --git a/internal/hostagent/proxmox_setup.go b/internal/hostagent/proxmox_setup.go
index 4e63411848..b2f5064de7 100644
--- a/internal/hostagent/proxmox_setup.go
+++ b/internal/hostagent/proxmox_setup.go
@@ -432,8 +432,9 @@ func (p *ProxmoxSetup) getIPThatReachesPulse() string {
localAddr := conn.LocalAddr().(*net.UDPAddr)
ip := localAddr.IP.String()
- // Only return private IPs (we don't want to register with a public IP)
- if isPrivateIP(ip) {
+ // If we found an IP that can reach Pulse, it's the most reliable one to report.
+ // We only skip loopback/link-local which net.Dial UDP shouldn't return anyway.
+ if ip != "" && ip != "127.0.0.1" && !strings.HasPrefix(ip, "fe80:") {
return ip
}
return ""
@@ -471,9 +472,11 @@ func isPrivateIP(ip string) bool {
}
// Check common private ranges
private := []string{
- "10.0.0.0/8",
- "172.16.0.0/12",
- "192.168.0.0/16",
+ "10.0.0.0/8", // RFC 1918
+ "172.16.0.0/12", // RFC 1918
+ "192.168.0.0/16", // RFC 1918
+ "100.64.0.0/10", // CGNAT / Tailscale
+ "169.254.0.0/16", // Link-local
}
for _, cidr := range private {
_, network, _ := net.ParseCIDR(cidr)
diff --git a/internal/monitoring/monitor_polling.go b/internal/monitoring/monitor_polling.go
index f497d4603d..b1f069a201 100644
--- a/internal/monitoring/monitor_polling.go
+++ b/internal/monitoring/monitor_polling.go
@@ -1629,7 +1629,9 @@ func (m *Monitor) pollStorageWithNodes(ctx context.Context, instanceName string,
m.state.UpdateStorageForInstance(storageInstanceName, allStorage)
// Poll Ceph cluster data after refreshing storage information
- m.pollCephCluster(ctx, instanceName, client, cephDetected)
+ if !pve.DisableCeph {
+ m.pollCephCluster(ctx, instanceName, client, cephDetected)
+ }
duration := time.Since(startTime)