Repository navigation
feat: Grafana integration — fleet-wide auth dashboard - #26
Merged
Merged
Conversation
Locks the panel layout, label-cardinality plan, LogQL patterns, and alert thresholds for the fleet-wide auth dashboard before any implementation work lands. Sourced from the schema PAMSignal already emits via sd_journal_send() — no daemon changes required. Refs #25. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ships everything an operator with a Linux fleet needs to surface PAMSignal events in a fleet-wide auth dashboard, with no daemon changes. - alloy.river — production journald scraper. Filters SYSLOG_IDENTIFIER=pamsignal and promotes four low-cardinality fields (app, host, service, event_action) to Loki labels. Everything else stays in the JSON body, parsed at query time. Total streams stay at ~30 × fleet_size — safe to thousands of hosts. - dashboards/pamsignal-v1.json — 12-panel dashboard. Stats row, outcome/service time-series, per-host volume, top-IP and top-username tables, recent brute-force + root-login logs, live event stream. Multi-select variables for host, service, event_action. - alerts.yaml — four Grafana-native rules: brute-force detected (critical), successful root SSH login (high), ≥10 failed logins from one IP in 5 min (high, safety net), host stopped reporting for >10 min (medium). - docker-compose.yml — single-command local stack with Loki, Grafana, Alloy, image renderer, and a Python synthetic event producer that generates realistic event mix + periodic brute-force bursts. Lets operators see the dashboard before committing to deploy. - verify.sh — one-shot pipeline health check with five distinct exit codes that pinpoint the broken step. - README.md — deploy-for-real guide for Loki newcomers, plus troubleshooting and tuning notes. - alloy/demo.alloy — file-source variant for the docker-compose stack, mirrors the production label set. - synthetic/, config/, provisioning/ — supporting scaffolding. assets/grafana-dashboard.png is the rendered v1 dashboard against the synthetic dataset (12 hosts, ~30 min of traffic). Refs #25. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a top-level "Fleet view in Grafana" section to the README with the dashboard screenshot and a one-liner for the local try-it stack, plus a link from the documentation index. CHANGELOG entry under Unreleased summarizes the integration's deliverables, design rationale, and the two manual launch tasks left for the maintainer. Refs #25. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New workflow triggers on paths under examples/grafana/ and the design doc. On each run it: - alloy fmt --test on both alloy.river and alloy/demo.alloy - json.tool on dashboards/pamsignal-v1.json - yaml.safe_load on alerts.yaml - docker compose up -d, waits for Loki + Grafana healthy - 30s soak for synthetic events to accumulate - Asserts the 8 representative panel queries return non-empty results against Loki - Confirms the dashboard is provisioned with the expected title - Runs verify.sh --loki-only - Renders the dashboard PNG via grafana-image-renderer and uploads it as an artifact (14-day retention) Designed to finish in under two minutes so the maintainer doesn't avoid editing the dashboard for fear of slow CI. Refs #25. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
setup-python doesn't ship PyYAML; the validate step was failing with ModuleNotFoundError. Add an inline pip install. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Grafana 11.4 cold-boots in 60–90s on GitHub Actions runners due to database migrations, exceeding the original 60s wait. Bump the timeout to 180s and switch the readiness check from a piped grep (can drop exit code under set -e) to a case match on the captured response body. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
grafana.com (and Grafana's UI Import) reject dashboards with
hardcoded datasource UIDs, with the error "Old dashboard JSON
format. Read about Importing & Sharing with Grafana 2.x or 3.0."
The marketplace expects the "shared externally" format: a
${DS_LOKI} placeholder for the Loki datasource plus __inputs,
__elements and __requires metadata so the importer can pick their
own datasource at import time.
This commit:
- adds dashboards/pamsignal-v1.grafana-com.json with the
marketplace format. All 16 datasource refs (12 panels + 3
template variables + 1 annotation) use the ${DS_LOKI}
placeholder. __requires declares grafana>=11.0.0, loki>=1.0.0,
and the four panel plugin types (stat, timeseries, table, logs)
the dashboard uses.
- keeps dashboards/pamsignal-v1.json as the provisioning-ready
version (hardcoded uid="loki" matches the bundled provisioning
file) — both files stay in sync because the marketplace one is
derived from it.
- updates examples/grafana/README.md to point operators at the
right file for the right path: provisioning vs. grafana.com /
UI import.
- extends CI to JSON-validate the marketplace file and assert
it has no hardcoded "loki" uid leaks plus a __inputs block.
Verified locally by importing the marketplace JSON into Grafana
11.4 via /api/dashboards/import with the DS_LOKI input bound to
the local datasource — dashboard renders identically.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Closes #25.
Summary
Ships
examples/grafana/— a complete Loki/Alloy/Grafana integration thatturns the ECS-shaped events PAMSignal already writes via
sd_journal_send()into a fleet-wide auth dashboard. No daemon changes.
Operator deliverable: install Alloy on each host, point it at Loki, import
one dashboard JSON, attach four alert rules to a contact point. Target
time-to-working-dashboard for a Loki newcomer: under 30 minutes.
What's in the box
alloy.riverapp/host/service/event_actionto Loki labels (~30 × fleet_size streams); keepsSOURCE_IP/USER_NAME/… in the JSON body for query-time parsing.dashboards/pamsignal-v1.jsonalerts.yamldocker-compose.ymlverify.shREADME.mdDesign rationale (schema, label cardinality plan, panel rationale) lives in
docs/grafana-integration.md.Commits
8a5f127docs: add Grafana integration designfe48590feat(grafana): add Loki/Alloy/Grafana integration with try-it stack67e500cdocs: surface Grafana integration from main README and CHANGELOGc8454cdci: validate Grafana integration on every PRWhat was validated live before push
verify.sh --loki-onlyexits 0alloy fmt --testalerts.yamlparsesTest plan
grafana-integrationworkflow (validates configs, brings up stack, asserts panels return data, uploads dashboard screenshot artifact)cd examples/grafana && docker compose up -d→ http://localhost:3000 shows the PAMSignal dashboard with synthetic events flowing in./examples/grafana/verify.sh --loki-onlyexits 0 against the running stackalloy.river, restart pamsignal → events appear in Loki with the four expected labelsalerts.yamlinto Grafana, wire to a contact point, confirm at least one rule fires against the synthetic stackdocker compose down -vcleans up without orphansFollow-ups (manual, post-merge)
dashboards/pamsignal-v1.jsonto https://grafana.com/grafana/dashboards/ with tagspamsignal pam auth ssh brute-force fleet loki🤖 Generated with Claude Code