nagios core安裝
- selinux修改 本文檔適合在selinux的disabled或permissive模式下
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
- 檢查安裝pre-requisite packages
yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix
- 下載源碼包
cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.1.tar.gz
tar xzf nagioscore.tar.gz
- 編譯
cd /tmp/nagioscore-nagios-4.4.1/
./configure
make all
- 創(chuàng)建用戶和用戶組
make install-groups-users
usermod -a -G nagios apache
- 安裝各項(xiàng)文件
安裝binaries
make install
安裝service/deamon
make install-daemoninit
systemctl enable httpd.service
安裝command mode 安裝和配置外部命令文件
make install-commandmode
安裝Configuration Files 安裝SAMPLE配置文件蚌讼,nagios需要一些配置文件才能啟動(dòng)
make install-config
Install Apache Config Files 安裝Apache web server 配置文件庞瘸,如果有必要?jiǎng)t配置Apache settings
make install-webconf
- 配置防火墻
firewall-cmd --zone=public --add-port=80/tcp
firewall-cmd --zone=public --add-port=80/tcp --permanent
- 創(chuàng)建nagios管理員用戶賬戶
用于登錄web界面塞琼,若要再添加額外的賬戶,要在指令中去掉-c選項(xiàng)甘改,手動(dòng)輸入兩次密碼確認(rèn)
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
- 啟動(dòng)apache和nagios
systemctl start httpd.service
systemctl start nagios.service
- 測(cè)試安裝
在瀏覽器輸入一下鏈接:
http://192.168.0.230/nagios
http://域名/nagios
僅安裝nagios core雖然能運(yùn)行服務(wù),但是不能進(jìn)行監(jiān)控灭抑,在web頁(yè)面能看到相關(guān)錯(cuò)誤信息
[圖片上傳失敗...(image-c5def0-1534665384068)]
nagios plugin安裝
- 檢查安裝依賴(lài)包
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release
yum install -y perl-Net-SNMP
- 下載nagios plugin 源碼包
cd /tmp
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
tar zxf nagios-plugins.tar.gz
- 編譯安裝
cd /tmp/nagios-plugins-release-2.2.1/
./tools/setup
./configure
make
make install
- 測(cè)試插件安裝
刷新nagios網(wǎng)頁(yè) [圖片上傳失敗...(image-aa0264-1534665384068)]
- nagios服務(wù)控制相關(guān)命令
systemctl start nagios.service
systemctl stop nagios.service
systemctl restart nagios.service
systemctl status nagios.service
END