This guide explains how to set up a single Waldur Site Agent instance for usage reporting with SLURM backend. This configuration is ideal when you only need to collect and report usage data from your SLURM cluster to Waldur Mastermind.
The usage reporting agent (report mode) collects CPU, memory, and other resource usage data from SLURM
accounting records and sends it to Waldur Mastermind. It runs in a continuous loop, fetching usage data for
the current billing period and reporting it at regular intervals.
uv package manager installedSlurmUser, or
a user with AdminLevel=Operator or higher when PrivateData hides jobs)sacct and sacctmgr commands available)sacct - for usage reportingsacctmgr - for account managementsinfo - for cluster diagnostics# Clone the repository
git clone https://github.com/waldur/waldur-site-agent.git
cd waldur-site-agent
# Install dependencies with SLURM plugin
uv sync --package waldur-site-agent-slurm
sudo mkdir -p /etc/waldur
Create /etc/waldur/waldur-site-agent-config.yaml with the following configuration:
sentry_dsn: "" # Optional: Sentry DSN for error tracking
timezone: "UTC" # Timezone for billing period calculations
offerings:
- name: "SLURM Usage Reporting"
waldur_api_url: "https://your-waldur-instance.com/api/"
waldur_api_token: "your-api-token-here"
waldur_offering_uuid: "your-offering-uuid-here"
# Backend configuration for usage reporting only
username_management_backend: "base" # Not used in report mode
order_processing_backend: "slurm" # Not used in report mode
membership_sync_backend: "slurm" # Not used in report mode
reporting_backend: "slurm" # This is what matters for reporting
# Event processing (not needed for usage reporting)
stomp_enabled: false
backend_type: "slurm"
backend_settings:
default_account: "root" # DefaultAccount= on user associations
customer_prefix: "hpc_" # Prefix for customer accounts
project_prefix: "hpc_" # Prefix for project accounts
allocation_prefix: "hpc_" # Prefix for allocation accounts
# Not used by report mode; shown because the same file usually also
# drives order_process / membership_sync. Optional.
qos_downscaled: "limited"
qos_paused: "paused"
qos_default: "normal"
enable_user_homedir_account_creation: false
# Define components for usage reporting
backend_components:
cpu:
limit: 10 # Not used in usage reporting
measured_unit: "k-Hours" # Waldur unit for CPU usage
unit_factor: 60000 # Convert CPU-minutes to k-Hours (60 * 1000)
accounting_type: "usage" # Report actual usage
label: "CPU"
mem:
limit: 10 # Not used in usage reporting
measured_unit: "gb-Hours" # Waldur unit for memory usage
unit_factor: 61440 # Convert MB-minutes to gb-Hours (60 * 1024)
accounting_type: "usage" # Report actual usage
label: "RAM"
waldur_api_url: URL to your Waldur Mastermind API endpointwaldur_api_token: API token for authentication (create in Waldur admin)waldur_offering_uuid: UUID of the SLURM offering in Waldurdefault_account: DefaultAccount= set on user associations in the SLURM clustercpu: CPU usage tracking in CPU-minutes (SLURM native unit)mem: Memory usage tracking in MB-minutes (SLURM native unit)unit_factor: Conversion factor from SLURM units to Waldur unitsaccounting_type: "usage": Report actual usage (not limits)sudo cp systemd-conf/agent-report/agent.service /etc/systemd/system/waldur-site-agent-report.service
sudo systemctl daemon-reload
sudo systemctl enable waldur-site-agent-report.service
sudo systemctl start waldur-site-agent-report.service
sudo systemctl status waldur-site-agent-report.service
For testing or one-time runs:
# Run directly
uv run waldur_site_agent -m report -c /etc/waldur/waldur-site-agent-config.yaml
# Or with installed package
waldur_site_agent -m report -c /etc/waldur/waldur-site-agent-config.yaml
backend_id is the SLURM account to report on. Accounts that are
not Waldur resources are never reported, whatever their name.sacct --truncate --allocations --allusers for the current month
(in REST mode, GET /slurmdb/{version}/jobs/ instead — see the
SLURM plugin README);unit_factor.Control reporting frequency with environment variable:
# Report every 15 minutes instead of default 30
export WALDUR_SITE_AGENT_REPORT_PERIOD_MINUTES=15
# View service logs
sudo journalctl -u waldur-site-agent-report.service -f
# View logs for specific time period
sudo journalctl -u waldur-site-agent-report.service --since "1 hour ago"
Logs are written to stdout/stderr when running manually.
Check the configuration, the connection to Waldur and the SLURM tools in one step (exits non-zero on failure):
uv run waldur_site_diagnostics -c /etc/waldur/waldur-site-agent-config.yaml
The agent has no dry-run mode; the historical loader does (--dry-run, below).
sacct and sacctmgr are executablebackend_id set, and that those SLURM
accounts existsacct --allusers only returns other users’ jobs to root, SlurmUser or a
sufficiently privileged user (see Prerequisites)Enable debug logging by setting log_level in the agent configuration file:
log_level: DEBUG
SLURM Cluster → sacct command → Usage aggregation → Unit conversion → Waldur API
↓ ↓ ↓ ↓ ↓
- Job records - CPU-minutes - Per-account - k-Hours - POST usage
- Resource - MB-minutes - Per-user - gb-Hours data
usage - Account data - Totals - Converted
values
In addition to regular usage reporting, the SLURM plugin supports loading historical usage data into Waldur. This is useful for:
Token requirements:
--user-token belongs to a staff user.--no-staff-check, except for
usage-based components in past billing periods: Mastermind only lets staff
backfill those and rejects the submission otherwise.Data Requirements:
# Load usage for specific date range
waldur_site_load_historical_usage \
--config /etc/waldur/waldur-site-agent-config.yaml \
--offering-uuid 12345678-1234-1234-1234-123456789abc \
--user-token staff-user-api-token-here \
--start-date 2024-01-01 \
--end-date 2024-03-31
--config: Path to agent configuration file (same as regular usage reporting)--offering-uuid: UUID of the Waldur offering to load data for--user-token: Staff user API token (not the offering’s regular API token)--start-date: Start date in YYYY-MM-DD format--end-date: End date in YYYY-MM-DD format--skip-user-usage: Submit resource-level totals only--no-staff-check: Skip the staff check (service-provider tokens)--dry-run: Log what would be submitted; send nothing--reconcile-stale: Zero Waldur usage records the backend no longer reports
(for example usage previously attributed to the wrong month)--resource-backend-id ID: Process only this resource; repeatableMonthly Processing:
Data Attribution:
Error Handling:
# Load all of 2024
waldur_site_load_historical_usage \
--config /etc/waldur/waldur-site-agent-config.yaml \
--offering-uuid 12345678-1234-1234-1234-123456789abc \
--user-token your-staff-token \
--start-date 2024-01-01 \
--end-date 2024-12-31
# Load Q1 2024
waldur_site_load_historical_usage \
--config /etc/waldur/waldur-site-agent-config.yaml \
--offering-uuid 12345678-1234-1234-1234-123456789abc \
--user-token your-staff-token \
--start-date 2024-01-01 \
--end-date 2024-03-31
# Load just January 2024
waldur_site_load_historical_usage \
--config /etc/waldur/waldur-site-agent-config.yaml \
--offering-uuid 12345678-1234-1234-1234-123456789abc \
--user-token your-staff-token \
--start-date 2024-01-01 \
--end-date 2024-01-31
The command logs its progress, for example:
Starting historical usage loading
Will process 12 months of data
Processing month 1/12: 2024-01 for offering 'SLURM Usage Reporting' (<uuid>)
Found 5 active resources to process
...
Historical usage loading completed successfully!
Processed 12 months from 2024-01-01 to 2024-12-31
Use --dry-run first to see what would be submitted.
For production use, redirect output to log files:
waldur_site_load_historical_usage \
--config /etc/waldur/waldur-site-agent-config.yaml \
--offering-uuid 12345678-1234-1234-1234-123456789abc \
--user-token your-staff-token \
--start-date 2024-01-01 \
--end-date 2024-12-31 \
> historical_load_2024.log 2>&1
No Staff Privileges:
Historical usage loading requires staff user privileges
--no-staff-check with a service-provider
token (not enough for past periods of usage-based components)No Resources Found:
No active resources found for offering, skipping month
backend_id values setNo Usage Data:
No usage data found for 2024-01
backend_id valuesLarge Date Ranges:
Rate Limiting:
Database Impact:
Verify Data in Waldur:
Cross-Reference with SLURM:
# The query the agent runs (CLI mode) for January 2024
sacct --noconvert --truncate --allocations --allusers \
--accounts=project1_allocation \
--starttime=2024-01-01T00:00:00 \
--endtime=2024-01-31T23:59:59 \
--format=Account,ReqTRES,Elapsed,User
With usage_tres_source: allocated the agent asks for
--format=Account,AllocTRES,ReqTRES,Elapsed,User and bills AllocTRES.
This setup is designed for usage reporting only. For a complete Waldur Site Agent deployment that includes:
You would need additional agent instances or a multi-mode configuration with different service files for each mode.
Historical Loading Integration: