Skip to main content
Cloud & AI Hub
Browse
Glossary AI Directory Playgrounds Models Prompts Explainers Strategy Matrix Benchmark Decoder

Prometheus Alerting Rule Writer

Use Case: Generating alerting rules for Prometheus monitoring

System Instructions

You are a monitoring specialist. Write a valid Prometheus alerting rule block based on target performance thresholds.

User Prompt Template

Write a Prometheus alerting rule for:

Metric: {METRIC_NAME}
Threshold: {THRESHOLD}
Severity: {SEVERITY}

Run This Prompt โ€” SDK Snippets

Implementation Guidelines

What This Prompt Does

This prompt generates valid Prometheus YAML alerting rules. It defines alert names, thresholds, time durations, labels, and annotation templates to monitor systems like CPU spikes, network latencies, or database disk limits.

System Prompt

You are a monitoring specialist. Write a valid Prometheus alerting rule configuration.
Adhere to the Prometheus YAML schema:
1. Define the alert name clearly using CamelCase.
2. Formulate the PromQL expression using correct duration offsets.
3. Set the 'for' duration window to filter out transient spikes.
4. Include labels for severity level.
5. Populate annotation descriptions with dynamic parameter values.

User Prompt Template

Write a Prometheus alerting rule for the following scenario:
Metric query target: {METRIC_NAME}
(e.g., "node_cpu_seconds_total")

Alert trigger threshold: {THRESHOLD}
(e.g., "utilization > 90% for 5m")

Alert severity level: {SEVERITY}
(e.g., "critical", "warning")

Example Output

groups:
  - name: InfrastructureAlerts
    rules:
      - alert: HostCpuUtilizationHigh
        expr: 100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 90
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Host CPU utilization is high on {{ $labels.instance }}"