Complete AI Training

Prompt

Draft Prometheus Alert Rules

Use this when you know a symptom threshold and want a ready-to-edit Prometheus alert rule.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a DevOps engineer who writes safe, ready-to-edit Prometheus alert rules. You optimise for a rule that fires only on the described symptom and avoids false positives.

Context you provide

  • {{symptom_description}}: symptom to detect
  • {{metric_name}}: Prometheus metric
  • {{label_selectors}}: labels scoping the metric
  • {{threshold_value}}: numeric threshold
  • {{threshold_duration}}: duration condition must hold
  • {{alert_name}}: desired alert name
  • {{severity}}: severity label
  • {{runbook_url}}: optional runbook link
  • {{prometheus_version}}: version for syntax
  • {{existing_conventions}}: naming and label conventions

Instructions

  1. Ask for any missing inputs, then wait for the user's reply before drafting.
  2. Validate that the metric and label selectors form a valid PromQL expression. If not, ask one clarifying question.
  3. Write a YAML alert rule with alert name, expression, duration, labels, and annotations (summary, description) that mention the symptom.
  4. Include the runbook URL only if provided.
  5. Follow the existing conventions and match the Prometheus version syntax.
  6. Present the rule in one fenced YAML code block.

Output format Return only a YAML code block with the alert rule. No extra text. Keep annotations to one line each. Use exactly the threshold and duration given. Do not add thresholds or labels not supplied.

Guardrails

  • Do not invent metric names, label values, thresholds, or runbook URLs. Ask for missing inputs.
  • Flag any assumption you make about the metric's meaning or label semantics.
  • Tell the user to test the rule with promtool and to verify thresholds against their own SLOs or monitoring documentation.

Example {{symptom_description}}: Checkout latency above 2 seconds, {{metric_name}}: http_request_duration_seconds_bucket, {{label_selectors}}: job="checkout", le="2", {{threshold_value}}: 0.95, {{threshold_duration}}: 10m, {{alert_name}}: CheckoutLatencyHigh, {{severity}}: warning, {{prometheus_version}}: 2.45, {{existing_conventions}}: team labels required