create-alert-rule

Create and import Nightingale alert rules across Prometheus, SQL, and log data sources.

13.3k|1.8k|Updated Mar 3, 2020
One-click install
npx skills add https://github.com/ccfos/nightingale --skill create-alert-rule
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-alert-rule
Source: https://github.com/ccfos/nightingale/tree/main/aiagent/skill/embedded/builtin/create-alert-rule
Command: npx skills add https://github.com/ccfos/nightingale --skill create-alert-rule

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Configuring alert rules in Nightingale by hand is error-prone: you must pick the right business group and data source, write correct PromQL or SQL, and match each data source type's rule_config schema. This Skill automates the entire process, either by importing pre-validated rule packs from the integrations catalog or by hand-writing custom rules with verified schemas.

Core Features & Use Cases

  • Import validated rule packs: Browse and import ready-made alert rules for standard components (Linux, MySQL, Redis, Kafka, PostgreSQL, Elasticsearch, etc.) from the integrations directory, importing a whole pack, a batch, or a single named rule.
  • Hand-write custom rules: Create rules for Prometheus, Loki, Elasticsearch, OpenSearch, MySQL, PostgreSQL, ClickHouse, Doris, TDengine, VictoriaLogs, and Host heartbeat monitoring, with per-datasource reference docs for the exact rule_config structure.
  • Schema probing for SQL sources: Verify real databases, tables, and columns via list_databases/list_tables/describe_table before generating SQL, avoiding runtime errors from guessed names.
  • Use Case: A user asks to "add a set of alert rules for MySQL". The Skill checks available integration packs, prefers the categraf variant after probing metric data, imports the pack bound to the correct data source, and reports created/skipped/failed counts.

Quick Start

Ask the assistant to configure a set of common alert rules for your MySQL data source in the default business group.

Frequently Asked Questions about create-alert-rule

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an alert rule in Nightingale?

Use the create_alert_rule tool with a business group ID, rule name, and data source. For Prometheus, pass prom_ql, threshold, and operator directly; for other types like MySQL or Loki, pass cate and a rule_config_json built from the datasource reference docs.

How do I import prebuilt alert rules for MySQL or Linux?

Use import_alert_rule_template with the component name and rule pack file from the integrations directory. Preview rules first with preview_alert_rule_template, then import the whole pack or pass specific rule names in the names parameter.

Should I use categraf or exporter rule packs?

Prefer the categraf pack. Probe whether categraf metrics like cpu_usage_idle have data using list_metrics; if data exists, import the categraf pack, otherwise fall back to the exporter pack after confirming node_exporter metrics exist.

Why does my MySQL alert rule fail with unknown column errors?

The SQL was likely written with guessed database, table, or column names. Always probe the real schema first with list_databases, list_tables, and describe_table, then build the SQL from the returned column names.

Can I use $from and $to time variables in Nightingale SQL alerts?

Only TDengine supports $from/$to/$interval substitution in OSS Nightingale. For MySQL, PostgreSQL, ClickHouse, and Doris, use native time functions like NOW() - INTERVAL 5 MINUTE instead.

When should I not use this skill for alert rules?

Do not use it for bulk YAML imports such as awesome-prometheus-alerts URLs or node-exporter.yml files; use the import-prom-rule skill instead. This skill handles single rules, batches, and integration rule packs only.