generate-message-template

Generate and modify Nightingale alert notification message templates using Go template syntax.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing Nightingale (n9e) alert notification templates requires knowing Go text/template and html/template syntax, the AlertCurEvent field structure, channel-specific escaping rules, and helper functions, which is error-prone and hard to get right manually.

Core Features & Use Cases

  • Template Generation: Produces ready-to-paste message templates for DingTalk, Feishu/Lark cards, email, SMS, voice, Slack, and WeCom channels with correct escaping behavior per channel.
  • Field and Helper Reference: Applies the correct AlertCurEvent fields (RuleName, Severity, TriggerValue, TagsMap, IsRecovered) and helper functions (timeformat, formatDecimal, humanizeDuration, urlquery) for each request.
  • Customization Scenarios: Handles common modifications such as adding hostname or recovery value, formatting decimals, @-mentioning recipients, coloring by severity, and merging multiple alert events.
  • Use Case: A user asks to add the hostname and recovery value to their DingTalk alert template; the Skill outputs a complete gotemplate block with recovery-branch handling and a variable explanation.

Quick Start

Ask the assistant to write a DingTalk alert notification template for Nightingale that shows the rule name, hostname, trigger value, and recovery state.

Frequently Asked Questions about generate-message-template

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

FAQPage Schema
How do I write a Nightingale alert notification template for DingTalk?▼

Nightingale DingTalk templates use Go html/template syntax with markdown content. Reference alert fields like $event.RuleName and $event.TriggerValue, split triggered and recovered states with {{if $event.IsRecovered}}, and format timestamps with the timeformat helper.

How to add hostname and trigger value to a Nightingale message template?▼

Use {{$event.TargetIdent}} for the monitored host and {{$event.TriggerValue}} for the trigger value. For two decimal places apply {{formatDecimal $event.TriggerValue 2}}, and read label-based hosts via $labels.agent_hostname or index for keys with special characters.

Why does my Nightingale template show escaped HTML like <font> in DingTalk?▼

Most channels render through Go html/template, which escapes <, >, and & automatically. Wrap raw HTML in {{unescaped "..."}} or place tags in plain-text conditional branches as the official samples do; email uses text/template and is unaffected.

Can Nightingale templates filter which alerts get notified?▼

No, message templates only control display formatting. Filtering by environment or labels belongs in the notification rule's attributes and label_keys configuration, not in the template layer.

Why does my Nightingale recovery notification show the triggered message?▼

This usually comes from a misspelled field like {{if .IsRecoverd}}; Go templates silently take the else branch for nonexistent fields. Use the exact field {{if $event.IsRecovered}} and always include both branches.