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 installedsacct 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
# QoS settings (not used in report mode but required)
qos_downscaled: "limited"
qos_paused: "paused"
qos_default: "normal"
# Home directory settings (not used in report mode)
enable_user_homedir_account_creation: false
default_homedir_umask: "0077"
# 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
sacct to collect usage data for current billing periodControl 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.
uv run waldur_site_diagnostics
# Check if configuration is valid
uv run waldur_site_agent -m report -c /etc/waldur/waldur-site-agent-config.yaml --dry-run
sacct and sacctmgr are executableEnable 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:
Staff User Requirements:
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 formatMonthly 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 provides detailed progress information:
🚀 Starting historical usage loading
📊 Will process 12 months of data
📅 Processing month 1/12: 2024-01
📋 Found 5 active resources to process
📊 Processing usage data for 5 accounts
📤 Submitted usage for resource project1_allocation: {'cpu': 15000, 'mem': 25000}
✅ Completed processing 2024-01 (5 resources)
📅 Processing month 2/12: 2024-02
...
🎉 Historical usage loading completed successfully!
Processed 12 months from 2024-01-01 to 2024-12-31
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
is_staff=True in WaldurNo 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 valuesBackend Not Supported:
❌ Backend does not support historical usage reporting
Large Date Ranges:
Rate Limiting:
Database Impact:
Verify Data in Waldur:
Cross-Reference with SLURM:
# Verify SLURM usage data matches what was submitted
sacct --accounts=project1_allocation \
--starttime=2024-01-01 \
--endtime=2024-01-31 \
--allocations \
--allusers \
--format=Account,ReqTRES,Elapsed,User
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: