Internal check per dataset as specified in #135 #144

Closed
thorsten.spille wants to merge 0 commits from thorsten.spille/135-internal-check into main AGit
Owner

Closes #135. Extends the internal check of #63 (monitor_engine=internal) to the specification in #135.

bashclub-zsync

  • Only the replicated datasets are read: zfs list -Hp -t snapshot … <datasets> and zfs list -Hp -o name,used <datasets> on the source, in blocks of 100 (forms bashclub-zsync-remote already allows), and the target. Before: all datasets of the source.
  • Filter: age and rollback count only snapshots of snapshot_filter and the label of zsync, with the regex of the replication (strict name scheme of the label). Works also with -s, which ends before the replication parses the filter (monitor_filter).
  • Checks per dataset (one line, worse state wins): age of the newest common snapshot (checkzfs_max_age); replication_age with the thresholds of the age check of the configuration, incl. the hint "the source creates no new snapshots"; source count (checkzfs_max_snapshot_count, source only); replica count against the expected count (label=N: N, otherwise the count on the source, at least min_keep; +5 WARN, +10 CRIT); rollback WARN; no common snapshot CRIT; com.sun:auto-snapshot of the replica not false CRIT; no replica WARN. Text with both counts.
  • Metrics: file_count = replica (was combined in checkzfs), new source_count, replication_age.
  • State files: <config>.replicated (dataset, time of the last successful replication, kept across failed runs); state excluded in <config>.datasets for datasets deselected below a selected one.
  • -s: table per dataset and the excluded datasets.
  • The replication itself is untouched: the scenario comparison (tests/run.sh, main vs. branch) shows no other change in the calls than the queries of the check.

Checkmk check

  • Thresholds of the age check moved into age_limits (no behaviour change, all 62 tests pass), new --age-limits --config <file> for the internal check (6 new tests).
  • Excluded datasets listed in the service of the configuration.

Tests

  • monitor_internal rewritten after the test list of #135: only selected datasets queried, service format, one line per dataset, excluded datasets (state, -s), unfiltered snapshot without finding, auto-snapshot CRIT, rollback WARN, too many on source, replica over expected + 5, replication too old CRIT, defaults.
  • remote.sh with monitor_internal job_user checkmk local_mode replication unprivileged: 6/6.

Runtime

Test VM, 50 selected datasets and 200 others with 30 snapshots each (7560 snapshots on the source, 1530 on the target), bashclub-zsync -s three times per engine:

engine -s lines in the spool
internal 2.7–2.9 s 51 (one per dataset + service of the configuration)
checkzfs 8.3–8.5 s 102 (two per dataset)

The time includes the selection and the status of the whole -s; checkzfs reads all snapshots of all pools on both sides, the internal check only those of the selected datasets.

Docs

CHANGELOG; README (configuration block, services per dataset, TrueNAS and manual installation without checkzfs); handbook: Checkmk services (new section per dataset), parameters, monitoring concept, states, new features, diagnosis.

🤖 Generated with Claude Code

Closes #135. Extends the internal check of #63 (`monitor_engine=internal`) to the specification in #135. ## bashclub-zsync - **Only the replicated datasets** are read: `zfs list -Hp -t snapshot … <datasets>` and `zfs list -Hp -o name,used <datasets>` on the source, in blocks of 100 (forms `bashclub-zsync-remote` already allows), and the target. Before: all datasets of the source. - **Filter:** age and rollback count only snapshots of `snapshot_filter` and the label of zsync, with the regex of the replication (`strict` name scheme of the label). Works also with `-s`, which ends before the replication parses the filter (`monitor_filter`). - **Checks per dataset** (one line, worse state wins): age of the newest common snapshot (`checkzfs_max_age`); `replication_age` with the thresholds of the age check of the configuration, incl. the hint "the source creates no new snapshots"; source count (`checkzfs_max_snapshot_count`, source only); replica count against the expected count (`label=N`: N, otherwise the count on the source, at least `min_keep`; +5 WARN, +10 CRIT); rollback WARN; no common snapshot CRIT; `com.sun:auto-snapshot` of the replica not `false` CRIT; no replica WARN. Text with both counts. - **Metrics:** `file_count` = replica (was combined in checkzfs), new `source_count`, `replication_age`. - **State files:** `<config>.replicated` (dataset, time of the last successful replication, kept across failed runs); state `excluded` in `<config>.datasets` for datasets deselected below a selected one. - **`-s`:** table per dataset and the excluded datasets. - The replication itself is untouched: the scenario comparison (`tests/run.sh`, main vs. branch) shows no other change in the calls than the queries of the check. ## Checkmk check - Thresholds of the age check moved into `age_limits` (no behaviour change, all 62 tests pass), new `--age-limits --config <file>` for the internal check (6 new tests). - Excluded datasets listed in the service of the configuration. ## Tests - `monitor_internal` rewritten after the test list of #135: only selected datasets queried, service format, one line per dataset, excluded datasets (state, `-s`), unfiltered snapshot without finding, auto-snapshot CRIT, rollback WARN, too many on source, replica over expected + 5, replication too old CRIT, defaults. - `remote.sh` with `monitor_internal job_user checkmk local_mode replication unprivileged`: 6/6. ## Runtime Test VM, 50 selected datasets and 200 others with 30 snapshots each (7560 snapshots on the source, 1530 on the target), `bashclub-zsync -s` three times per engine: | engine | `-s` | lines in the spool | |---|---|---| | internal | 2.7–2.9 s | 51 (one per dataset + service of the configuration) | | checkzfs | 8.3–8.5 s | 102 (two per dataset) | The time includes the selection and the status of the whole `-s`; checkzfs reads all snapshots of all pools on both sides, the internal check only those of the selected datasets. ## Docs CHANGELOG; README (configuration block, services per dataset, TrueNAS and manual installation without checkzfs); handbook: Checkmk services (new section per dataset), parameters, monitoring concept, states, new features, diagnosis. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
age_limits computes the thresholds for the age of the last successful run as
before; --age-limits --config <file> prints them for the internal check of
bashclub-zsync. The service of the configuration is unchanged (all tests
pass), new tests for --age-limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the replicated datasets are read (their snapshots on the source in
blocks of 100, the target); age and rollback count only snapshots of
snapshot_filter and the label of zsync. New: time since the last successful
replication of each dataset (<config>.replicated, thresholds of the age check
of the configuration via the Checkmk check --age-limits), snapshots on source
and replica counted apart (replica against the expected count from
snapshot_filter, +5/+10), com.sun:auto-snapshot of the replica not false is
CRIT, a rollback WARN. Metrics source_count and replication_age, file_count is
the count of the replica. Excluded datasets (deselected below a selected one)
get state excluded, are listed in the service of the configuration and by -s;
-s shows a table per dataset. Handbook and changelog updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge branch 'main' into feature/135-internal-check
All checks were successful
bashclub-zsync / build (pull_request) Successful in 25s
bashclub-zsync / test (ubuntu-24.04) (pull_request) Successful in 44s
bashclub-zsync / test (debian-13) (pull_request) Successful in 44s
bashclub-zsync / test (ubuntu-26.04) (pull_request) Successful in 49s
bashclub-zsync / test (debian-12) (pull_request) Successful in 52s
bashclub-zsync / publish (pull_request) Has been skipped
bashclub-zsync / package (pull_request) Successful in 0s
bashclub-zsync / integration (pull_request) Successful in 11m32s
9598408356
README: built-in check per dataset (#135)
All checks were successful
bashclub-zsync / build (pull_request) Successful in 27s
bashclub-zsync / test (debian-13) (pull_request) Successful in 43s
bashclub-zsync / test (ubuntu-24.04) (pull_request) Successful in 43s
bashclub-zsync / test (ubuntu-26.04) (pull_request) Successful in 48s
bashclub-zsync / test (debian-12) (pull_request) Successful in 51s
bashclub-zsync / publish (pull_request) Has been skipped
bashclub-zsync / package (pull_request) Successful in 0s
bashclub-zsync / integration (pull_request) Successful in 11m30s
288e234d19
monitor_engine in the configuration block, services per dataset with their
checks and metrics, TrueNAS and manual installation without checkzfs.

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

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

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

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!144
No description provided.