Repository navigation
feat(metrics): alert on failed snapshot - #39
Merged
Merged
Conversation
A failed snapshot.service went unnoticed: no new snapshot was created and later repodata edits went into an older snapshot, served to all client tiers. Export the porthos_snapshot_failed metric with the core export-metrics command, and publish the PorthosSnapshotFailed alert rule for the metrics module when the module is installed or updated. Assisted-by: Claude Code:claude-opus-5-5
A snapshot that is not renewed keeps clients without new updates, also when snapshot.service does not fail, e.g. if its timer does not run. Export the creation time of the latest snapshot and publish the PorthosSnapshotTooOld alert, whose severity grows with the snapshot age: info after 1 week, warning after 2, critical after 3. Assisted-by: Claude Code:claude-opus-5-5
The snapshot services start with configure-module: publish the alert rules from there, so a module that is only installed raises no alert. On update, publish them only if the module was configured. The module bin directory is in the agent PATH: call the command by name. Assisted-by: Claude Code:claude-opus-5-5
Read the latest snapshot name in the fpm container, which mounts the webroot volume at a known path, instead of resolving the volume path on the host. Assisted-by: Claude Code:claude-opus-5-5
Compute the latest snapshot timestamp in the fpm container too, with the same PHP parsing of snapshot.php, instead of mixing it with Bash. Assisted-by: Claude Code:claude-opus-5-5
A failed snapshot needs no immediate action: wait 1 hour before firing PorthosSnapshotFailed, like the snapshot age alerts. Remove the version requirements from the README. Assisted-by: Claude Code:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the weekly snapshot job fails, or does not run, nobody is notified: no new snapshot is created, and later edits with
edit-repodatago into an older snapshot that all clients receive. This happened recently and went unnoticed for days. See https://mattermost.nethesis.it/nethesis/pl/eiqcyqsddbb5ucdttfqabfxbdhThe module now reports whether
snapshot.servicefailed and how old the latest snapshot is, and ships alert rules for both. The core and the metrics module do the rest: they collect the value, evaluate the rule, and send the alert by mail and to my.nethesis.it.bin/export-metricsprintsporthos_snapshot_failed, 1 when the service is failed, and the creation time of the latest snapshot.PorthosSnapshotFailed(critical) fires when the service is failed for 1 hour.PorthosSnapshotTooOldfires when the latest snapshot is older than 1 week (info), 2 weeks (warning) or 3 weeks (critical).configure-module, which starts the snapshot services, and again when a configured module is updated.How to test
PORTHOS_SOURCE, and runrunagent -m porthos1 systemctl --user start snapshot.service.PorthosSnapshotFailedalert is firing in Prometheus.runagent -m porthos1 systemctl --user reset-failed snapshot.service: the alert is resolved.PorthosSnapshotTooOldfires with severity info, warning or critical.Generated by Claude Code:claude-opus-5-5 with nethserver-pr