calculate_availability
Calculate availability percentage and MTTR from alert history, with per-device breakdown and SLA error-budget tracking when a target SLO is set.
Instructions
Calculate availability percentage from alert history. Computes SLA-style uptime metrics, MTTR, and per-device breakdown from the window's cleared and active alerts, read as two lists; truncated says when the 5000-alert cap cut either read short. With target_slo it adds error_budget for the window: budget, consumed and remaining minutes, percent consumed, burn rate, projected exhaustion in days and a status (healthy, warning past 50 percent, critical past 90, exhausted).
Common mistakes: hours_back defaults to 720 (30 days). Narrow scope with device_id/group_id for performance.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "calculate_availability"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | No | Optional device group ID filter; not with device_id or device_name | |
| device_id | No | Optional device ID filter | |
| hours_back | No | Hours to look back (default 30 days) | |
| target_slo | No | Target availability percentage, such as 99.9; adds error_budget over the hours_back window | |
| device_name | No | Exact device display name; pass it or device_id, not group_id | |
| severity_threshold | No | Minimum severity for downtime (critical, error, warning, info) | error |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| portal | No | The portal the call ran against, in multi-portal mode. | |
| api_total | Yes | ||
| by_device | Yes | Availability per device name. | |
| device_id | No | ||
| truncated | Yes | ||
| hours_back | Yes | ||
| error_budget | No | ||
| mttr_minutes | Yes | ||
| incident_count | Yes | ||
| device_resolved | No | ||
| severity_threshold | Yes | ||
| availability_percent | Yes | ||
| total_uptime_minutes | Yes | ||
| total_downtime_minutes | Yes | ||
| longest_incident_minutes | Yes | ||
| measurement_window_context | No |