Bỏ qua để đến nội dung
Playbook: uptime monitors and alerts Add external uptime monitors (http, tcp, ping) from fleet discovery, wire alert channels, set server metric alert rules and event routing rules, and publish a status page from an AI agent.

Playbook: uptime monitors and alerts

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

Three alerting layers exist, all on the control plane (no agent needed for setup):

LayerWhat it watchesOperations
Uptime monitorsExternal probes of a URL or host (http, tcp, ping)uptime_*
Server metric alertsCPU, RAM, disk, swap, load, network and container health thresholds on one serverserver_alert_rules_*, server_alert_channels_*
Event routingPlatform events (agent offline, backup failed, cert expiring, …) to chat or emailnotify_connections_*, notify_destinations_*, notify_rules_*

Token: operate for monitors, rules and tests. Creating channels or connections stores a secret target, so it needs full + webhooks:admin. Deleting a monitor needs data:delete. Uptime checks and alerts are on every plan.

  1. Discover what to watch: uptime_discover suggests monitors from the fleet’s sites and apps.

  2. Create: uptime_monitors_create, or uptime_monitors_bulk_create {body: {monitors: [...]}} for up to 100 at once:

    { "body": { "name": "shop homepage", "type": "http", "target": "https://shop.example.com/",
    "intervalSec": 60, "expectCode": 200, "expectKeyword": "Add to cart",
    "channelIds": ["<uptime channel uuid>"] } }

    type is http (a URL), tcp (host:port) or ping (a host). intervalSec is at least 30.

  3. Check now: uptime_monitors_check {mid}. List and stats: uptime_monitors_list. Incidents: uptime_incidents.

  4. Pause or edit: uptime_monitors_update {mid, body: {paused: true}}.

Channels for uptime alerts: uptime_channels_list, then uptime_channels_create {body: {type: "webhook"|"slack"|"telegram"|"email", name, target}} (full + webhooks:admin). Test one with uptime_channels_test {cid}.

Public status page: uptime_status_page_set {body: {slug, title?, public?, monitorIds?}} (full). Read it back with uptime_status_page_get.

  1. Pick channels: server_alert_channels_list {id}, or create one with server_alert_channels_create {id, body: {type, name, target}} (full + webhooks:admin).

  2. Create a rule with server_alert_rules_create {id, body}:

    { "title": "Disk almost full", "metric": "disk", "operator": ">", "threshold": 90,
    "durationSec": 300, "severity": "critical", "channelIds": ["<channel uuid>"] }

    metric is one of cpu, ram, disk, swap, load, net, containers_unhealthy, containers_down, containers_update_available, mem_pressure (memory pressure %, PSI), swap_in (pages/s swapped in) or top_ip_share (% of the last minute’s requests from one client IP; the alert names the IP and site). The last three need agent 0.2.143 or newer — on older agents the rule never fires. Prefer mem_pressure/swap_in over swap: a full swap on an idle box is harmless. operator is >, < or ==.

  3. Test with server_alert_channels_test {id, cid}. Pause or edit with server_alert_rules_update.

For history, servers_metrics_history {id, query: {range: "24h"}} and containers_metrics_history {id, name} return the time series behind these alerts.

  1. notify_connections_list shows the connected apps (Slack, Telegram, Discord, Teams, Google Chat, WhatsApp, email, webhook) and their destinations.

  2. Connect a new one (full + webhooks:admin): notify_connections_create {body: {app_id, label, secret?, first_destination: {name, target}}}. Add destinations later with notify_destinations_create {id, body: {name, target}}.

  3. Route events with notify_rules_create {body}:

    { "name": "Prod incidents", "events": ["<event id>"], "min_severity": "warning",
    "scope_kind": "servers", "scope_server_ids": ["<server uuid>"],
    "destination_ids": ["<destination uuid>"], "cooldown_sec": 600, "enabled": true }

    The event ids are backup.failed, backup.done, server.down, server.up, ssl.expiring, ssl.renewed, os.updates, aiops.insight, deploy.done, deploy.failed, security.alert, resource.cap, domain.expiring, domain.dns_drift (a served domain no longer resolves to its server), cron.failed, uptime.down and uptime.up. server.down fires only after the server has been offline for 3 minutes (10 minutes after an agent update). scope_kind is all or servers.

  4. Test with notify_destinations_test {did}.

In-app notifications are listed with notifications_list and marked read with notifications_read_all. Every uptime incident writes an uptime.down item there even without a rule; outage items (server.down, uptime.down) get resolved_at when the outage ends.