Ankra alerts webhooks

From ankraio/ankra-cli · View interactive version

Ankra alerts webhooks is an AI agent skill from the GitHub repository ankraio/ankra-cli. Route Ankra's platform notifications to Slack, Microsoft Teams, Discord, PagerDuty or a custom webhook - creating destinations (webhook URLs or bot channels), routing rules that filter by kind, severity and cluster with include/exclude modes and priorities, previewing which destinations a notificati

How to use this skill

Skill file

Ankra alerts and webhooks

Ankra emits notifications (a failed execution, a degraded resource, a firing alert trigger, a

GitOps sync failure, an offline agent, new severe CVEs). Destinations are where they can be

delivered; routes decide which notification reaches which destination. Both are managed with

ankra alerts.

notification (kind, severity, cluster) → routes (filters, priority) → destinations (Slack/Teams/PagerDuty/webhook)

Recommended path

organisation level - one destination, a critical route with --stop-on-match, one route for

the platform kinds - so every cluster, including ones created later, is covered.

workload alerts arrive in one place.

(ankra-troubleshooting, ankra-ai-agents) rather than starting from raw logs.

committed to Git.

Destinations

Two shapes: a webhook URL, or a bot channel for Slack/Teams workspaces connected to the

organisation.

ankra alerts destinations create --name ops-slack \
  --url https://hooks.slack.com/services/...
ankra alerts destinations create --name oncall --type pagerduty \
  --url https://events.pagerduty.com/...
ankra alerts destinations channels                    # channel ids the Ankra bot can post to
ankra alerts destinations channels --provider teams
ankra alerts destinations create --name ops-teams --type teams \
  --channel-id 19:abc@thread.tacv2 --teams-tenant-id <tenant>

ankra alerts destinations list
ankra alerts destinations get <destination-id>
ankra alerts destinations update <destination-id> ...
ankra alerts destinations delete <destination-id>

receiver and selects the default payload format; --template-file overrides the payload with

your own template.

the organisation, and "not available" means the bot service is not configured on the

platform. Neither is an error - connect the integration first (ankra-ai-gateway).

Test before relying on it - both forms exit non-zero on a failed delivery, so CI can gate on

them:

ankra alerts destinations test <destination-id>
ankra alerts destinations test-url --url https://example.com/hook --template-file payload.json

test-url sends to an ad-hoc URL without storing a destination - the right way to validate a

webhook before it goes anywhere near configuration.

Routes

Every filter is optional; a route with no filters matches every notification.

ankra alerts routes create --destination-id <id> --severity critical
ankra alerts routes create --destination-id <id> --kinds execution_failed,gitops_sync_failed
ankra alerts routes create --destination-id <id> --cluster-id <cluster-id> --severity warning
ankra alerts routes create --destination-id <id> --kind agent_offline --mode exclude --stop-on-match
# one application's default-branch CI failures, pull requests left out
ankra alerts routes create --destination-id <id> --kinds pipeline_run_failed,image_gate_blocked \
  --application <name-or-id> --reference-pattern main

ankra alerts routes list
ankra alerts routes update <route-id> ...
ankra alerts routes delete <route-id>

Filters and mechanics:

alert_trigger_fired, gitops_sync_failed, agent_offline, security_new_severe_cves, and the

other platform notification kinds. --kind (one), --kinds (list), or --exclude-kinds

(everything except these).

mute one noisy kind from a destination that otherwise gets everything.

lower-priority routes once this one matches. Together they express "critical goes to on-call and

only on-call".

notifications belong to the organisation, not a cluster, so a --cluster-id route never matches

them - scope those with the next two flags.

gates, previews, approval requests).

refs/heads/main) is pushes to main and never a pull request targeting main; pull/* is every

pull request; release/* one path segment, release/** any depth; refs/tags/v* tags.

stays broken is reminded about (critical after 1h, 4h, 12h, then daily; warning after 4h, then

daily; info never); a card that resolves and comes back is announced again. The built-in Slack

card marks repeats "Still firing" or "Reopened", and templates can read {{delivery_reason}}.

Preview and test routing

preview is the answer to "where would this go?" - and to "why did that page fire?":

ankra alerts routes preview --kind alert_trigger_fired --severity critical
ankra alerts routes preview --kind alert_trigger_fired --severity critical --alert-id <alert-id>
ankra alerts routes preview --kind gitops_sync_failed --severity warning --cluster-id <id> -o json
ankra alerts routes preview --kind pipeline_run_failed --severity warning --application <app> --reference refs/heads/main
ankra alerts routes test <route-id>          # queue a real sample through the route

Nothing is delivered by preview and nothing changes - it prints the destinations a hypothetical

notification would reach and the reason each matched. **Pass --alert-id whenever previewing an

alert firing**: an alert can carry its own destination list, a destination reached by both that

list and a routing rule is delivered to once, and without the id the preview cannot tell you which

rule that affects.

routes test queues a real sample; delivery is asynchronous, so it returns the delivery id once

queued, not once the receiver accepted it - destinations test is the synchronous check.

A sane starting layout

ankra alerts destinations create --name oncall --type pagerduty --url https://events.pagerduty.com/...
ankra alerts destinations create --name ops-slack --url https://hooks.slack.com/services/...

ankra alerts routes create --destination-id <oncall> --severity critical --priority 10 --stop-on-match
ankra alerts routes create --destination-id <ops-slack> --severity warning
ankra alerts routes create --destination-id <ops-slack> --kinds gitops_sync_failed,agent_offline

Critical pages on-call and stops; warnings and platform events land in chat. With a single on-call

channel, point both route sets at the same destination. For the estate, add the kinds that matter

on every cluster:

ankra alerts routes create --destination-id <id> \
  --kinds execution_failed,resource_deployment_failed,resource_health_degraded,gitops_sync_failed,agent_offline,security_new_severe_cves

Alert rules, AI analysis and alerts from outside

degraded, AND/OR conditions) are authored in the portal under Alerts or with

ankra alerts rules create -f alert.yaml (the platform's create body, YAML or JSON).

ankra alerts rules list|get|update|delete manage them (alerts.manage to change one);

ankra alerts rules disable <id> mutes one and keeps its history (alerts.write), and

ankra alerts triggers acknowledge|snooze <alert-id> <trigger-id> act on one firing.

chart, found by its labels) mute the in-cluster alerts it routes, not Ankra's alert rules:

ankra cluster alertmanager silences list (clusters.read),

silences create --matcher alertname=KubeVersionMismatch --duration 2w --comment "why"

(name=~regex for a regex, at least one exact matcher, 5m to 30d) and

silences expire <id> (alerts.write; asks first). --namespace/--service name the

Alertmanager when a cluster runs several.

root cause and recommended actions - on the firing and in AI → Inbox. A firing can also

start auto-remediation; read its envelope with ankra ai remediation policy (changing it is an

admin action in the portal).

notifier posts to <platform>/webhooks/alerts/<credential-id> with the token as a Bearer

Authorization header (or X-Ankra-Alert-Token). create prints the webhook URL and the token

once; --token-file writes the token to a new 0600 file instead, so it never reaches a terminal.

A rebind moves the cluster pin or scope without touching the token:

ankra alerts ingest-credentials create --name hel1-alertmanager --cluster prod --token-file ./ingest-token
ankra alerts ingest-credentials list                      # a pin to a deleted cluster shows BROKEN
ankra alerts ingest-credentials rebind <id> --cluster prod
ankra alerts ingest-credentials rebind <id> --unpin --scope platform   # scope: cluster, platform, mixed
ankra alerts ingest-credentials delete <id>               # revokes the token; asks first, --yes skips

Destinations and routes are also Terraform resources (ankra_alert_destination,

ankra_alert_route) - pick one source of truth per object (ankra-terraform).

Rules

alerts get ignored, which is worse than no alerts.

Git; a custom endpoint must be HTTPS and validate the payload.

is invisible.

Related skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.