Nagios - 主機和服務



Nagios 是用於監測 IT 基礎架構中執行的主機和服務的頗受歡迎的工具。主機和服務配置是 Nagios Core 的基石。

  • 主機就像計算機,可以是物理裝置或虛擬裝置。

  • 服務是 Nagios 用來檢查主機某些內容的工具。

可以在 Nagios 的伺服器目錄中建立主機檔案,並註明主機和服務定義。例如 -

sudo gedit /usr/local/nagios/etc/servers/ubuntu_host.cfg

# Ubuntu 主機配置檔案

define host {
   use linux-server
   host_name ubuntu_host
   alias Ubuntu Host
   address 192.168.1.10
   register 1
}
define service {
   host_name ubuntu_host
   service_description PING
   check_command check_ping!100.0,20%!500.0,60%
   max_check_attempts 2
   check_interval 2
   retry_interval 2
   check_period 24x7
   check_freshness 1
   contact_groups admins
   notification_interval 2
   notification_period 24x7
   notifications_enabled 1
   register 1
}

上述定義添加了一個名為 ubuntu_host 的主機,並定義了將在該主機上執行的服務。在重新啟動 Nagios 時,將開始由 Nagios 監測此主機,並將執行指定的服務。

Nagios 中還有更多服務,可用於監測正在執行的主機上的幾乎任何內容。

廣告