Skip to main content

Alert Rules

Alert rules define the conditions that must be met for an alert to be triggered. You can create rules at the monitor level or as organization-wide defaults.

Default rule

Every monitor has a default rule: alert when 2 consecutive checks fail. You can change this per monitor.

Rule conditions

ConditionDescriptionExample
status_codeHTTP status code checkstatus_code != 200
response_timeResponse time thresholdresponse_time > 5000
ssl_expiryDays until SSL cert expiresssl_expiry < 14
body_containsResponse body check!body_contains("ok")
dns_resolvedDNS resolution successdns_resolved == false
tcp_connectedTCP connection successtcp_connected == false

Condition operators

OperatorMeaning
==Equals
!=Not equals
>Greater than
>=Greater than or equal
<Less than
<=Less than or equal
containsString contains
startsWithString starts with
matchesRegex match

Severity levels

LevelColorDefault notification
info🔵 BlueEmail only
warning🟡 YellowEmail + Slack
critical🔴 RedAll channels + SMS

Configuring rules

Via the dashboard

  1. Open a monitor → "Alert Rules"
  2. Click "+ Add rule"
  3. Select condition, operator, and value
  4. Set severity and notification channels

Via YAML / API

alert_rules:
# Critical: service is completely down
- name: "Service Down"
condition: status_code != 200
consecutive_failures: 2
severity: critical
notify:
- channel: slack
target: "#ops-critical"
- channel: pagerduty
- channel: sms

# Warning: service is slow
- name: "High Latency"
condition: response_time > 3000
consecutive_failures: 3
severity: warning
notify:
- channel: slack
target: "#ops-alerts"

# Info: SSL cert expiring
- name: "SSL Expiry Warning"
condition: ssl_expiry < 30
severity: info
notify:
- channel: email
target: [email protected]

# Recover notification
recovery:
enabled: true
notify: [slack, email]

Global default rules

Set organization-wide defaults under Settings → Alert Defaults. These apply to all monitors unless overridden at the monitor level:

global_defaults:
consecutive_failures: 2
severity: critical
recovery_notifications: true
notify:
- channel: email
target: [email protected]

Alert grouping

When multiple monitors fail at the same time (e.g., during an infrastructure outage), AlertifyPro can group related alerts into a single incident:

alert_grouping:
enabled: true
group_by: [region, service_tag]
window: 5m # Group alerts within a 5-minute window

Testing alert rules

Use the "Test alert" button in the dashboard to send a test notification through all configured channels — verifying your Slack webhook, email, and SMS without waiting for an actual failure.