Skip to main content
The Alerts resource allows you to view and manage alerts that are automatically triggered when your fleet monitoring rules detect conditions requiring attention.

Methods

list

Query alerts with flexible filtering options.
alerts = client.fleet.alerts.list(
    status="open",
    severity="critical",
    device_id="dev_abc123",
    rule_id="rule_xyz789",
    limit=50,
    cursor=None
)

Parameters

status
string
Filter alerts by status (e.g., “open”, “acknowledged”, “resolved”)
severity
string
Filter alerts by severity level (e.g., “low”, “medium”, “high”, “critical”)
device_id
string
Filter alerts by device ID
rule_id
string
Filter alerts by the rule that triggered them
limit
integer
Maximum number of alerts to return per page
cursor
string
Pagination cursor for fetching the next page

Returns

data
list[Alert]
List of alert objects
uid
string
Unique alert identifier
rule
string
ID of the rule that triggered this alert
device
string
Device ID associated with this alert
recording
string
Recording ID associated with this alert
severity
string
Alert severity level
status
string
Current alert status (“open”, “acknowledged”, “resolved”)
message
string
Alert message describing the condition
triggered_at
datetime
When the alert was triggered
acknowledged_at
datetime
When the alert was acknowledged
acknowledged_by
string
User who acknowledged the alert
resolved_at
datetime
When the alert was resolved
resolution_note
string
Note explaining how the alert was resolved
created_at
datetime
Alert creation timestamp
updated_at
datetime
Last update timestamp
has_more
boolean
Whether more results are available
next_cursor
string
Cursor for fetching the next page

get

Retrieve details for a specific alert.
alert = client.fleet.alerts.get("alert_def456")

Parameters

alert_id
string
required
The unique identifier of the alert

Returns

Returns an Alert object.

acknowledge

Acknowledge an alert to indicate that it has been seen and is being addressed.
alert = client.fleet.alerts.acknowledge("alert_def456")

Parameters

alert_id
string
required
The unique identifier of the alert to acknowledge

Returns

Returns the updated Alert object with status set to “acknowledged” and acknowledged_at timestamp populated.

resolve

Resolve an alert to indicate that the underlying issue has been addressed.
alert = client.fleet.alerts.resolve(
    "alert_def456",
    resolution_note="Temperature normalized after cooling system restart"
)

Parameters

alert_id
string
required
The unique identifier of the alert to resolve
resolution_note
string
Note explaining how the alert was resolved or what action was taken

Returns

Returns the updated Alert object with status set to “resolved”, resolved_at timestamp populated, and resolution_note included if provided.

Example Usage

from avala import Avala

client = Avala(api_key="your-api-key")

# List all open critical alerts
critical_alerts = client.fleet.alerts.list(
    status="open",
    severity="critical"
)

print(f"Found {len(critical_alerts.data)} critical alerts")

for alert in critical_alerts.data:
    print(f"Alert {alert.uid}: {alert.message}")
    print(f"  Device: {alert.device}")
    print(f"  Triggered at: {alert.triggered_at}")
    print(f"  Severity: {alert.severity}")

# Acknowledge an alert
if critical_alerts.data:
    first_alert = critical_alerts.data[0]
    acknowledged = client.fleet.alerts.acknowledge(first_alert.uid)
    print(f"Alert acknowledged at {acknowledged.acknowledged_at}")

# Resolve an alert with a note
resolved = client.fleet.alerts.resolve(
    first_alert.uid,
    resolution_note="Issue resolved by deploying firmware update v2.3.1"
)
print(f"Alert resolved at {resolved.resolved_at}")
print(f"Resolution: {resolved.resolution_note}")

# List alerts for a specific device
device_alerts = client.fleet.alerts.list(device_id="dev_abc123")

for alert in device_alerts.data:
    status_symbol = {
        "open": "🔴",
        "acknowledged": "🟡",
        "resolved": "🟢"
    }.get(alert.status, "⚪")
    print(f"{status_symbol} {alert.message}")

# Get detailed information about a specific alert
alert_detail = client.fleet.alerts.get("alert_def456")
print(f"Alert from rule: {alert_detail.rule}")
print(f"Status: {alert_detail.status}")
if alert_detail.resolution_note:
    print(f"Resolution: {alert_detail.resolution_note}")

Async Usage

from avala import AsyncAvala
import asyncio

async def manage_alerts():
    client = AsyncAvala(api_key="your-api-key")
    
    # List alerts
    alerts = await client.fleet.alerts.list(status="open")
    
    # Acknowledge alerts in parallel
    tasks = [
        client.fleet.alerts.acknowledge(alert.uid)
        for alert in alerts.data
    ]
    acknowledged = await asyncio.gather(*tasks)
    
    print(f"Acknowledged {len(acknowledged)} alerts")
    
    # Resolve an alert
    resolved = await client.fleet.alerts.resolve(
        alerts.data[0].uid,
        resolution_note="Automated resolution"
    )
    
asyncio.run(manage_alerts())

Alert Workflow

Alerts typically follow this lifecycle:
  1. Open: Alert is triggered by a rule and requires attention
  2. Acknowledged: Someone has seen the alert and is investigating
  3. Resolved: The underlying issue has been addressed
# Typical workflow for handling an alert
alert = client.fleet.alerts.get("alert_123")

if alert.status == "open":
    # Acknowledge that you're working on it
    alert = client.fleet.alerts.acknowledge(alert.uid)
    
    # ... perform investigation and remediation ...
    
    # Resolve with details
    alert = client.fleet.alerts.resolve(
        alert.uid,
        resolution_note="Root cause identified and fixed"
    )

Alert Channels

Alerts can be delivered through various channels including email, webhooks, Slack, PagerDuty, and more. Configure alert delivery channels through your Avala dashboard or using the webhooks resource.

Build docs developers (and LLMs) love