Variables
Overview
A variable stores a non-sensitive, plain-text configuration value within an environment. Variables are useful for values that change between environments but are not confidential — such as hostnames, port numbers, or base URLs.
By using variables, you avoid hardcoding values into your sensor definitions. When a value changes, update the variable once and all sensors that reference it pick up the change on their next execution.
Naming rules
Variable keys must contain only uppercase letters, digits, and underscores.
Examples: API_HOST, DB_PORT, BASE_URL_V2, SMTP_SERVER.
Create a variable
- Navigate to Settings → Environments and select your environment.
- In the Variables section, click Add variable.
- Enter a key and a value.
- Save.
Each key must be unique within an environment. The same key can exist in different environments with different values — this is the intended use case.
Use a variable in a sensor
Reference a variable in any supported sensor field using the ${KEY} syntax. Onagre resolves variables at execution time, before sending the configuration to the agent.
https://${API_HOST}:${API_PORT}/health
You can combine multiple variables in the same field. If a referenced variable does not exist in the sensor's environment, the sensor will report a configuration error.
Examples
| Sensor field | Value with variables |
|---|---|
| HTTP URL | https://${API_HOST}/api/status |
| SQL query | SELECT count(*) FROM ${TABLE_NAME} |
| Port host | ${INTERNAL_HOST} |
Edit or delete a variable
- Edit: Click the variable, update the value, and save. The new value takes effect on the next sensor execution.
- Delete: Remove a variable when it is no longer needed. Make sure no active sensor references it before deleting.
Variables vs. Secrets
| Variables | Secrets | |
|---|---|---|
| Content | Non-sensitive configuration | Credentials, connection strings |
| Storage | Plain text | Encrypted (AES-GCM 256-bit) |
| Visible in UI | Yes, always readable | Write-only, never displayed |
| Syntax | ${KEY} in sensor fields |
Selected via Entrypoint dropdown |
| Use case | Hostnames, ports, URLs | Database passwords, API keys |
Summary
| Aspect | Details |
|---|---|
| Format | Key-value pairs, plain text |
| Key rules | Uppercase letters, digits, underscores only |
| Reference | ${KEY} syntax in sensor fields |
| Scope | Isolated per environment |
| Resolution | At execution time, before transmission to agent |