Skip to content

core: durable node_exporter textfile metrics are lost on reboot #8127

Description

@gsanchietti

Steps to reproduce

  1. Have an enabled backup with a recorded status, e.g. a known-broken one:
    cat /run/node_exporter/backup<id>.prom   # node_backup_status{...} 0
  2. Reboot the machine — /run is memory-only, so it's lost upon a reboot:
  3. After the boot:
    cat /run/node_exporter/backup<id>.prom   # No such file or directory

Expected behavior

The backup status shown to Prometheus should reflect the last known real verdict at all times, including right after a reboot. An alert for a genuinely broken backup should keep firing.

Actual behavior

The file — and the whole node_backup_status series — disappears until the next scheduled run completes, silently clearing any alert based on it (e.g. BackupFailed).

This is a specific instance of a general pattern: any durable status published only as a /run (tmpfs) textfile-collector .prom file is invisible after a reboot, silently clearing whatever alert depends on it. Worth keeping in mind for any future gauge written the same way — a certificate-expiry check was raised as a plausible example — not just backups.

Suggested fix or workaround

Stop keeping this state on a tmpfs. Point node_exporter's --collector.textfile.directory (currently /host/run/node_exporter, i.e. host /run/node_exporter) and the matching writers (run-backup, refresh-node-info) at a persistent, non-tmpfs path under /var/lib/nethserver/node/state/ instead. The whole host root is already bind-mounted read-only into the node_exporter container (-v /:/host:ro,rslave), so any path under /var/lib/nethserver is already visible to it — no new mount needed, just the directory + flag change, plus a one-time migration/cleanup of the old /run/node_exporter path on upgrade. This removes the reboot gap by construction, for this metric and for any future one, instead of reconstructing lost state after the fact.

References

See also #8125

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingPackages are available from testing repositories

    Type

    Projects

    Status
    Testing

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions