Configuration
Dashboard settings for job metrics and historical GPU metrics
Configuration
This page covers the dashboard's settings for job metrics and GPU history. Settings are read when the server starts, so after changing one, restart the dashboard; you don't need to rebuild.
Database Connection
Point the dashboard at the PostgreSQL database that slurm-history-ingestor writes to:
# Format: postgresql://username:password@hostname:port/database
DATABASE_URL="postgresql://slurmdash:change-me@db-host:5432/slurmdash"
Same Database:
The dashboard and the ingestor must use the same database. If Admin →
Plugins says No job history yet, the ingestor is writing somewhere else
or hasn't run yet.
Before 3.0 this setting was called SLURM_JOB_METRICS_DATABASE_URL. The old name still works.
| Setting | Default | |
|---|---|---|
DATABASE_URL | none | PostgreSQL connection string |
DATABASE_POOL_MAX | 10 | Maximum database connections per dashboard process |
DATABASE_CONNECT_TIMEOUT_MS | 5000 | How long to wait for a database connection before treating it as unreachable |
Turning Job Metrics On and Off
Job metrics turn on by themselves when the database has job history from the ingestor. You don't need to set a flag. To turn them off, set:
NEXT_PUBLIC_ENABLE_JOB_METRICS_PLUGIN="false"
Hierarchy Labels
These labels name your two hierarchy levels in the metrics filters and charts:
NEXT_PUBLIC_HIERARCHY_LEVEL_1_LABEL="College"
NEXT_PUBLIC_HIERARCHY_LEVEL_2_LABEL="Department"
The defaults are College and Department. The spelling from before 3.0 (NEXT_PUBLIC_HIERARCHY_LEVEL1_LABEL) still works. See Organization Hierarchy.
Metrics Time Zone
The Metrics page's date ranges are whole days in this time zone, and its days, weeks, months, quarters and years start in it (default America/Phoenix):
NEXT_PUBLIC_METRICS_TIME_ZONE="America/New_York"
Utilization and Cluster Capacity
Utilization on the Metrics page divides allocated core hours by what the cluster could deliver. The dashboard records that capacity itself: every time node history checks the nodes (every NODE_HISTORY_INTERVAL_SECONDS), it adds each cluster's total, available and allocated CPU and GPU seconds to an hourly row in cluster_capacity. A node counts as available unless it's down, drained, in maintenance or powered down. Nothing to set up beyond node history being on.
| Setting | Default | |
|---|---|---|
CAPACITY_RETENTION_DAYS | 400 | How long hourly capacity is kept, so utilization can be compared year over year. Never shorter than NODE_HISTORY_RETENTION_DAYS. 0 keeps it forever |
Capacity is recorded under Slurm's cluster name. To filter or group utilization by cluster, set the ingestor's CLUSTER_NAME to the same name.
Daily Rollups
Since 3.1 the Metrics page reads daily rollups instead of every job, so a year of reports takes about as long as a week. The dashboard keeps them itself, in three tables it creates (job_daily, job_daily_hist, job_daily_nodes): one row per day for each combination of cluster, partition, QoS, account, user, job state, job size and wall time. A busy cluster's year of jobs, millions of rows, becomes a few hundred thousand.
A finished job never changes, so each day is computed once. A trigger on job_history notes the days each write from the ingestor touches, including every day a long job ran, and the collector recomputes those days within a minute. Backfills and late jobs are picked up the same way.
The first time the dashboard starts with job history (or after the metrics time zone changes) it builds the rollups in the background, a minute of work at a time; the server log shows metrics rollups: N days built, M to go. Until that finishes the page reads job_history directly, so it shows the same numbers, only slower.
| Setting | Default | |
|---|---|---|
METRICS_ROLLUP_INTERVAL_SECONDS | 60 | How often changed days are recomputed. 0 turns rollups off and the page reads job_history |
A few figures change slightly. Medians and percentiles (median wait, queue wait, wall time used) come from bins: waits under 100 seconds exactly, longer waits in bins 10% wide, and wall time used in 0.1% bins below 10% of the limit and 1% bins above. They're within a few percent of the exact value, except over a handful of jobs, where the exact figure interpolates between them. Job search, job details and preemption filtered by account or user still read job_history.
Database Role:
The trigger needs the role that owns job_history, normally the one the ingestor uses. If the dashboard connects as a different role, the log shows must be owner of table job_history and the page keeps reading job_history directly.
CPU Efficiency
CPU efficiency (CPU time used ÷ cores × run time) needs slurm-history-ingestor 1.1 or newer, which records each job's CPU time in job_history.total_cpu_seconds. In API mode it also needs 1.1.4 or newer: slurmdbd keeps CPU time and peak memory on job steps, and earlier releases recorded 0 CPU time and no memory for every job.
Slurm usually purges job steps sooner than jobs (PurgeStepAfter is often a few months while PurgeJobAfter is a year or more), so a backfill can bring in jobs whose CPU time and memory are gone. Those jobs are left out of CPU and memory efficiency; jobs ingested as they finish always have both. The dashboard checks for the column; until it's there, the Efficiency tab and job details show "needs slurm-history-ingestor 1.1" in place of CPU efficiency. Jobs ingested before the upgrade have no CPU time.
Ingestor Configuration
The ingestor has its own settings (Slurm connection, ingest mode, sync interval). See the Slurm History Ingestor configuration reference.
Historical GPU Metrics
GPU history saves per-job GPU utilization in the database, so finished jobs keep their GPU efficiency grades and stats after Prometheus no longer has them.
GPU history doesn't need job metrics or the ingestor. It needs:
- GPU utilization set up and on: GPU Utilization Reporting
- A database (
DATABASE_URL). The dashboard creates thejob_gpu_metricstable itself.
With both in place, GPU history turns on by itself and the dashboard captures running GPU jobs every minute. There's no cron job to set up.
NEXT_PUBLIC_ENABLE_GPU_UTILIZATION="true"
PROMETHEUS_URL="http://your-prometheus-host:9090"
DATABASE_URL="postgresql://slurmdash:change-me@db-host:5432/slurmdash"
# Optional: scope GPU metrics when one Prometheus scrapes multiple clusters
# Requires DCGM metrics/recording rules to include a matching cluster label
GPU_METRICS_CLUSTER="dev"
# Advanced: raw PromQL label matcher(s), overrides GPU_METRICS_CLUSTER
GPU_METRICS_LABEL_FILTER=""
# Advanced: capture-only PromQL label matcher(s), overrides the global GPU filter
GPU_METRICS_CAPTURE_LABEL_FILTER=""
| Setting | Default | |
|---|---|---|
GPU_METRICS_HISTORY | on with a database and GPU utilization | false turns GPU history off |
GPU_CAPTURE_INTERVAL_SECONDS | 60 | How often running GPU jobs are captured. 0 turns built-in GPU capture off |
Shared Prometheus:
Use GPU_METRICS_CLUSTER when a shared Prometheus scrapes more than one Slurm cluster. The value must match the cluster label on your DCGM metrics and GPU recording rules. For advanced setups, GPU_METRICS_LABEL_FILTER accepts raw PromQL label matchers such as cluster="dev", instance=~"sdg.*".
How It Works
While jobs are running:
- The dashboard queries Prometheus for active GPU jobs using DCGM metrics, scoped by
GPU_METRICS_CLUSTER,GPU_METRICS_LABEL_FILTER, orGPU_METRICS_CAPTURE_LABEL_FILTERwhen configured - Metrics are upserted into
job_gpu_metricswith one row per job; repeated captures update running averages, peaks, GPU count, sample count, andlast_seen
When jobs complete:
- After 10 minutes of no metrics, jobs are marked
is_complete = true - Historical job detail views query the database instead of Prometheus
- GPU efficiency grades are calculated from stored averages
If you run several dashboard instances against one database, only one of them captures at a time; the others take over if it stops.
Capturing from Cron (Optional)
Before 3.0, GPU history relied on a cron job calling POST /api/gpu. The dashboard now captures on its own, so you can remove that cron job. The endpoint still works, and leaving the cron job in place does no harm: a call within 50 seconds of the last capture returns HTTP 429 with no side effects.
To protect the endpoint, set GPU_METRICS_CAPTURE_TOKEN. Requests must then send Authorization: Bearer <token> or x-api-key: <token>, and missing or incorrect tokens return HTTP 401. The built-in capture doesn't use the endpoint, so it doesn't need the token.
curl -X POST http://localhost:3020/api/gpu \
-H "Authorization: Bearer $GPU_METRICS_CAPTURE_TOKEN"
To preview what would be captured without writing to the database:
curl -X POST 'http://localhost:3020/api/gpu?dry_run=true' | jq
Troubleshooting
GPU history is off:
Check Admin → Plugins. The reason for GPU history says what's missing: GPU utilization, the database, or the job_gpu_metrics table.
No metrics being captured:
- Verify Prometheus is accessible and DCGM exporter is running:
curl http://your-prometheus-host:9090/api/v1/targets
- Check that DCGM metrics exist in Prometheus:
curl -s 'http://your-prometheus-host:9090/api/v1/query?query=DCGM_FI_DEV_GPU_UTIL' | jq
- If
GPU_METRICS_CLUSTERis set, verify DCGM metrics have a matching label:
curl -s 'http://your-prometheus-host:9090/api/v1/query?query=count%20by%20(cluster,hpc_job,Hostname)%20(DCGM_FI_DEV_GPU_UTIL%7Bhpc_job!%3D%220%22,hpc_job!%3D%22%22%7D)' | jq
- Check the dashboard's log for lines starting with
[collectors], which report capture errors.
Checking the database:
SELECT job_id, avg_utilization, gpu_count, last_seen, is_complete
FROM job_gpu_metrics
ORDER BY last_seen DESC
LIMIT 10;
Historical jobs not showing GPU stats:
- Verify the job was running while GPU history was on
- Check if metrics exist:
psql "$DATABASE_URL" -c "SELECT * FROM job_gpu_metrics WHERE job_id = 'YOUR_JOB_ID';"
- Check that the job has completed (should be marked
is_complete = true)