64 lines
33 KiB
HTML
64 lines
33 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en-US">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
<title>Flexible notification methods | Nezha Monitoring</title>
|
||
<meta name="description" content="Nezha Monitoring is a lightweight O&M tool">
|
||
<link rel="stylesheet" href="/assets/style.0b9f658b.css">
|
||
<link rel="modulepreload" href="/assets/chunks/AlgoliaSearchBox.98396bc7.js">
|
||
<link rel="modulepreload" href="/assets/app.3817bf4e.js">
|
||
<link rel="modulepreload" href="/assets/en_US_guide_notifications.md.8baa7836.lean.js">
|
||
|
||
<meta name="twitter:title" content="Flexible notification methods | Nezha Monitoring">
|
||
<meta property="og:title" content="Flexible notification methods | Nezha Monitoring">
|
||
</head>
|
||
<body>
|
||
<div id="app"><!--[--><div class="theme"><header class="nav-bar" data-v-675d8756><div class="sidebar-button" data-v-675d8756><svg class="icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z" class></path></svg></div><a class="nav-bar-title" href="/en_US/" aria-label="Nezha Monitoring, back to home" data-v-675d8756 data-v-cc01ef16><!----> Nezha Monitoring</a><div class="flex-grow" data-v-675d8756></div><div class="nav" data-v-675d8756><nav class="nav-links" data-v-675d8756 data-v-eab3edfe><!--[--><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item active" href="/en_US/" data-v-b8818f8c>User Guide <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/case/index" data-v-b8818f8c>Community Projects <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/developer/index" data-v-b8818f8c>Development Manual <!----></a></div></div><!--]--><div class="item" data-v-eab3edfe><div class="nav-dropdown-link" data-v-eab3edfe data-v-56bf3a3f><button class="button" data-v-56bf3a3f><span class="button-text" data-v-56bf3a3f>Languages</span><span class="right button-arrow" data-v-56bf3a3f></span></button><ul class="dialog" data-v-56bf3a3f><!--[--><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item" href="/guide/notifications.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>简体中文</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item active" href="/en_US/guide/notifications.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>English</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><!--]--></ul></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item isExternal" href="https://github.com/nezhahq/nezhahq.github.io" target="_blank" rel="noopener noreferrer" data-v-b8818f8c>GitHub <svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15" data-v-b8818f8c><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div></div></nav></div><!--[--><!--[--><div class="algolia-search-box" id="docsearch"></div><!--]--><!--]--></header><aside class="sidebar" data-v-83e92a68><nav class="nav-links nav" data-v-83e92a68 data-v-eab3edfe><!--[--><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item active" href="/en_US/" data-v-b8818f8c>User Guide <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/case/index" data-v-b8818f8c>Community Projects <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/developer/index" data-v-b8818f8c>Development Manual <!----></a></div></div><!--]--><div class="item" data-v-eab3edfe><div class="nav-dropdown-link" data-v-eab3edfe data-v-56bf3a3f><button class="button" data-v-56bf3a3f><span class="button-text" data-v-56bf3a3f>Languages</span><span class="right button-arrow" data-v-56bf3a3f></span></button><ul class="dialog" data-v-56bf3a3f><!--[--><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item" href="/guide/notifications.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>简体中文</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item active" href="/en_US/guide/notifications.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>English</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><!--]--></ul></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item isExternal" href="https://github.com/nezhahq/nezhahq.github.io" target="_blank" rel="noopener noreferrer" data-v-b8818f8c>GitHub <svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15" data-v-b8818f8c><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div></div></nav><!--[--><!--]--><ul class="sidebar-links" data-v-83e92a68><!--[--><li class="sidebar-link"><p class="sidebar-link-item">Installation Manual</p><ul class="sidebar-links"><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/dashboard">Install Dashboard</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/agent">Install Agent</a><!----></li></ul></li><li class="sidebar-link"><p class="sidebar-link-item">Admin Panel</p><ul class="sidebar-links"><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/servers">Servers</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/services">Services</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/tasks">Tasks</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item active" href="/en_US/guide/notifications">Notifications</a><ul class="sidebar-links"><li class="sidebar-link"><a class="sidebar-link-item" href="#flexible-notification-methods">Flexible notification methods</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="#description-of-notification-rules">Description of notification rules</a><ul class="sidebar-links"><li class="sidebar-link"><a class="sidebar-link-item" href="#basic-rules">Basic Rules</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="#special-any-cycle-transfer-notification">Special: Any-cycle transfer notification</a><!----></li></ul></li><li class="sidebar-link"><a class="sidebar-link-item" href="#description-of-mode-of-triggering-notification">Description of mode of triggering notification</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="#set-the-task-to-be-executed-when-notification">Set the task to be executed when notification</a><!----></li></ul></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/settings">Settings</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/api">API</a><!----></li></ul></li><li class="sidebar-link"><p class="sidebar-link-item">FAQ</p><ul class="sidebar-links"><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/q2">Agent cannot start/on-line. Steps to review logs and troubleshoot</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/q3">Steps for Reverse Proxy gRPC Ports (support Cloudflare CDN)</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/q4">Real-time channel disconnection/online terminal connection failure</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/q5">Steps to perform data migration, backup and recovery</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/q6">Steps to set up monthly reset data statistics</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/q7">Steps to customize Agent monitoring items</a><!----></li></ul></li><li class="sidebar-link"><p class="sidebar-link-item">Troubleshooting Guide</p><ul class="sidebar-links"><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/dashboardq">Dashboard</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/agentq">Agent</a><!----></li><li class="sidebar-link"><a class="sidebar-link-item" href="/en_US/guide/loginq">Login</a><!----></li></ul></li><!--]--></ul><!--[--><!--]--></aside><div class="sidebar-mask"></div><main class="page" data-v-7eddb2c4><div class="container" data-v-7eddb2c4><!--[--><!--]--><div style="position:relative;" class="content" data-v-7eddb2c4><div><p>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.<br><br><br></p><h2 id="flexible-notification-methods" tabindex="-1">Flexible notification methods <a class="header-anchor" href="#flexible-notification-methods" aria-hidden="true">#</a></h2><p><code>#NEZHA#</code> is the panel message placeholder, the panel will automatically replace the placeholder with the actual message when it triggers the notification</p><p>The content of Body is in <code>JSON</code> format:<strong>When the request type is FORM</strong>,the value is in the form of <code>key:value</code>,<code>value</code> can contain placeholders that will be automatically replaced when notified. <strong>When the request type is JSON</strong> It will only do string substitution and submit to the <code>URL</code> directly.</p><p>Placeholders can also be placed inside the URL, and it will perform a simple string substitution when requested.</p><p>Refer to the example below, it is very flexible.</p><ul><li><p><strong>Bark Example</strong></p><ul><li><p>Name: Bark</p></li><li><p>URL: The first part is the key, followed by three matches/: key/: body or/: key/: title/: body or/: key/: category/: title/: body</p></li><li><p>Request method: GET</p></li><li><p>Request Type: Default</p></li><li><p>Body: null</p></li><li><p>Name: Bark</p></li><li><p>URL:/push</p></li><li><p>Request method: POST</p></li><li><p>Request type: FORM</p></li><li><p>Body: <code>{"title": "#SERVER.NAME#","device_key":"xxxxxxxxx","body":"#NEZHA#","icon":" https://xxxxxxxx/nz.png "}</code></p></li></ul></li><li><p><strong>Telegram Example, contributed by <a href="https://github.com/haitau" target="_blank" rel="noopener noreferrer">@haitau</a></strong></p><ul><li>Name:Telegram Robot message notification</li><li>URL:<a href="https://api.telegram.org/botXXXXXX/sendMessage?chat_id=YYYYYY&text=#NEZHA#" target="_blank" rel="noopener noreferrer">https://api.telegram.org/botXXXXXX/sendMessage?chat_id=YYYYYY&text=#NEZHA#</a></li><li>Request method: GET</li><li>Request type: default</li><li>Body: null</li><li>Notes for this method:The XXXXXX in botXXXXXX is the token provided when you follow the official @Botfather in Telegram and enter /newbot to create a new bot. (In the line after <em>Use this token to access the HTTP API</em>). The 'bot' are essential. After creating a bot, you need to talk to the BOT in Telegram (send a random message) before you can send a message by using API. YYYYYY is Telegram user's ID, you can get it by talking to the bot @userinfobot.</li></ul></li><li><p><strong>Email notification example - Outlook</strong></p><ul><li>Name: MS Mail Notification</li><li>URL:<a href="https://graph.microsoft.com/v1.0/me/microsoft.graph.sendMail" target="_blank" rel="noopener noreferrer">https://graph.microsoft.com/v1.0/me/microsoft.graph.sendMail</a></li><li>Request method: POST</li><li>Request type: JSON</li><li>Header: <code>{"Content-type":"application/json", "Authorization":"Bearer {Token}"}</code></li><li>Body:</li></ul><div class="language-json"><pre><code> <span class="token punctuation">{</span>
|
||
<span class="token property">"message"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"subject"</span><span class="token operator">:</span> <span class="token string">"Server Status Notification"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"body"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"contentType"</span><span class="token operator">:</span> <span class="token string">"Text"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"content"</span><span class="token operator">:</span> <span class="token string">"#NEZHA#"</span>
|
||
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
||
<span class="token property">"toRecipients"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
|
||
<span class="token punctuation">{</span>
|
||
<span class="token property">"emailAddress"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"address"</span><span class="token operator">:</span> <span class="token string">"ADDRESS FOR RECEVING EMAILS"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">]</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><p>Notes for this method: This method requires calling Microsoft Graph V1.0, you need to go to Microsoft Graph and create your own application, give <code>Mail.Send</code> permission and get the Token, or you can go <a href="https://developer.microsoft.com/en-us/graph/graph-explorer" target="_blank" rel="noopener noreferrer">Microsoft Graph Explorer</a> directly to give permission and get the Token, just replace the Token in the Header with the actual Token.</p></li><li><p><strong>Wechat Work Group bot Example, contributed by <a href="https://github.com/ChowRex" target="_blank" rel="noopener noreferrer">@ChowRex</a></strong></p><p>Support placeholders:</p><div class="language-json"><pre><code><span class="token punctuation">{</span>
|
||
<span class="token property">"content"</span><span class="token operator">:</span> <span class="token string">"#NEZHA#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"ServerName"</span><span class="token operator">:</span> <span class="token string">"#SERVER.NAME#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"ServerIP"</span><span class="token operator">:</span> <span class="token string">"#SERVER.IP#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"ServerIPV4"</span><span class="token operator">:</span> <span class="token string">"#SERVER.IPV4#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"ServerIPV6"</span><span class="token operator">:</span> <span class="token string">"#SERVER.IPV6#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"CPU"</span><span class="token operator">:</span> <span class="token string">"#SERVER.CPU#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"MEM"</span><span class="token operator">:</span> <span class="token string">"#SERVER.MEM#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"SWAP"</span><span class="token operator">:</span> <span class="token string">"#SERVER.SWAP#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"DISK"</span><span class="token operator">:</span> <span class="token string">"#SERVER.DISK#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"NetInSpeed"</span><span class="token operator">:</span> <span class="token string">"#SERVER.NETINSPEED#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"NetOutSpeed"</span><span class="token operator">:</span> <span class="token string">"#SERVER.NETOUTSPEED#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"TransferIn"</span><span class="token operator">:</span> <span class="token string">"#SERVER.TRANSFERIN#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"TranferOut"</span><span class="token operator">:</span> <span class="token string">"#SERVER.TRANSFEROUT#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"Load1"</span><span class="token operator">:</span> <span class="token string">"#SERVER.LOAD1#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"Load5"</span><span class="token operator">:</span> <span class="token string">"#SERVER.LOAD5#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"Load15"</span><span class="token operator">:</span> <span class="token string">"#SERVER.LOAD15#"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"TCP_CONN_COUNT"</span><span class="token operator">:</span> <span class="token string">"#SERVER.TCPCONNCOUNT"</span><span class="token punctuation">,</span> # Invalid
|
||
<span class="token property">"UDP_CONN_COUNT"</span><span class="token operator">:</span> <span class="token string">"#SERVER.UDPCONNCOUNT"</span><span class="token punctuation">,</span> # Invalid
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><blockquote><p>Sorry, this document is <strong>NOT</strong> available in English.</p><p><a href="https://developer.work.weixin.qq.com/document/path/91770#markdown%E7%B1%BB%E5%9E%8B" target="_blank" rel="noopener noreferrer">群机器人配置说明 - 文档 - 企业微信开发者中心</a></p></blockquote><ul><li><p>Name:WechatWork Group bot notification</p></li><li><p>URL:<a href="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_BOT_KEY" target="_blank" rel="noopener noreferrer">https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_BOT_KEY</a></p></li><li><p>Request method: POST</p></li><li><p>Request type: JSON</p></li><li><p>Body:</p><div class="language-json"><pre><code><span class="token punctuation">{</span>
|
||
<span class="token property">"msgtype"</span><span class="token operator">:</span> <span class="token string">"markdown"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"markdown"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"content"</span><span class="token operator">:</span> <span class="token string">"# Nezha Notification\n\n\"#NEZHA#\"\n\n> ServerName: \"#SERVER.NAME#\"\n> IP: \"#SERVER.IP#\"\n> IPv4: \"#SERVER.IPV4#\"\n> IPv6: \"#SERVER.IPV6#\"\n> CPU: \"#SERVER.CPU#\"\n> Memory: \"#SERVER.MEM#\"\n> SWAP: \"#SERVER.SWAP#\"\n> Storage: \"#SERVER.DISK#\"\n> Real-time Upload: \"#SERVER.NETINSPEED#\"\n> Real-time Download: \"#SERVER.NETOUTSPEED#\"\n> Total Upload: \"#SERVER.TRANSFERIN#\"\n> Total Download: \"#SERVER.TRANSFEROUT#\"\n> 1m Load: \"#SERVER.LOAD1#\"\n> 5m Load: \"#SERVER.LOAD5#\"\n> 15m Load: \"#SERVER.LOAD15#\"\n> TCP Connections: \"#SERVER.TCPCONNCOUNT\"\n> UDP Connections: \"#SERVER.UDPCONNCOUNT\"\n\n"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><p>Delete relevant content information as needed</p><p><img src="https://user-images.githubusercontent.com/30169860/223605886-b7736825-24b8-4b6c-8bc9-96ac388599ef.png" alt=""></p></li></ul></li></ul><br><br><h2 id="description-of-notification-rules" tabindex="-1">Description of notification rules <a class="header-anchor" href="#description-of-notification-rules" aria-hidden="true">#</a></h2><h3 id="basic-rules" tabindex="-1">Basic Rules <a class="header-anchor" href="#basic-rules" aria-hidden="true">#</a></h3><ul><li>Type: one or more types can be selected, such as in a rule to select more than one type, you need to <strong>meet all the selected types at the same time</strong> to trigger the notification (see the example later) <ul><li><code>cpu</code>、<code>memory</code>、<code>swap</code>、<code>disk</code></li><li><code>net_in_speed</code> Inbound speed, <code>net_out_speed</code> Outbound speed, <code>net_all_speed</code> Inbound + Outbound speed, <code>transfer_in</code> Inbound Transfer, <code>transfer_out</code> Outbound Transfer, <code>transfer_all</code> Total Transfer</li><li><code>offline</code> Offline monitoring</li><li><code>load1</code>、<code>load5</code>、<code>load15</code> Load</li><li><code>process_count</code> Number of processes <em>Currently, counting the number of processes takes up too many resources and is not supported at the moment</em></li><li><code>tcp_conn_count</code>、<code>udp_conn_count</code> Number of connections</li></ul></li><li>duration:Lasting for a few seconds, the notification will only be triggered when the sampling record reaches 30% or more within a few seconds</li><li>min/max <ul><li>Transfer, network speed, and other values of the same type. Unit is byte (1KB=1024B,1MB = 1024*1024B)</li><li>Memory, hard disk, CPU. units are usage percentages</li><li>No setup required for offline monitoring</li></ul></li><li>cover <code>[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]</code><ul><li><code>0</code> Cover all, use <code>ignore</code> to ignore specific servers</li><li><code>1</code> Ignore all, use <code>ignore</code> to monitoring specific servers<br> For example: <code>[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]</code></li></ul></li><li>ignore: Select to ignore specific servers, use with <code>cover</code> with server id and boolean, e.g.: <code>{"1": true, "2":false}</code></li></ul><p><strong>Complete examples:</strong></p><blockquote><blockquote><p>Add an offline notification</p></blockquote><ul><li>Name: Offline notification</li><li>Rules: <code>[{"Type":"offline","Duration":10}]</code></li><li>Enable: √</li></ul></blockquote><blockquote><blockquote><p>Add an notification when the CPU exceeds 50% for 10s <strong>but</strong> the memory usage is below 20% for 20s</p></blockquote><ul><li>Name: CPU and RAM</li><li>Rules: <code>[{"Type":"cpu","Min":0,"Max":50,"Duration":10},{"Type":"memory","Min":20,"Max":0,"Duration":20}]</code></li><li>Enable: √</li></ul></blockquote><blockquote><blockquote><p>Send specific server notifications to specific notification groups</p></blockquote><p>Case:<br> You have four servers, 1, 2, 3, 4, and two different notification groups, A and B<br> 1, 2 The two servers are down for 10 minutes and send a notification to Notification Group A<br> 3, 4 These two servers are down for ten minutes and then send a notification to Notification Group B</p><p>First you need to set up two notification groups, A and B, and then add two alarm rules:</p><p><strong>Rule I:</strong></p><ul><li>Name: 1, 2 Off-line, send notification to group A</li><li>Rules:<code>[{"type":"offline","duration":600,"cover":1,"ignore":{"1":true,"2":true}}]</code></li><li>Notification group: A</li><li>Enable: √</li></ul><p><strong>Rule II:</strong></p><ul><li>Name: 3, 4 Off-line, send notification to group B</li><li>Rules:<code>[{"type":"offline","duration":600,"cover":1,"ignore":{"3":true,"4":true}}]</code></li><li>Notification group: B</li><li>Enable: √</li></ul></blockquote><p><strong>Using these rules flexibly will help you to make full use of the notification function</strong></p><br><h3 id="special-any-cycle-transfer-notification" tabindex="-1">Special: Any-cycle transfer notification <a class="header-anchor" href="#special-any-cycle-transfer-notification" aria-hidden="true">#</a></h3><p>Can be used as monthly transfer notificatin</p><ul><li><p>type</p><ul><li><code>transfer_in_cycle</code> Inbound transfer during the cycle</li><li><code>transfer_out_cycle</code> Outbound transfer during the cycle</li><li><code>transfer_all_cycle</code> The sum of inbound and outbound transfer during the cycle</li></ul></li><li><p><code>cycle_start</code> 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 <code>2022-01-11T08:00:00.00+08:00</code></p></li><li><p><code>cycle_interval</code> 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)</p></li><li><p><code>cycle_unit</code> Statistics cycle unit, default <code>hour</code>, optional (<code>hour</code>, <code>day</code>, <code>week</code>, <code>month</code>, <code>year</code>)</p></li><li><p><code>min/max</code>, <code>cover</code>, <code>ignore</code> Please refer to the basic rules to configure</p></li></ul><blockquote><p>Example:</p><blockquote><p>The servers with ID 3 and 4 (defined in the <code>ignore</code>) are counted on the 1st of each month, and a notification is triggered when the monthly outbound transfer reaches 1TB during the cycle.</p></blockquote><p><code>[{"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}}]</code></p></blockquote><h2 id="description-of-mode-of-triggering-notification" tabindex="-1">Description of mode of triggering notification <a class="header-anchor" href="#description-of-mode-of-triggering-notification" aria-hidden="true">#</a></h2><ul><li>Always triggered: A notification is triggered each time the status reported by the Agent matches the rules of the notification</li><li>Triggered only once: only one notification is triggered when the state changes, such as changing from normal state to abnormal state or abnormal state back to normal state</li></ul><h2 id="set-the-task-to-be-executed-when-notification" tabindex="-1">Set the task to be executed when notification <a class="header-anchor" href="#set-the-task-to-be-executed-when-notification" aria-hidden="true">#</a></h2><p>If you need to perform a task while sending a notification message, you can set those items</p><ul><li><code>Tasks to be triggered in case of failure</code> The task to be executed when the notification status matches the change from "normal" to "failure", the task should be set in advance in the tasks page</li><li><code>Tasks to be triggered after fault recovery</code> The task to be executed when the notification status matches the change from " failure " to " normal ", the task should be set in advance in the tasks page</li></ul></div></div><footer class="page-footer" data-v-7eddb2c4 data-v-07c132fc><div class="edit" data-v-07c132fc><div class="edit-link" data-v-07c132fc data-v-1ed99556><a class="link" href="https://github.com/nezhahq/nezhahq.github.io/edit/main/docs/en_US/guide/notifications.md" target="_blank" rel="noopener noreferrer" data-v-1ed99556>Edit this page on GitHub <svg class="icon outbound icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15" data-v-1ed99556><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div></div><div class="updated" data-v-07c132fc><p class="last-updated" data-v-07c132fc data-v-abce3432><span class="prefix" data-v-abce3432>Last Updated:</span><span class="datetime" data-v-abce3432></span></p></div></footer><div class="next-and-prev-link" data-v-7eddb2c4 data-v-38ede35f><div class="container" data-v-38ede35f><div class="prev" data-v-38ede35f><a class="link" href="/en_US/guide/tasks" data-v-38ede35f><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" class="icon icon-prev" data-v-38ede35f><path d="M19,11H7.4l5.3-5.3c0.4-0.4,0.4-1,0-1.4s-1-0.4-1.4,0l-7,7c-0.1,0.1-0.2,0.2-0.2,0.3c-0.1,0.2-0.1,0.5,0,0.8c0.1,0.1,0.1,0.2,0.2,0.3l7,7c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3c0.4-0.4,0.4-1,0-1.4L7.4,13H19c0.6,0,1-0.4,1-1S19.6,11,19,11z"></path></svg><span class="text" data-v-38ede35f>Tasks</span></a></div><div class="next" data-v-38ede35f><a class="link" href="/en_US/guide/settings" data-v-38ede35f><span class="text" data-v-38ede35f>Settings</span><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" class="icon icon-next" data-v-38ede35f><path d="M19.9,12.4c0.1-0.2,0.1-0.5,0-0.8c-0.1-0.1-0.1-0.2-0.2-0.3l-7-7c-0.4-0.4-1-0.4-1.4,0s-0.4,1,0,1.4l5.3,5.3H5c-0.6,0-1,0.4-1,1s0.4,1,1,1h11.6l-5.3,5.3c-0.4,0.4-0.4,1,0,1.4c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3l7-7C19.8,12.6,19.9,12.5,19.9,12.4z"></path></svg></a></div></div></div><!--[--><!--]--></div></main></div><!----><!--]--></div>
|
||
<script>__VP_HASH_MAP__ = JSON.parse("{\"case_case1.md\":\"afa7f062\",\"case_case2.md\":\"54bdea86\",\"case_case3.md\":\"8c582072\",\"case_case4.md\":\"0a5f4467\",\"case_index.md\":\"c266a968\",\"developer_index.md\":\"8c39eab6\",\"developer_l10n.md\":\"3b866892\",\"developer_theme.md\":\"a36af5b8\",\"en_us_case_case1.md\":\"738141b2\",\"en_us_case_case2.md\":\"3fbd71b0\",\"en_us_case_case3.md\":\"bce4ebeb\",\"en_us_case_case4.md\":\"e65a7d04\",\"en_us_case_index.md\":\"6f87b03a\",\"en_us_developer_index.md\":\"c584be7f\",\"en_us_developer_l10n.md\":\"61bec938\",\"en_us_developer_theme.md\":\"4a9f6ab4\",\"en_us_guide_agent.md\":\"ee30a6ab\",\"en_us_guide_agentq.md\":\"433b1016\",\"en_us_guide_api.md\":\"55603ad5\",\"en_us_guide_dashboard.md\":\"cbd6aacb\",\"en_us_guide_dashboardq.md\":\"dabd8553\",\"en_us_guide_loginq.md\":\"3895584a\",\"en_us_guide_notifications.md\":\"8baa7836\",\"en_us_guide_q2.md\":\"a5e8c1f5\",\"en_us_guide_q3.md\":\"01c23df6\",\"en_us_guide_q4.md\":\"cf0b7a02\",\"en_us_guide_q5.md\":\"b76959da\",\"en_us_guide_q6.md\":\"41eac67b\",\"en_us_guide_q7.md\":\"037fca62\",\"en_us_guide_servers.md\":\"d1951d87\",\"en_us_guide_services.md\":\"b17b571d\",\"en_us_guide_settings.md\":\"b9f5a2d3\",\"en_us_guide_tasks.md\":\"c71cbef8\",\"en_us_index.md\":\"d655f9a8\",\"guide_agent.md\":\"150b060c\",\"guide_agentq.md\":\"a02ae62d\",\"guide_api.md\":\"f7805e2d\",\"guide_dashboard.md\":\"b0655074\",\"guide_dashboardq.md\":\"9d24a71e\",\"guide_loginq.md\":\"c7e6a728\",\"guide_notifications.md\":\"9e48363f\",\"guide_q1.md\":\"0a3f8afc\",\"guide_q2.md\":\"53bcff3c\",\"guide_q3.md\":\"3576d37e\",\"guide_q4.md\":\"9789deaf\",\"guide_q5.md\":\"a1a0a23c\",\"guide_q6.md\":\"065aeb75\",\"guide_q7.md\":\"47f2974d\",\"guide_servers.md\":\"f78c5525\",\"guide_services.md\":\"898798e7\",\"guide_settings.md\":\"cf30edff\",\"guide_tasks.md\":\"8bb30071\",\"index.md\":\"5e4bfbef\"}")</script>
|
||
<script type="module" async src="/assets/app.3817bf4e.js"></script>
|
||
|
||
</body>
|
||
</html> |