User Alerts

Application alerting on the ayedo SDP with Grafana Alerting: alert rules, contact points (Slack, Teams, email, webhook), notification policies, and silences.

User Alerts

On the ayedo Software Delivery Platform (SDP), you configure notifications for your own applications directly via Grafana Alerting. This enables you to monitor both metrics from VictoriaMetrics and log patterns from VictoriaLogs and route alerts to your team's existing channels.

Architecture Overview

VictoriaMetrics (App & Pod Metrics)   ──┐
                                        ├──► Grafana Alerting (Rules & Policies) ──► Contact Points
VictoriaLogs (App Logs)               ──┘                                            (Slack, Teams, Email, Webhook)

Everything you need for your alerts — rule definitions, routing, grouping, and temporary silences — is managed centrally in the Grafana UI under Alerting.

1. Setting Up Contact Points

A Contact Point defines where notifications are delivered.

  1. In Grafana, open Alerting → Contact points.
  2. Click Add contact point and assign a unique name (e.g., acme-backend-slack).
  3. Select the desired integration type and enter the credentials:
Channel Typical Configuration
Slack Incoming webhook URL or bot token + target channel (e.g., #acme-alerts)
Microsoft Teams Incoming webhook URL of the Teams channel
Email One or more recipient addresses (semicolon-separated)
Webhook Any HTTPS endpoint (e.g., for incident tools, ticketing systems, or custom automations)
PagerDuty / Opsgenie Integration key / API key of your on-call system
  1. Click Test to trigger a test notification, then save the contact point.

2. Creating Alert Rules

An Alert Rule periodically evaluates a query against VictoriaMetrics or VictoriaLogs and transitions to Pending and then Firing when a threshold is breached.

Navigate to Alerting → Alert rules → New alert rule and select Grafana-managed alert rule:

  1. Name & folder: Choose a descriptive name and store the rule in your team's folder (e.g., acme-production).
  2. Query (Query A): Select your data source (VictoriaMetrics or VictoriaLogs) and write the query.
  3. Expression & threshold: Define the trigger condition using Reduce (e.g., Last) and Threshold.
  4. Evaluation behavior: Set the evaluation interval (e.g., 1m) and Pending Period (for, e.g., 5m) to smooth out short spikes.
  5. Labels & annotations: Add routing labels (e.g., severity=critical, team=acme-backend) along with a clear Summary, Description, and optionally a Runbook URL.

Example Queries for VictoriaMetrics (MetricsQL)

Repeated pod restarts (CrashLoop):

sum by (namespace, pod) (
  increase(kube_pod_container_status_restarts_total{namespace="acme-production"}[15m])
) > 2

High HTTP 5xx error rate of an application:

sum(rate(http_requests_total{namespace="acme-production", status=~"5.."}[5m]))
/
sum(rate(http_requests_total{namespace="acme-production"}[5m])) > 0.05

High memory utilization relative to container limit:

sum by (pod) (container_memory_working_set_bytes{namespace="acme-production", container!=""})
/
sum by (pod) (kube_pod_container_resource_limits{namespace="acme-production", resource="memory"}) > 0.85

Persistently unavailable replicas of a Deployment:

kube_deployment_status_replicas_unavailable{namespace="acme-production"} > 0

Example Query for VictoriaLogs (LogsQL)

Spike in application errors in logs:

kubernetes.pod_namespace:"acme-production" AND level:"error" | stats count() as error_count

Configure a threshold condition in Grafana (e.g., error_count > 20 over a 5-minute evaluation window) to be notified of sudden error spikes.

3. Configuring Notification Policies

Under Alerting → Notification policies, you control which alerts are routed to which contact point.

  • Default Policy: Defines the default contact point and grouping behavior (Group by, e.g., alertname, namespace).
  • Nested Policies (Label Matchers): Route alerts specifically based on labels:
  • team = acme-backend and severity = critical → on-call webhook / #acme-critical
  • team = acme-backend and severity = warning → #acme-warnings or email

Key Timing Parameters

Parameter Effect
Group wait Short wait before sending the first notification to bundle related alerts in a group (e.g., 30s).
Group interval Interval between updates when new alerts are added to the same group (e.g., 5m).
Repeat interval Interval at which a still-active alert is re-sent (e.g., 4h).

4. Silences for Maintenance and Releases

When planned releases, database migrations, or maintenance tasks may briefly trigger errors or restarts, selectively suppress individual notifications using a Silence:

  1. Open Alerting → Silences → Add silence.
  2. Set the start and end time.
  3. Add one or more label matchers (e.g., namespace = acme-staging or alertname = HighErrorRate).
  4. Add a brief comment (reason and owner) and save the silence.

Best Practices Against Alert Fatigue

  • Separate clear severity levels: Reserve severity=critical for acute user impact and severity=warning for early warnings (e.g., rising utilization).
  • Set a pending period (for): Avoid immediate firing on single spikes — values between 3m and 10m reliably filter out brief rollouts.
  • Write actionable messages: Every alert should clearly state in Summary and Description which service is affected, what state it is in, and where to find the team runbook or dashboard.
  • Alert on symptoms rather than causes alone: Prioritize user-facing effects (error rate, latency, unavailable pods) and supplement selectively with capacity early warnings.
  • Choose no-data behavior deliberately: Specify per rule whether missing data should evaluate as OK, Alerting, or Keep Last State (e.g., for infrequent CronJobs or after scale-to-zero).

Further Reading