Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Nagios 通知選項完整參考:主機與服務通知條件配置

編輯:Linux 教學

主機通知選項 host_notification_options

代碼觸發條件
d主機 DOWN 狀態
u主機 UNREACHABLE 狀態
r主機恢復 (UP 狀態)
f主機開始/停止抖動
s排程停機開始/結束
n不接收任何主機通知

服務通知選項 service_notification_options

代碼觸發條件
w服務 WARNING 狀態
u服務 UNKNOWN 狀態
c服務 CRITICAL 狀態
r服務恢復 (OK 狀態)
f服務開始/停止抖動
n不接收任何服務通知

常用推薦配置

# 主機:故障、不可達、恢復
host_notification_options: d,u,r

# 服務:警告、未知、嚴重、恢復
service_notification_options: w,u,c,r

配置範例

define contact {
    contact_name                    admin
    host_notification_options       d,u,r
    service_notification_options    w,u,c,r
    host_notification_period        24x7
    service_notification_period     24x7
    host_notification_commands      notify-host-by-email
    service_notification_commands   notify-service-by-email
    email                           admin@example.com
}

進階調整建議

  • 關鍵服務:加上 f 監控抖動狀態
  • 非核心時段:使用 notification_period 限制通知時間
  • 升級通知:配合 escalations 實現分級告警
  • 抑制通知:善用 host_dependencies, service_dependencies 避免風暴

Nagios 狀態代碼對照

服務狀態代碼主機狀態代碼
OK0UP0
WARNING1DOWN1
UNKNOWN2UNREACHABLE2
CRITICAL3

精準配置通知選項,能有效減少告警疲勞,確保關鍵事件第一時間觸達負責人。

Copyright © Windows教程網 All Rights Reserved