greptimeteam/docs/greptimedb-trigger
Claude Code and agent skill by greptimeteam/docs
- community
Checking that the SKILL.md file is still in the repository.
[Enterprise only] Guide for creating GreptimeDB Triggers — periodic evaluation rules (SQL or TQL/PromQL via TQL EVAL) that fire Alertmanager-compatible webhooks when conditions are met. Use as an alternative to Prometheus alerting rules, or to host existing PromQL alerts on GreptimeDB. Triggers on phrases like \"create trigger\", \"alerting rule\", \"告警规则\", \"trigger webhook\", \"alertmanager 对接\", \"migrate prometheus alerts\", \"promql alert\".
Install
npx vskill@latest install greptimeteam/docs/greptimedb-triggerSKILL.md
GreptimeDB Trigger Guide
Enterprise only. Triggers are available only in GreptimeDB Enterprise.For open-source deployments, fall back to Prometheus Alertmanager or anexternal scheduler.
Create GreptimeDB trigger definition as an alternative to Prometheus alerting rules. A trigger periodically runs a query — a SQL SELECT or a TQL EVAL block wrapping a PromQL expression — and turns each result row into an alert instance. Most concepts from Prometheus alerting rules map directly onto trigger DDL, and existing PromQL rules can be hosted as-is through TQL EVAL.
The workflow
To create a GreptimeDB trigger, we should follow these phases:
Phase 1. Understanding GreptimeDB Trigger
First, we should read the trigger reference from the documentation.
There are pages available, use WebFetch to load and understand them:
- High-level overview and a worked example
https://docs.greptime.com/enterprise/trigger/
- Full trigger syntax reference
https://docs.greptime.com/reference/sql/trigger-syntax/
Phase 2. Syntax essentials
The ON clause accepts either:
- a plain SQL
SELECT(typical for GreptimeDB-native queries), or - a `TQL EVAL` expression that embeds a PromQL-style query — this is
the migration path for users porting Prometheus alerting rules.
TQL EVAL syntax inside ON:
See the TQL reference for the start / end / step semantics.
Example:
When the user starts from a PromQL alert rule, keep it as TQL EVAL — do not rewrite it to SQL aggregation just to fit the trigger. For cases where the rule is natively SQL, write a regular SELECT with a time window filter (e.g. WHERE ts >= NOW() - '1 minutes'::INTERVAL) and GROUP BY for per-series evaluation.
Skeleton:
Key clauses:
- `ON (<SELECT>) EVERY <interval>` — the query runs on the given
cadence. Each returned row produces one alert instance, keyed by its label set. Columns whose name or alias starts with label_ are extracted as dynamic labels (the label_ prefix is stripped); all other columns become annotations. Rows with the same label set collapse into a single alert.
- `LABELS (...)` — static labels merged into every alert instance.
These are what Alertmanager routes / groups / silences on.
- `ANNOTATIONS (...)` — static annotations for human-readable context.
- `FOR <interval>` — how long the condition must keep matching before
the alert transitions from Pending to Firing (and fires a notification). Without FOR, an alert fires on first appearance.
- `KEEP FIRING FOR <interval>` — sets a minimum firing duration. Once an
alert enters Firing, it remains firing for at least this long, even if the condition later stops matching. After that duration has elapsed, it can be marked resolved on a subsequent evaluation where the condition is absent.
- `NOTIFY (WEBHOOK ...)` — currently only the
WEBHOOKchannel is
supported, with an optional WITH (timeout='1m') parameter. Payload is compatible with Prometheus Alertmanager, so an existing Alertmanager can receive trigger alerts without glue code.
Interval notes: INTERVAL expressions may not use years or months (variable-length). Minimum granularity is 1 second.
Worked SQL example:
Lifecycle: SHOW TRIGGERS [LIKE ... | WHERE ...], SHOW CREATE TRIGGER <name>, DROP TRIGGER [IF EXISTS] <name>.
Phase 3. Configure webhook for trigger
Return a complete CREATE TRIGGER SQL statement. If the user did not provide webhook details, use a placeholder Alertmanager URL (e.g. http://localhost:9093) and tell them what to swap in.
If the user already runs a Prometheus Alertmanager, point the trigger webhook at the same Alertmanager — the alert payload is Alertmanager-native, so routing / grouping / inhibition / silencing all work unchanged.
Reference
Prometheus Alertmanager
Alertmanager is typically configured in prometheus.yml like this:
We can use this target as our webhook destination.
Step-by-step guide
https://greptime.com/blogs/2025-12-23-trigger-quick-start
Security
- Security scanPassed, 93 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/greptimedb-trigger/SKILL.md
Popularity
- Repository stars
- 45
- Repository forks
- 52
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 3 Apr 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/greptimeteam/docs/greptimedb-trigger)