Prometheus Alertmanager
Prometheus Alertmanager can send alerts directly to OpsFusion using its native webhook format — no code changes needed on your end.
See API Overview for authentication and finding your Account ID/Team ID. See Send Alerts if you’re integrating a non-Prometheus tool instead.
Quick Start
Section titled “Quick Start”Add the following to your alertmanager.yml:
receivers: - name: 'opsfusion' webhook_configs: - url: 'https://api.opsfusion.cloud/v1/account/YOUR_ACCOUNT_ID/push/alertmanager' send_resolved: true max_alerts: 25 http_config: authorization: type: Bearer credentials_file: /etc/alertmanager/opsfusion-apikey.txt # Optional: Set the default team and severity http_headers: ofteamid: values: ["YOUR_TEAM_ID"] ofseverity: values: ["2"]
route: receiver: 'opsfusion' group_wait: 10s group_interval: 10s repeat_interval: 1hAlert Configuration Options
Section titled “Alert Configuration Options”OpsFusion supports flexible alert routing using a priority chain system. You can set team ID and severity at multiple levels, and OpsFusion will use the most specific value available.
Priority Chain
Section titled “Priority Chain”For Team ID:
- Per-alert annotation (highest priority) -
ofteamidin alert annotations - Webhook header -
ofteamidheader in Alertmanager config - Default Team ID (fallback) - Falls back to your account’s default team ID if no team is specified
For Severity:
- Per-alert annotation (highest priority) -
ofseverityin alert annotations - Webhook header -
ofseverityheader in Alertmanager config - Default (fallback) - Defaults to
3(info) if not specified
Severity Values
Section titled “Severity Values”Severity can be set using either numeric or text values:
| Numeric | Text | Level | When to Use |
|---|---|---|---|
"1" | "critical" | Critical | Service down, data loss, security breach |
"2" | "warning" | High | Degraded performance, approaching limits |
"3" | "info" | Medium/Low | Warning conditions, informational |
Configuration Examples
Section titled “Configuration Examples”Option 1: Per-Alert Control
Set severity and team in each Prometheus alert rule for maximum flexibility:
groups: - name: production-alerts rules: - alert: HighCPU expr: cpu_usage > 90 for: 5m annotations: ofteamid: "1234567890123" # Backend team ofseverity: "critical" # or use "1" summary: "High CPU usage on {{ $labels.instance }}" description: "CPU usage is {{ $value }}% for 5 minutes"
- alert: HighMemory expr: memory_usage > 85 for: 10m annotations: ofteamid: "9876543210987" # Platform team ofseverity: "warning" # or use "2" summary: "High memory usage on {{ $labels.instance }}" description: "Memory usage is {{ $value }}%"Option 2: Webhook-Level Defaults
Set team and severity at the webhook level when all alerts should go to the same team:
receivers: - name: 'opsfusion-backend' webhook_configs: - url: 'https://api.opsfusion.cloud/v1/account/YOUR_ACCOUNT_ID/push/alertmanager' http_config: headers: ofteamid: "1234567890123" ofseverity: "2"Then use minimal alert annotations:
groups: - name: example rules: - alert: HighCPU expr: cpu_usage > 90 for: 5m annotations: summary: "High CPU usage on {{ $labels.instance }}" description: "CPU usage is {{ $value }}% for 5 minutes" # teamId and severity inherited from webhook headersOption 3: Mixed Approach
Set defaults at webhook level, override for specific alerts:
# Alertmanager webhook with defaultsreceivers: - name: 'opsfusion' webhook_configs: - url: 'https://api.opsfusion.cloud/v1/account/YOUR_ACCOUNT_ID/push/alertmanager' http_config: headers: ofteamid: "1234567890123" # Default team ofseverity: "2" # Default to warning# Alert rules - override when neededgroups: - name: alerts rules: - alert: ServiceDown expr: up == 0 annotations: ofseverity: "critical" # Override default severity summary: "Service {{ $labels.job }} is down" description: "Instance {{ $labels.instance }} is unreachable"
- alert: HighLatency annotations: summary: "High latency detected" description: "P95 latency is {{ $value }}ms" # Uses webhook defaults (team + warning severity)Option 4: Dynamic Severity from the Alert Value
ofseverity is templated the same way summary/description already are, so it doesn’t have to be a static string per rule — it can be computed from $value at evaluation time, using the same Go template conditionals Prometheus supports everywhere else in annotations:
groups: - name: production-alerts rules: - alert: HighCPU expr: cpu_usage > 80 for: 5m annotations: ofseverity: '{{ if gt $value 95.0 }}critical{{ else if gt $value 85.0 }}warning{{ else }}info{{ end }}' summary: "High CPU usage on {{ $labels.instance }}" description: "CPU usage is {{ $value }}% for 5 minutes"This sends critical above 95%, warning above 85%, and info otherwise — all from one alert rule, without needing separate rules per severity threshold.
Request Details
Section titled “Request Details”Send alerts in Prometheus Alertmanager webhook format.
Request URL
Section titled “Request URL”https://api.opsfusion.cloud/v1/account/{accountId}/push/alertmanagerReplace {accountId} with your OpsFusion account ID.
Authorization
Section titled “Authorization”All requests must include authentication in the Authorization header.
Authorization: YOUR_API_KEYSee Create an API Key for instructions on generating API keys.
Path Parameters
Section titled “Path Parameters”| Parameter | Required | Description |
|---|---|---|
accountId | Yes | Your OpsFusion account ID |
Request Headers
Section titled “Request Headers”| Header | Required | Value | Description |
|---|---|---|---|
Authorization | Yes | YOUR_API_KEY | Your OpsFusion API key |
Content-Type | Yes | application/json | Request content type |
ofteamid | No | 13-digit team ID | Default team for all alerts (see Priority Chain) |
ofseverity | No | "1", "2", "3", "critical", "warning", or "info" | Default severity for all alerts (see Priority Chain) |
Request Body
Section titled “Request Body”The request body follows the Prometheus Alertmanager webhook format.
Root Object
Section titled “Root Object”| Field | Type | Required | Description |
|---|---|---|---|
alerts | array | Yes | Array of alert objects (1-25 alerts) |
Alert Object
Section titled “Alert Object”| Field | Type | Required | Description |
|---|---|---|---|
status | string | Yes | "firing" or "resolved" |
labels | object | Yes | Alert labels (max 50 labels, key 1-64 characters, value 1-128 characters) |
annotations | object | Yes | Alert annotations containing required fields |
Annotations Object
Section titled “Annotations Object”| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
ofteamid | string | No | Team ID for this alert (overrides header) | Exactly 13 digits |
ofseverity | string | No | Severity level (overrides header) | "1", "2", "3", "critical", "warning", or "info" |
summary | string | Yes | Brief alert summary | 1-200 characters |
description | string | Yes | Detailed description | 1-2048 characters |
Constraints
Section titled “Constraints”- Alerts array: 1-25 alerts per request
- Summary: Automatically truncated to 200 characters
- Description: Automatically truncated to 2048 characters
- Status conversion:
"firing"→ status 1,"resolved"→ status 3 - Labels - Max 50 key-value pairs, each key 1-64 characters, and each value 1-128 characters
Example Request
Section titled “Example Request”Example 1: With per-alert team and severity
curl -X POST 'https://api.opsfusion.cloud/v1/account/YOUR_ACCOUNT_ID/push/alertmanager' \ -H 'Authorization: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "alerts": [ { "status": "firing", "labels": { "alertname": "HighCPU", "instance": "web-server-01", "job": "node-exporter" }, "annotations": { "ofteamid": "1234567890123", "ofseverity": "critical", "summary": "High CPU usage detected", "description": "CPU usage is above 90% for 5 minutes" } } ] }'Example 2: With webhook headers (no team/severity in annotations)
curl -X POST 'https://api.opsfusion.cloud/v1/account/YOUR_ACCOUNT_ID/push/alertmanager' \ -H 'Authorization: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -H 'ofteamid: 1234567890123' \ -H 'ofseverity: 2' \ -d '{ "alerts": [ { "status": "firing", "labels": { "alertname": "HighCPU", "instance": "web-server-01" }, "annotations": { "summary": "High CPU usage detected", "description": "CPU usage is above 90% for 5 minutes" } } ] }'Response codes and error handling are the same as the Standard endpoint — see Send Alerts.
Troubleshooting
Section titled “Troubleshooting”400 Bad Request
- Verify JSON is properly formatted
- Check that all required fields are present
- Ensure field values meet constraints (e.g.,
ofteamidis 13 digits) - Verify
ofseverityuses an allowed value
403 Forbidden
- Check that your API key is valid and not expired
- Verify you’re using the correct Authorization header format
404 Not Found
- Verify the account ID in the URL path is correct
Support
Section titled “Support”For integration support:
- Email: support@opsfusion.cloud
- See Send Alerts for the full API reference