Add auth exporter module: implement Prometheus scrape configuration, exporter logic, and Grafana dashboard
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
Auth exporter Grafana dashboard
|
||||
=================================
|
||||
|
||||
This directory contains a Grafana dashboard JSON you can import to visualize the auth-exporter metrics.
|
||||
|
||||
Panels included
|
||||
- Active sessions (by source) — `auth_sessions_active`
|
||||
- Auth sessions started (rate) — `sum by (source, method) (rate(auth_sessions_total[5m]))`
|
||||
- Parse errors (rate) — `rate(auth_exporter_parse_errors_total[5m])`
|
||||
- Exporter uptime — `auth_exporter_uptime_seconds`
|
||||
- User label drops — `rate(auth_exporter_user_labels_dropped_total[5m])`
|
||||
- Top users table (optional, only useful if `--export-usernames` is enabled) — `topk(N, sum by (username) (rate(auth_sessions_by_user_total[5m])))`
|
||||
|
||||
How to import
|
||||
1. In Grafana, go to Dashboards → Import.
|
||||
2. Upload the `auth_exporter_dashboard.json` file or paste its JSON.
|
||||
3. Choose your Prometheus datasource.
|
||||
|
||||
Privacy and performance note
|
||||
- The "Top users" table requires the exporter to be run with `--export-usernames`. That option can generate high-cardinality series and should only be enabled for small, controlled environments or with a username whitelist.
|
||||
@@ -0,0 +1,164 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
"uid": "auth-exporter",
|
||||
"title": "Auth Log Exporter",
|
||||
"tags": [
|
||||
"exporter",
|
||||
"auth",
|
||||
"prometheus"
|
||||
],
|
||||
"timezone": "browser",
|
||||
"schemaVersion": 30,
|
||||
"version": 1,
|
||||
"refresh": "10s",
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"type": "datasource",
|
||||
"name": "datasource",
|
||||
"label": "Prometheus",
|
||||
"query": "prometheus",
|
||||
"current": {
|
||||
"text": "Prometheus",
|
||||
"value": "-- Grafana --"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "interval",
|
||||
"name": "interval",
|
||||
"label": "Interval",
|
||||
"query": "5s,10s,30s,1m,5m",
|
||||
"current": {
|
||||
"text": "1m",
|
||||
"value": "1m"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "textbox",
|
||||
"name": "topn",
|
||||
"label": "Top N users",
|
||||
"query": "10",
|
||||
"current": {
|
||||
"text": "10",
|
||||
"value": "10"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Active sessions (by source)",
|
||||
"id": 1,
|
||||
"datasource": "${datasource}",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "auth_sessions_active",
|
||||
"legendFormat": "{{source}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Auth sessions started (rate)",
|
||||
"id": 2,
|
||||
"datasource": "${datasource}",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum by (source, method) (rate(auth_sessions_total[5m]))",
|
||||
"legendFormat": "{{source}} / {{method}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Parse errors (rate)",
|
||||
"id": 3,
|
||||
"datasource": "${datasource}",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "rate(auth_exporter_parse_errors_total[5m])",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "Exporter uptime (s)",
|
||||
"id": 4,
|
||||
"datasource": "${datasource}",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "auth_exporter_uptime_seconds",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 8,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "User label drops (rate)",
|
||||
"id": 5,
|
||||
"datasource": "${datasource}",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "rate(auth_exporter_user_labels_dropped_total[5m])",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"x": 18,
|
||||
"y": 8,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "table",
|
||||
"title": "Top users by session starts (last 5m)",
|
||||
"id": 6,
|
||||
"datasource": "${datasource}",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "topk(int(${topn}), sum by (username) (rate(auth_sessions_by_user_total[5m])))",
|
||||
"legendFormat": "{{username}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 14,
|
||||
"w": 24,
|
||||
"h": 8
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"overwrite": false
|
||||
}
|
||||
Reference in New Issue
Block a user