Grafana Alerts & Notifications on Windows
Set up Grafana Alerting on Windows — create alert rules, configure notification channels (email, Slack, Teams, PagerDuty), manage alert groups and troubleshoot alert delivery. Covers both Unified Alerting and legacy alerting.
Grafana Alerting overview
Grafana Unified Alerting (introduced in Grafana 8, default in Grafana 9+) provides a powerful rule-based alerting engine with support for multiple notification channels simultaneously. Alerts evaluate queries at configured intervals and fire when conditions are met.
📊 Alert Rules
Define conditions on any data source query. Set thresholds, evaluate over time windows.
📬 Contact Points
Email, Slack, Teams, PagerDuty, webhook and 20+ other notification channels.
🗂 Notification Policies
Route alerts to the right team based on labels. Group and silence alerts.
Step 1 — Configure SMTP for email alerts
Email notifications require SMTP to be configured in grafana.ini. Open C:\Program Files\GrafanaLabs\grafana\conf\grafana.ini:
[smtp]
enabled = true
host = smtp.yourdomain.com:587
user = grafana-alerts@yourdomain.com
password = YourSmtpPassword
from_address = grafana-alerts@yourdomain.com
from_name = Grafana Alerts
startTLS_policy = MandatoryStartTLS
# For Office 365:
# host = smtp.office365.com:587
# startTLS_policy = MandatoryStartTLS
# For Gmail (with App Password):
# host = smtp.gmail.com:587
# user = you@gmail.com
# password = your-app-passwordRestart-Service -Name "Grafana"Step 2 — Create a Contact Point
Open Alerting menu
In Grafana, go to Alerting → Contact points → New contact point.
Add Email contact
Select Email as the type. Enter recipient addresses. Click Test to send a test notification and verify SMTP is working.
Add Microsoft Teams (optional)
Select Microsoft Teams. Paste your Teams Incoming Webhook URL. Test the connection.
Add Slack (optional)
Select Slack. Enter your Slack webhook URL and channel name (#alerts).
Step 3 — Create an Alert Rule
Navigate to Alert Rules
Go to Alerting → Alert rules → New alert rule.
Write the query
Select your data source (Prometheus, InfluxDB, etc.) and write the query. For Prometheus, a common example: avg(rate(node_cpu_seconds_total{mode!="idle"}[5m])) * 100
Set the condition
Under Define alert condition, set the threshold. Example: WHEN last() IS ABOVE 80 — fires when CPU is above 80%.
Set evaluation interval
Configure Evaluate every (e.g. 1m) and For duration (e.g. 5m) — alert fires only if the condition persists for 5 minutes.
Add labels and link to notification policy
Add labels like severity=critical and team=ops. These labels route the alert to the correct contact point via notification policies.
Notification Policies — route alerts to the right team
Go to Alerting → Notification policies. The default policy routes all alerts to the default contact point. Add child policies to route specific labels to specific channels:
# Example policy logic (configured in the UI, not YAML):
# IF label severity=critical → send to PagerDuty + Email
# IF label team=database → send to Slack #db-alerts
# Default → send to Email onlySilence and group alerts
Silence an alert (maintenance window)
Go to Alerting → Silences → New silence. Set a label matcher (e.g. severity=warning), start/end time and a comment. Matching alerts won't send notifications during the silence period.
Alert groups
Grafana groups alerts by label to reduce notification noise. Configure grouping in Alerting → Notification policies → Edit → Group by. Common grouping: by alertname and cluster.
Troubleshooting alert delivery
Test contact point
In Alerting → Contact points, click the test button next to your contact point. If the test fails, check SMTP settings and credentials.
Check alert state history
Go to Alerting → Alert rules and click the alert. The state history shows when it fired and was resolved.
Check Grafana logs
Get-Content "C:\Program Files\GrafanaLabs\grafana\data\log\grafana.log" -Tail 50 | Select-String "alerting|notification|smtp"