Add scylla-monitor-ctl: Go CLI for monitoring stack management - #1
Draft
dkropachev wants to merge 5 commits into
Draft
Add scylla-monitor-ctl: Go CLI for monitoring stack management#1dkropachev wants to merge 5 commits into
dkropachev wants to merge 5 commits into
Conversation
dkropachev
force-pushed
the
scylla-monitor-ctl
branch
3 times, most recently
from
February 12, 2026 23:14
fa3d7ae to
bafbf06
Compare
- Delete pkg/backup/ package — was a pure pass-through wrapper that duplicated migrate types and delegated 1:1 with zero logic - cmd/backup.go now calls pkg/migrate/ directly - Remove --include-data flag from both backup create and migrate export; metric data export is inferred from --prometheus-url presence with a warning when absent - Remove IncludeData field from ArchiveOptions internal API - Fix golangci-lint CI: migrate config to v2 schema, pin v2.9, only-new-issues=true for 71 pre-existing findings - Update DESIGN.md and TODO.md to reflect changes
dkropachev
force-pushed
the
scylla-monitor-ctl
branch
from
February 12, 2026 23:14
bafbf06 to
1149b73
Compare
When importing a stack to different ports, the exported Prometheus datasource URL still pointed to the original address. Add --prometheus-url flag to migrate import and backup restore that rewrites Prometheus datasource URLs during import.
…command - Add `check` command for API-level health checks (Grafana, Prometheus, AlertManager, datasource connectivity, scrape targets, firing alerts) - Add `migrate clone` command that clones a running stack to new ports in a single operation (export + deploy + import with correct wiring) - Fix datasource upsert: CreateDatasource silently swallowed 409 conflicts, so URL rewrites on import were lost. New UpsertDatasource tries create, on 409 finds existing by name and updates it - Drop `backup` command entirely — it was a duplicate of `migrate export/import` with slightly different defaults. Merge backup's config path defaults into `migrate export` - `migrate import` now accepts both .tar.gz archives and unpacked directories - `migrate import` takes PATH as positional arg instead of --archive flag - Add QueryAlerts, QueryInstant, QueryTargetGroups to Prometheus client - Add GetDatasourceByName, CheckDatasourceHealth to Grafana client
- errcheck: handle unchecked error returns (defer Close, type assertions, MarkFlagRequired, copyFile/copyDir calls) - gofmt: fix formatting in all affected files - gosec: tighten file permissions (0750 dirs, 0600 files), add nolint annotations for ReadFile/Open/Create with variable paths, use io.LimitReader for decompression, add path traversal checks - staticcheck: remove redundant embedded field selectors, lowercase error strings per Go conventions - unused: annotate embed vars not yet wired
The integration test was failing because: - Prometheus v3.2.1 was outdated; align with v3.9.1 used everywhere else - 30 health check retries (30s) was insufficient for CI; increase to 60
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.
Summary
Single-binary Go CLI (
scylla-monitor-ctl) that replaces the shell-script-based monitoring stack management. Handles dashboard generation, container orchestration, configuration, migration, and health checking.Commands
deploydestroystatuscheckconfigureupgradedashboards generatemake_dashboards.py)dashboards upload/download/listmigrate exportmigrate import PATHmigrate clonemigrate copyprometheus configprometheus.ymlfrom templateprometheus reloadtunetargets generateExamples
1. Deploy a monitoring stack for ScyllaDB 6.2
2. Clone a running stack
Auto-discovers targets from source Prometheus, deploys a new stack, rewrites datasource URLs to container-internal addresses, uploads dashboards. One command.
3. Check stack health
$ scylla-monitor-ctl check COMPONENT CHECK STATUS DETAIL -------------------------------------------------------------------------------- Grafana API Health [OK] http://localhost:3000 Grafana Dashboards [OK] 10 dashboards loaded Prometheus API Health [OK] http://localhost:9090 Prometheus Scrape targets [OK] 3 up, 0 down AlertManager API Health [OK] http://localhost:9093 Datasource prometheus [OK] prometheus -> http://localhost:9090 Prometheus Alerts [OK] no alerts firing4. Export and import
5. Generate dashboards for a specific version
6. Live-copy dashboards between two Grafana instances
7. Drop expensive metrics and reload
Key implementation details
migrate importandmigrate cloneuse upsert (create-or-update) for datasources, so URL rewrites always take effect even when the datasource already existsmigrate cloneauto-discovers targets from the Prometheus API, mounts them at the correct container-internal paths, and rewrites datasource URLs to container namesmigrate importaccepts both.tar.gzarchives and unpacked directoriesbackupcommand: removed — it was a duplicate ofmigrate export/importwith slightly different defaultsTest plan
go build ./...passesgo vet ./...passesgo test ./...— all unit tests passcheckcommand verified against live stack (all OK)migrate cloneend-to-end: clone → check → all services healthy, scraping targetsmigrate importwith archive and with unpacked directorybuild-and-test+integration-test) passes