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

CentOS 5.5 編譯安裝 Nagios 3.2.3 監控系統全記錄

編輯:Linux 教學

Nagios 是企業級基礎設施監控標準工具。本文記錄在 CentOS 5.5 上從源碼編譯安裝 Nagios Core 3.2.3 與 Plugins 1.4.15 的完整流程,含用戶權限、Web 界面配置、插件編譯、SELinux 處理及驗證步驟。

環境準備

yum -y install gcc gd gd-devel httpd php
# 創建用戶組
useradd nagios && usermod -s /sbin/nologin nagios
groupadd nagcmd
usermod -G nagcmd nagios
usermod -G nagcmd apache

核心組件編譯安裝

  1. Nagios Core 3.2.3:
    cd /usr/local/src
    wget https://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
    tar xzf nagios-3.2.3.tar.gz && cd nagios-3.2.3
    ./configure --with-command-group=nagcmd
    make all && make install && make install-init && make install-config
    make install-commandmode && make install-webconf
  2. Plugins 1.4.15:
    tar xzf nagios-plugins-1.4.15.tar.gz && cd nagios-plugins-1.4.15
    ./configure --with-nagios-user=nagios --with-nagios-group=nagios
    make && make install

Web 界面與服務配置

  1. 創建管理員賬號:htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
  2. 修改聯繫人郵箱:vim /usr/local/nagios/etc/objects/contacts.cfg
  3. 啟動服務並設置開機自啟:
    chkconfig --add nagios && chkconfig nagios on
    chkconfig httpd on
    service httpd restart && service nagios start
  4. 驗證配置:/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

SELinux 處理(如啟用)

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
# 或永久關閉:vim /etc/selinux/config 設置 SELINUX=disabled

訪問驗證

瀏覽器打開 https://IP/nagios,使用 nagiosadmin 登錄即可進入監控儀表盤。

Copyright © Windows教程網 All Rights Reserved