import{_ as e,c as o,o as t,a as i}from"./app.457c27ae.js";const m='{"title":"Flexible notification methods","description":"","frontmatter":{},"headers":[{"level":2,"title":"Flexible notification methods","slug":"flexible-notification-methods"},{"level":2,"title":"Description of notification rules","slug":"description-of-notification-rules"},{"level":3,"title":"Basic Rules","slug":"basic-rules"},{"level":3,"title":"Special: Any-cycle transfer notification","slug":"special-any-cycle-transfer-notification"}],"relativePath":"en_US/guide/notifications.md","lastUpdated":1655199039000}',n={},a=i('
Nezha Monitoring supports monitoring of server load, CPU, memory, hard disk, data transfer, monthly data transfer, number of processes, number of connections, and sends alarm notifications when one of these items reaches a user-set limit.
#NEZHA#
is the panel message placeholder, the panel will automatically replace the placeholder with the actual message when it triggers the notification
The content of Body is in JSON
format\uFF1AWhen the request type is FORM\uFF0Cthe value is in the form of key:value
\uFF0Cvalue
can contain placeholders that will be automatically replaced when notified. When the request type is JSON It will only do string substitution and submit to the URL
directly.
Placeholders can also be placed inside the URL, and it will perform a simple string substitution when requested.
Refer to the example below, it is very flexible.
Telegram Example, contributed by @haitau
cpu
\u3001memory
\u3001swap
\u3001disk
net_in_speed
Inbound speed, net_out_speed
Outbound speed, net_all_speed
Inbound + Outbound speed, transfer_in
Inbound Transfer, transfer_out
Outbound Transfer, transfer_all
Total Transferoffline
Offline monitoringload1
\u3001load5
\u3001load15
Loadprocess_count
Number of processes Currently, counting the number of processes takes up too many resources and is not supported at the momenttcp_conn_count
\u3001udp_conn_count
Number of connections[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]
0
Cover all, use ignore
to ignore specific servers1
Ignore all, use ignore
to monitoring specific servers[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]
cover
with server id and boolean, e.g.: {"1": true, "2":false}
Complete examples:
TIP
Add an offline notification
[{"Type":"offline","Duration":10}]
TIP
Add an notification when the CPU exceeds 50% for 10s but the memory usage is below 20% for 20s
[{"Type":"cpu","Min":0,"Max":50,"Duration":10},{"Type":"memory","Min":20,"Max":0,"Duration":20}]
Can be used as monthly transfer notificatin
type
transfer_in_cycle
Inbound transfer during the cycletransfer_out_cycle
Outbound transfer during the cycletransfer_all_cycle
The sum of inbound and outbound transfer during the cyclecycle_start
Start date of the statistical cycle (can be the start date of your server's billing cycle), the time format is RFC3339, for example, the format in Beijing time zone is 2022-01-11T08:00:00.00+08:00
cycle_interval
Interval time cycle (For example, if the cycle is in days and the value is 7, it means that the statistics are counted every 7 days)
cycle_unit
Statistics cycle unit, default hour
, optional (hour
, day
, week
, month
, year
)
min/max
, cover
, ignore
Please refer to the basic rules to configure
Example: The servers with ID 3 and 4 (defined in the ignore
) are counted on the 1st of each month, and a notification is triggered when the monthly outbound transfer reaches 1TB during the cycle. [{"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}}]