Skip to content

Commit dd3d856

Browse files
authored
Merge pull request #110 from flashcatcloud/f-nagios-dev
F nagios dev
2 parents 8661798 + 921a797 commit dd3d856

20 files changed

Lines changed: 566 additions & 25 deletions

flashduty/en/1. On-call/8. Integrations/8.1 Alerts integration/8.1.0 Standard Alert Integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Field|Required|Type|Description
7777

7878
Field|Required|Type|Description
7979
:-:|:-:|:-:|:---
80-
| title_rule | Yes | string | Alert title, no more than `512` characters, will be truncated if exceeded.<br><br>Supports dynamic title generation based on alert content, see [Customizing Incidents](https://docs.flashcat.cloud/en/flashduty/customize-incident-attrs) for generation rules.
80+
| title_rule | Yes | string | Alert title, no more than `512` characters, will be truncated if exceeded.<br><br>Supports dynamic title generation based on alert content, see [Customizing Incidents](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines) for generation rules.
8181
| event_status | Yes | string | Alert status.<br><br>Enumerated values (case-sensitive): *Critical*, *Warning*, *Info*, *Ok*.<br><br>When specified as Ok, it means automatic recovery of the alert.
8282
| alert_key | No | string | Alert identifier, used to update or automatically recover existing alerts.<br><br>You can customize this value, but it cannot exceed `255` characters. You can also rely on system auto-generation, this value will be returned in the response.<br><br>If you're reporting a recovery event, this value must exist.
8383
| description | No | string | Alert description, no more than `2048` characters, will be truncated if exceeded.
@@ -218,5 +218,5 @@ Failed Response:
218218
3. The new event might be discarded due to matching exclusion, discard, suppression, or silence rules.
219219
4. When a new event triggers a new alert, the system enters the second layer of noise reduction check, determining if the new alert can be merged into an active incident. If possible, it will only merge into the existing incident without generating a new one.
220220

221-
For more information, please refer to [Alert Noise Reduction](https://docs.flashcat.cloud/en/flashduty/what-is-noise-reduction).
221+
For more information, please refer to [Alert Noise Reduction](https://docs.flashcat.cloud/en/on-call/channel/noise-reduction).
222222
</details>

flashduty/en/1. On-call/8. Integrations/8.1 Alerts integration/8.1.1 Email Integration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@ attachment_stripped = true
9797
## Severity Mapping
9898
---
9999

100-
Currently, all alerts pushed to Flashduty through the email integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines).
100+
Currently, all alerts pushed to Flashduty through the email integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines).
101+

flashduty/en/1. On-call/8. Integrations/8.1 Alerts integration/8.1.39 StateCloud Integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ url: "https://docs.flashcat.cloud/en/flashduty/statecloud-integration-guide"
77

88
Sync StateCloud monitoring alert events to Flashduty via webhook for automated alert noise reduction.
99

10-
For resource monitoring events from StateCloud [secondary nodes](#secondary-nodes), please use Huawei Cloud integration. Refer to [Huawei Cloud Alert Integration Guide](https://docs.flashcat.cloud/en/flashduty/huawei-ces-integration-guide?nav=01JCQ7A4N4WRWNXW8EWEHXCMF5).
10+
For resource monitoring events from StateCloud [secondary nodes](#secondary-nodes), please use Huawei Cloud integration. Refer to [Huawei Cloud Alert Integration Guide](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-sources/huawei-ces).
1111

1212

1313
<div class="hide">

flashduty/en/1. On-call/8. Integrations/8.1 Alerts integration/8.1.46 DingtalkAlert Integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ By default, the system always creates new alerts for each message, but you can s
7979
## Severity Mapping
8080
---
8181

82-
Currently, all alerts pushed to Flashduty through the Dingtalk integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines).
82+
Currently, all alerts pushed to Flashduty through the Dingtalk integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines).

flashduty/en/1. On-call/8. Integrations/8.1 Alerts integration/8.1.47 Feishu(Lark)Alert Integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ By default, the system always creates new alerts for each message, but you can s
7979
## Severity Mapping
8080
---
8181

82-
Currently, all alerts pushed to Flashduty through the Feishu(lark) integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines).
82+
Currently, all alerts pushed to Flashduty through the Feishu(lark) integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines).

flashduty/en/1. On-call/8. Integrations/8.1 Alerts integration/8.1.51 Cloudflare Integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ After configuring the Webhook channel, you can use it in notification policies.
6565

6666
<div class="md-block">
6767

68-
Currently, all alerts pushed to Flashduty through the Cloudflare integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines).
68+
Currently, all alerts pushed to Flashduty through the Cloudflare integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines).
6969

7070
</div>
7171

flashduty/en/1. On-call/8. Integrations/8.1 Alerts integration/8.1.52 WecomAlert Integration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ By default, the system always creates new alerts for each message, but you can s
7373

7474
### Notes
7575
- Wecom alert integration URL only supports Text and Markdown message types; other message types cannot be received
76-
- Flashduty will generate a default alert title: "Wecom robot Alert , If you need to change the title, you can customize it using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines)"
76+
- Flashduty will generate a default alert title: "Wecom robot Alert , If you need to change the title, you can customize it using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines)"
7777

7878
## Severity Mapping
7979
---
8080

81-
Currently, all alerts pushed to Flashduty through the Wecom integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines).
81+
Currently, all alerts pushed to Flashduty through the Wecom integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines).
8282

8383
---
8484
title: "Wecom Alert Integration"
@@ -155,9 +155,9 @@ By default, the system always creates new alerts for each message, but you can s
155155

156156
### Notes
157157
- Wecom alert integration URL only supports Text and Markdown message types; other message types cannot be received
158-
- Flashduty will generate a default alert title: "Wecom robot Alert , If you need to change the title, you can customize it using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines)"
158+
- Flashduty will generate a default alert title: "Wecom robot Alert , If you need to change the title, you can customize it using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines)"
159159

160160
## Severity Mapping
161161
---
162162

163-
Currently, all alerts pushed to Flashduty through the Wecom integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines).
163+
Currently, all alerts pushed to Flashduty through the Wecom integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines).

flashduty/en/1. On-call/8. Integrations/8.1 Alerts integration/8.1.53 Harbor Alert Integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ Choose this method when you need to route alerts to different channels based on
6060
## Severity Mapping
6161
---
6262

63-
Currently, all alerts pushed to Flashduty through the Harbor integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/flashduty/alert-pipelines).
63+
Currently, all alerts pushed to Flashduty through the Harbor integration are set to Warning severity. However, you can customize the severity using the [alert pipeline](https://docs.flashcat.cloud/en/on-call/integration/alert-integration/alert-pipelines).
6464

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
---
2+
title: "Nagios Integration"
3+
description: "Synchronize Nagios alert events to Flashduty via script to achieve automated alert noise reduction"
4+
date: "2025-05-19T10:00:00+08:00"
5+
url: "https://docs.flashcat.cloud/en/flashduty/nagios-integration-guide"
6+
---
7+
8+
Sync Nagios alert events to Flashduty via script to achieve automated alert noise reduction.
9+
10+
<div class="hide">
11+
12+
## In Flashduty
13+
---
14+
You can obtain an integration push URL through either of these two methods:
15+
16+
### Using Private Integration
17+
18+
Choose this method when you don't need to route alert events to different channels - it's simpler.
19+
20+
<details>
21+
<summary>Expand</summary>
22+
23+
1. Go to the Flashduty console, select **Channel**, and enter a channel's details page
24+
2. Select the **Integrations** tab, click **Add Integration** to enter the integration page
25+
3. Choose **Nagios** integration and click **Save** to generate a card
26+
4. Click the generated card to view the **Push URL**, copy it for later use, and you're done
27+
28+
</details>
29+
30+
### Using Shared Integration
31+
32+
Choose this method when you need to route alerts to different channels based on the alert event payload.
33+
34+
<details>
35+
<summary>Expand</summary>
36+
37+
1. Go to the Flashduty console, select **Integration Center=>Alert Events** to enter the integration selection page
38+
2. Select **Nagios** integration:
39+
- **Integration Name**: Define a name for this integration
40+
3. Configure the default route and select the corresponding channel (after the integration is created, you can go to `Route` to configure more routing rules)
41+
4. Click **Save** and copy the newly generated **push URL** for later use
42+
5. Done
43+
44+
</details>
45+
</div>
46+
47+
48+
## In Nagios
49+
50+
---
51+
52+
Nagios installation paths may vary depending on the system and installation method. Please adjust the paths in the following configuration according to your actual environment.
53+
54+
### Step 1: Download Notification Script
55+
56+
<div class="md-block">
57+
58+
Log in to the Nagios Server host and download the notification script to the Nagios plugin directory:
59+
60+
- **Debian/Ubuntu systems** (typically `/usr/lib/nagios/plugins/`):
61+
62+
```bash
63+
cd /usr/lib/nagios/plugins/
64+
wget --header="Referer: https://console.flashcat.cloud" https://download.flashcat.cloud/flashduty/integration/nagios/send_to_flashduty.sh
65+
chmod +x send_to_flashduty.sh
66+
```
67+
68+
- **RHEL/CentOS systems** (typically `/usr/lib64/nagios/plugins/`):
69+
70+
```bash
71+
cd /usr/lib64/nagios/plugins/
72+
wget --header="Referer: https://console.flashcat.cloud" https://download.flashcat.cloud/flashduty/integration/nagios/send_to_flashduty.sh
73+
chmod +x send_to_flashduty.sh
74+
```
75+
76+
- **Source installation** (typically `/usr/local/nagios/libexec/`):
77+
78+
```bash
79+
cd /usr/local/nagios/libexec/
80+
wget --header="Referer: https://console.flashcat.cloud" https://download.flashcat.cloud/flashduty/integration/nagios/send_to_flashduty.sh
81+
chmod +x send_to_flashduty.sh
82+
```
83+
84+
#### Note: The script uses the `curl` command. Please ensure curl is installed on your Nagios Server.
85+
86+
</div>
87+
88+
### Step 2: Create Flashduty Configuration File
89+
90+
<div class="md-block">
91+
92+
Download the Flashduty configuration file to the Nagios configuration directory:
93+
94+
- **Debian/Ubuntu systems** (typically `/etc/nagios3/conf.d/`):
95+
96+
```bash
97+
cd /etc/nagios3/conf.d/
98+
wget --header="Referer: https://console.flashcat.cloud" https://download.flashcat.cloud/flashduty/integration/nagios/flashduty.cfg
99+
```
100+
101+
- **RHEL/CentOS systems** (typically `/etc/nagios/objects/`):
102+
103+
```bash
104+
cd /etc/nagios/objects/
105+
wget --header="Referer: https://console.flashcat.cloud" https://download.flashcat.cloud/flashduty/integration/nagios/flashduty.cfg
106+
```
107+
108+
- **Source installation** (typically `/usr/local/nagios/etc/objects/`):
109+
110+
```bash
111+
cd /usr/local/nagios/etc/objects/
112+
wget --header="Referer: https://console.flashcat.cloud" https://download.flashcat.cloud/flashduty/integration/nagios/flashduty.cfg
113+
```
114+
115+
</div>
116+
117+
### Step 3: Modify Configuration File
118+
119+
<div class="md-block">
120+
121+
Edit the downloaded `flashduty.cfg` file and modify the following:
122+
123+
1. Replace the `pager` field value with the integration push URL obtained from the Flashduty console
124+
2. Modify the script path in `command_line` according to your Nagios installation path
125+
126+
Configuration file example:
127+
128+
```
129+
define contact {
130+
contact_name Flashduty
131+
alias Flashduty Alert Receiver
132+
service_notification_commands notify-service-by-Flashduty
133+
host_notification_commands notify-host-by-Flashduty
134+
service_notification_options w,u,c,r
135+
host_notification_options d,u,r
136+
service_notification_period 24x7
137+
host_notification_period 24x7
138+
pager <YOUR_FLASHDUTY_PUSH_URL>
139+
}
140+
141+
142+
define command {
143+
command_name notify-host-by-Flashduty
144+
command_line <NAGIOS_PLUGIN_PATH>/send_to_flashduty.sh type=HOST WEBHOOK_URL="$CONTACTPAGER$" hostname="$HOSTNAME$" state="$HOSTSTATE$" output="$HOSTOUTPUT$" notification_type="$NOTIFICATIONTYPE$" time="$LONGDATETIME$" host_address="$HOSTADDRESS$" host_alias="$HOSTALIAS$" check_command="$HOSTCHECKCOMMAND$"
145+
}
146+
147+
define command {
148+
command_name notify-service-by-Flashduty
149+
command_line <NAGIOS_PLUGIN_PATH>/send_to_flashduty.sh type=SERVICE WEBHOOK_URL="$CONTACTPAGER$" hostname="$HOSTNAME$" state="$SERVICESTATE$" output="$SERVICEOUTPUT$" notification_type="$NOTIFICATIONTYPE$" time="$LONGDATETIME$" host_address="$HOSTADDRESS$" service_desc="$SERVICEDESC$" host_alias="$HOSTALIAS$" max_attempts="$MAXSERVICEATTEMPTS$"
150+
}
151+
```
152+
153+
Parameter descriptions:
154+
- `pager`: Flashduty push URL, the integration push URL obtained from the Flashduty console
155+
- `<NAGIOS_PLUGIN_PATH>`: Replace with the actual script path, such as `/usr/local/nagios/libexec`
156+
- `service_notification_options`: Service alert notification options, w=warning, u=unknown, c=critical, r=recovery
157+
- `host_notification_options`: Host alert notification options, d=down, u=unreachable, r=recovery
158+
159+
**To include additional information in alerts, you can append parameters in `key=value` format at the end of `command_line`, for example: `environment="production" region="$_HOSTREGION$"`. These parameters will be pushed to Flashduty as labels.**
160+
161+
</div>
162+
163+
### Step 4: Include Configuration File
164+
165+
<div class="md-block">
166+
167+
If you are using **RHEL/CentOS systems** or **source installation**, you need to include the Flashduty configuration file in the Nagios main configuration file.
168+
169+
- **RHEL/CentOS systems**: Edit `/etc/nagios/nagios.cfg` and add:
170+
171+
```
172+
cfg_file=/etc/nagios/objects/flashduty.cfg
173+
```
174+
175+
- **Source installation**: Edit `/usr/local/nagios/etc/nagios.cfg` and add:
176+
177+
```
178+
cfg_file=/usr/local/nagios/etc/objects/flashduty.cfg
179+
```
180+
181+
:::tips
182+
Debian/Ubuntu systems typically auto-load all configuration files in the `/etc/nagios3/conf.d/` directory, so manual inclusion is not required.
183+
:::
184+
185+
</div>
186+
187+
### Step 5: Add Flashduty to Contact Group
188+
189+
<div class="md-block">
190+
191+
Edit the contacts configuration file to add the Flashduty contact to the `admins` contact group (or another contact group you use):
192+
193+
- **Debian/Ubuntu systems**: Edit `/etc/nagios3/conf.d/contacts_nagios2.cfg`
194+
- **RHEL/CentOS systems**: Edit `/etc/nagios/objects/contacts.cfg`
195+
- **Source installation**: Edit `/usr/local/nagios/etc/objects/contacts.cfg`
196+
197+
Find the contact group definition and add Flashduty to the members list:
198+
199+
```
200+
define contactgroup {
201+
contactgroup_name admins
202+
alias Nagios Administrators
203+
members nagiosadmin,Flashduty
204+
}
205+
```
206+
207+
</div>
208+
209+
### Step 6: Verify Configuration and Restart Service
210+
211+
<div class="md-block">
212+
213+
1. Verify the Nagios configuration file:
214+
215+
- **Debian/Ubuntu systems**:
216+
217+
```bash
218+
/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg
219+
```
220+
221+
- **RHEL/CentOS systems**:
222+
223+
```bash
224+
/usr/sbin/nagios -v /etc/nagios/nagios.cfg
225+
```
226+
227+
- **Source installation**:
228+
229+
```bash
230+
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
231+
```
232+
233+
2. If verification passes, restart the Nagios service:
234+
235+
```bash
236+
# Debian/Ubuntu
237+
systemctl restart nagios3
238+
# or
239+
service nagios3 restart
240+
241+
# RHEL/CentOS/Source installation
242+
systemctl restart nagios
243+
# or
244+
service nagios restart
245+
```
246+
247+
3. After configuration is complete, Nagios will automatically push alerts to Flashduty when detected
248+
249+
</div>
250+
251+
## Status Mapping
252+
253+
---
254+
255+
<div class="md-block">
256+
257+
Nagios to Flashduty alert severity mapping:
258+
259+
| Nagios | Flashduty | Status |
260+
| --------------- | --------- | -------- |
261+
| CRITICAL | Critical | Critical |
262+
| DOWN | Critical | Critical |
263+
| UNREACHABLE | Critical | Critical |
264+
| WARNING | Warning | Warning |
265+
| OK | Ok | Recovered |
266+
| UP | Ok | Recovered |
267+
| UNKNOWN | Info | Info |
268+
269+
</div>

flashduty/zh/1. On-call/5. 集成引导/8.1 告警集成/8.1.0 标准告警事件集成指引.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ POST, Content-Type:"application/json"
8181

8282
字段|必含|类型|释义
8383
:-:|:-:|:-:|:---
84-
| title_rule | 是 | string | 告警标题,不超过`512`个字符,超出后将自动截断。<br><br>支持根据告警内容动态生成标题,生成规则请参考 [定制故障标题](https://docs.flashcat.cloud/zh/flashduty/customize-incident-attrs)
84+
| title_rule | 是 | string | 告警标题,不超过`512`个字符,超出后将自动截断。<br><br>支持根据告警内容动态生成标题,生成规则请参考 [定制故障标题](https://docs.flashcat.cloud/zh/on-call/integration/alert-integration/alert-pipelines)
8585
| event_status | 是 | string | 告警状态。<br><br>枚举值(`首字母大写`):*Critical*:严重,*Warning*:警告,*Info*:提醒,*Ok*:恢复。<br><br>当指定为Ok时,意味着对告警进行自动恢复。
8686
| alert_key | 否 | string | 告警标识,用于对已经存在的告警进行更新或自动恢复。<br><br>您可以自定义此值,但不可超过`255`个字符。您也可以依赖系统自动生成,该值会在响应中返回。<br><br>如果您上报的是恢复事件,则此值必须存在。
8787
| description | 否 | string | 告警描述,不超过`2048`个字符,超出后将自动截断。
@@ -225,6 +225,6 @@ curl -X POST '{api_host}/event/push/alert/standard?integration_key={integration_
225225
3. 新的event可能由于匹配到排除、丢弃、抑制或静默规则,而被丢弃。
226226
4. 当新的event触发了新告警,则系统会进入第二层降噪检查,判断新告警是否可以被合并到某个活跃的故障中,如果可以,则只会并入已有的故障,而不会产生新故障。
227227

228-
更多内容请参考 [告警降噪](https://docs.flashcat.cloud/zh/flashduty/what-is-noise-reduction)
228+
更多内容请参考 [告警降噪](https://docs.flashcat.cloud/zh/on-call/channel/noise-reduction)
229229
</details>
230230

0 commit comments

Comments
 (0)