import{_ as o,o as s,c as a,R as e}from"./chunks/framework.44fd0451.js";const F=JSON.parse('{"title":"Notification Configuration","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"en_US/guide/notifications.md","filePath":"en_US/guide/notifications.md","lastUpdated":1718495592000}'),n={name:"en_US/guide/notifications.md"},t=e(`

Notification Configuration

Nezha Monitoring supports monitoring server load, CPU, memory, disk, traffic, monthly traffic, process count, and connection count, and sending notifications when user-defined thresholds are reached.

Flexible Notification Methods

Refer to the following notification method examples, and you can also flexibly set the push method according to your needs.

Bark Example

Click to expand/collapse

Slack Example Contributor: @白歌

Click to expand/collapse

URL Parameter Acquisition Instructions

Prepare your Slack Workspace in advance and create an App for this Workspace. If you have not created one, you can create an App at Slack API.

After creating the App, you need to add an Incoming Webhook to the App. In the App's settings page, find Incoming Webhooks, enable Activate Incoming Webhooks, and at the bottom of the page, find and click Add New Webhook to Workspace, choose a Channel, and click Allow. After creating, you will get a Webhook URL, which you will use to replace the example URL below.

Telegram Example Contributor: @白歌

Click to expand/collapse

URL Parameter Acquisition Instructions

Create a bot in Telegram and get the bot's token and your Telegram user ID.

The token and user ID are alphanumeric strings. You can get your user ID by chatting with @userinfobot on Telegram. Create a bot by chatting with @BotFather, and you will get the bot's token.

Replace botXXXXXX with your bot token and YYYYYY with your user ID in the URL below. Note that you need to chat with the bot first, otherwise the bot cannot send messages to you.

Email Notification Example - Outlook Contributor: @白歌

Click to expand/collapse

Note: SendCloud has a daily free email sending limit. This is just an example. You can choose a paid service or other similar free services. The usage method is similar.

URL Parameter Acquisition Instructions

This example uses SendCloud as the email service. You need to register an account on SendCloud, create a sender email, and then obtain the APIUSER and APIKEY here.

Replace <replaceAPIUSER> and <replaceAPIKEY> in the example URL below with your APIUSER and APIKEY, and replace <customSenderEmail> and <customRecipientEmail> with any sender and recipient email addresses.

DingTalk Group Bot Configuration Example

Click to expand/collapse

URL Parameter Acquisition Instructions

Create a bot in DingTalk in advance and get the bot's token.

The bot URL is obtained after creating a bot in the DingTalk group - Manage Bot - Create Bot. Choose custom keywords for the security method, and the Body content value must contain these keywords.

WeChat Work Group Bot Example Contributor: @ChowRex

Click to expand/collapse

Supported placeholders list

json
{
    "content": "#NEZHA#",
    "ServerName": "#SERVER.NAME#",
    "ServerIP": "#SERVER.IP#",
    "ServerIPV4": "#SERVER.IPV4#",
    "ServerIPV6": "#SERVER.IPV6#",
    "CPU": "#SERVER.CPU#",
    "MEM": "#SERVER.MEM#",
    "SWAP": "#SERVER.SWAP#",
    "DISK": "#SERVER.DISK#",
    "NetInSpeed": "#SERVER.NETINSPEED#",
    "NetOutSpeed": "#SERVER.NETOUTSPEED#",
    "TransferIn": "#SERVER.TRANSFERIN#",
    "TranferOut": "#SERVER.TRANSFEROUT#",
    "Load1": "#SERVER.LOAD1#",
    "Load5": "#SERVER.LOAD5#",
    "Load15": "#SERVER.LOAD15#",
    "TCP_CONN_COUNT": "#SERVER.TCPCONNCOUNT",  # invalid
    "UDP_CONN_COUNT": "#SERVER.UDPCONNCOUNT",  # invalid
}

This document is NOT available in English.

Group Bot Configuration Instructions - Document - WeChat Work Developer Center

You can remove or add relevant information as needed.

Notification Rule Explanation

Basic Rules

Complete Examples:

Add an offline notification:

Add an notification for CPU usage exceeding 50% for 10 seconds and memory usage below 20% for 20 seconds:

Send notifications for specific servers to specific notification groups:

Scenario example:
There are 4 servers (1, 2, 3, 4) and two notification groups (A, B).
Notify group A if servers 1 and 2 are offline for 10 minutes.
Notify group B if servers 3 and 4 are offline for 10 minutes.

First, set up notification groups A and B, then add two notification rules:

Rule 1:

Rule 2:

Flexibly using parameters can make your notification function fully utilized

Special: Any Cycle Traffic notification

Can be used for monthly traffic monitoring

Example:

For servers with IDs 3 and 4 (defined in ignore), if the monthly outbound traffic exceeds 1TB starting from the 1st of each month, send an notification:

json
[{"type":"transfer_out_cycle","max":1099511627776,"cycle_start":"2022-01-01T00:00:00+08:00","cycle_interval":1,"cycle_unit":"month","cover":1,"ignore":{"3":true,"4":true}}]

Notification Trigger Modes

Set Tasks to Execute on notifications

If you need to execute a task while sending an notification message, you can set this item.

`,44),l=[t];function p(r,c,i,u,D,y){return s(),a("div",null,l)}const C=o(n,[["render",p]]);export{F as __pageData,C as default};