Built-in check of the snapshots per dataset (monitor_engine) (#63) #138

Closed
thorsten.spille wants to merge 0 commits from thorsten.spille/63-monitor-engine into main AGit
Owner

Closes #63.

What

New setting monitor_engine=checkzfs|internal for the services per dataset (<checkzfs_prefix>:<source>:<port>#<dataset>).

  • internal: built into bashclub-zsync.
    • Same service names, thresholds (checkzfs_max_age, checkzfs_max_snapshot_count) and perfdata as checkzfs, so switching needs no new service discovery.
    • One line per dataset with the worse state of source and replica (checkzfs wrote two lines under the same name).
    • States: age of the newest common snapshot, count on source and replica, no replica, rollback (newest replica snapshot gone on the source), no common snapshot, com.sun:auto-snapshot not false on the replica.
    • Data: one zfs list of the source (one ssh call, passes bashclub-zsync-remote for job users) and one of the target, at the end of the run and with -s; only the replicated datasets (syncvols), bookmarks ignored.
    • The run itself is untouched: separate function next to run_checkzfs, called through run_monitor.
  • Defaults:
    • Without the setting: checkzfs if installed (as before), otherwise internal (before: no services per dataset, only a warning).
    • New configs: internal.
    • checkzfs without checkzfs installed: internal with a warning. An unknown value: default with a warning.
  • Package: bashclub-checkzfs moves from depends to recommends. apt keeps it on existing installations, and bashclub-zsync now installs where checkzfs is not published (Ubuntu; the fresh install test passed there). The CI fallback to the bookworm repo for Ubuntu stays for the update test: the release version 1.0.19 still depends on checkzfs.

Why now

checkzfs 4.14 stops as soon as a bookmark exists ('NoneType' object has no attribute 'add_snapshot'), and new configs have source_bookmark=1. Reproduced again with zsync's own bookmarks; internal works with them.

Handbook

  • monitor_engine in the reference, concept, installation (TrueNAS/manual no longer download checkzfs), messages, Checkmk pages and "Neue Funktionen einschalten" (new section to switch, tested on the VM).
  • The scenarios no longer switch the bookmarks off; the checkzfs warning now applies to monitor_engine=checkzfs only.
  • The Outline pages are republished after the merge.

Tests

  • New integration case monitor_internal: service format like checkzfs, one line per dataset, bookmark present without a Python error, -s after a rollback (CRIT) and over the count threshold (WARN), default without the setting, unknown value.
  • job_user extended: the internal check runs through bashclub-zsync-remote.
  • remote.sh with monitor_internal job_user checkmk local_mode replication unprivileged: 6/6.
  • Side-by-side comparison with checkzfs on the VM: same names and perfdata.

🤖 Generated with Claude Code

Closes #63. ## What New setting `monitor_engine=checkzfs|internal` for the services per dataset (`<checkzfs_prefix>:<source>:<port>#<dataset>`). - **`internal`:** built into `bashclub-zsync`. - Same service names, thresholds (`checkzfs_max_age`, `checkzfs_max_snapshot_count`) and perfdata as checkzfs, so switching needs no new service discovery. - One line per dataset with the worse state of source and replica (checkzfs wrote two lines under the same name). - States: age of the newest common snapshot, count on source and replica, no replica, rollback (newest replica snapshot gone on the source), no common snapshot, `com.sun:auto-snapshot` not `false` on the replica. - Data: one `zfs list` of the source (one ssh call, passes `bashclub-zsync-remote` for job users) and one of the target, at the end of the run and with `-s`; only the replicated datasets (`syncvols`), bookmarks ignored. - The run itself is untouched: separate function next to `run_checkzfs`, called through `run_monitor`. - **Defaults:** - Without the setting: checkzfs if installed (as before), otherwise `internal` (before: no services per dataset, only a warning). - New configs: `internal`. - `checkzfs` without checkzfs installed: `internal` with a warning. An unknown value: default with a warning. - **Package:** `bashclub-checkzfs` moves from `depends` to `recommends`. apt keeps it on existing installations, and `bashclub-zsync` now installs where checkzfs is not published (Ubuntu; the fresh install test passed there). The CI fallback to the bookworm repo for Ubuntu stays for the update test: the release version 1.0.19 still depends on checkzfs. ## Why now checkzfs 4.14 stops as soon as a bookmark exists (`'NoneType' object has no attribute 'add_snapshot'`), and new configs have `source_bookmark=1`. Reproduced again with zsync's own bookmarks; `internal` works with them. ## Handbook - `monitor_engine` in the reference, concept, installation (TrueNAS/manual no longer download checkzfs), messages, Checkmk pages and "Neue Funktionen einschalten" (new section to switch, tested on the VM). - The scenarios no longer switch the bookmarks off; the checkzfs warning now applies to `monitor_engine=checkzfs` only. - The Outline pages are republished after the merge. ## Tests - New integration case `monitor_internal`: service format like checkzfs, one line per dataset, bookmark present without a Python error, `-s` after a rollback (CRIT) and over the count threshold (WARN), default without the setting, unknown value. - `job_user` extended: the internal check runs through `bashclub-zsync-remote`. - `remote.sh` with `monitor_internal job_user checkmk local_mode replication unprivileged`: 6/6. - Side-by-side comparison with checkzfs on the VM: same names and perfdata. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Built-in check of the snapshots per dataset (monitor_engine) (#63)
Some checks failed
bashclub-zsync / build (pull_request) Successful in 25s
bashclub-zsync / test (ubuntu-24.04) (pull_request) Failing after 41s
bashclub-zsync / test (debian-13) (pull_request) Successful in 42s
bashclub-zsync / test (ubuntu-26.04) (pull_request) Failing after 45s
bashclub-zsync / test (debian-12) (pull_request) Successful in 51s
bashclub-zsync / publish (pull_request) Has been skipped
bashclub-zsync / package (pull_request) Failing after 0s
bashclub-zsync / integration (pull_request) Has been cancelled
92bc69169c
monitor_engine=internal writes the services <checkzfs_prefix>:<source>:<port>#<dataset>
with the names, thresholds and perfdata of checkzfs, one line per dataset with
the worse state of source and replica, from one list of the source and one of
the target at the end of the run and with -s. Bookmarks do not disturb it
(checkzfs 4.14 stops at them).

Configurations without the setting keep checkzfs if installed, otherwise
internal (before: no services per dataset). New configurations get internal.
bashclub-checkzfs moves from depends to recommends, so the package installs
where there is no checkzfs package (Ubuntu); the CI no longer falls back to
the bookworm repository there.

Handbook: monitor_engine in the reference, concept, installation, messages
and Checkmk pages; the scenarios no longer switch the bookmarks off, the
checkzfs warning applies to monitor_engine=checkzfs only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI: keep the bookworm fallback on Ubuntu for the update test (#63)
All checks were successful
bashclub-zsync / build (pull_request) Successful in 25s
bashclub-zsync / test (debian-13) (pull_request) Successful in 48s
bashclub-zsync / test (ubuntu-24.04) (pull_request) Successful in 50s
bashclub-zsync / test (ubuntu-26.04) (pull_request) Successful in 54s
bashclub-zsync / test (debian-12) (pull_request) Successful in 58s
bashclub-zsync / publish (pull_request) Has been skipped
bashclub-zsync / package (pull_request) Successful in 0s
bashclub-zsync / integration (pull_request) Successful in 11m21s
439a0fc540
The release version 1.0.19 still depends on bashclub-checkzfs, which is not
published for noble and resolute, so the update test cannot install it there.
The fresh install of the new package already passed without checkzfs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Manuell nach main gemergt (ce0d932), CI inkl. publish nach testing grün. Schließe den PR.

Manuell nach `main` gemergt (ce0d932), CI inkl. publish nach testing grün. Schließe den PR.
thorsten.spille closed this pull request 2026-10-20 00:10:49 +02:00
All checks were successful
bashclub-zsync / build (pull_request) Successful in 25s
bashclub-zsync / test (debian-13) (pull_request) Successful in 48s
bashclub-zsync / test (ubuntu-24.04) (pull_request) Successful in 50s
bashclub-zsync / test (ubuntu-26.04) (pull_request) Successful in 54s
bashclub-zsync / test (debian-12) (pull_request) Successful in 58s
bashclub-zsync / publish (pull_request) Has been skipped
bashclub-zsync / package (pull_request) Successful in 0s
bashclub-zsync / integration (pull_request) Successful in 11m21s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bashclub/zsync!138
No description provided.