Creating a Grafana alert from a Prometheus metric turns a PromQL expression into a scheduled rule that Grafana can evaluate and route to a contact point. Teams use these rules when an existing dashboard metric should also page, message, or notify someone when the measured condition changes.

Grafana-managed alert rules run the query through the selected Grafana data source, reduce the returned series to a threshold condition, and store the rule in a folder and evaluation group. The Prometheus data source must already be connected, and the account creating the alert needs permission to save rules in the target folder.

A target-down rule can use 1 - up{job="prometheus"} with a threshold above 0. The rule previews as Normal while up equals 1, and it can fire after the pending period when the expression returns a value above 0.

Steps to create a Grafana alert from Prometheus metrics:

  1. Open AlertingAlert rules, then click New alert rule.
  2. Enter a rule name that identifies the Prometheus condition.
  3. Confirm the selected data source is Prometheus.
  4. Switch the query editor to Code mode.
  5. Enter the PromQL expression for the alert condition.
    1 - up{job="prometheus"}

    Replace job="prometheus" with labels that match the service or target being monitored. The expression should return one numeric value per alert instance.

  6. Click Run queries to confirm the query returns a numeric value.
  7. Click Preview alert rule condition and confirm the expected state.

    The target-down expression returns 0 while the scrape target is up, so the preview should show Normal when the target is reachable.

  8. Select the folder that should store the rule.
  9. Select an evaluation group or create a new one.

    All rules in an evaluation group run on the group interval. Use a shorter interval for fast detection and a longer interval when the query is expensive.

  10. Set the Pending period for how long the condition must stay breached before firing.
  11. Select the contact point that should receive notifications.

    Use the default notification mode to route this rule directly to a contact point. Enable Advanced options only when labels should route through notification policies.

  12. Add a Summary and Description for the notification message.
  13. Click Save.
  14. Open the saved rule and confirm the state, query, evaluation interval, and contact point.