歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

CentOS5.5下Nagios最新版安裝

本文是個人實踐安裝的記錄,安裝的時候參考過網上很多高手的傑作,在此非常感謝!

環境:
Centos 5.5 32bit
Nagios 3.2.3
nagios-plugin 1.4.15

1、准備工作:
所需軟件包:httpd,php,gcc,glibc,gd,gd-devel
# yum -y install gcc gd gd-devel httpd php
設置 nagios用戶 用戶組
/usr/sbin/useradd nagios
為了安全性設置為nologin
/usr/sbin/usermod -s /sbin/nologin nagios
#創建nagcmd組,用於從web接口執行外部命令,將nagios,apache加到這個組中
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd apache

2、下載源文件和插件
cd /usr/local/src
wget [url]http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz[/url]
wget [url]http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz[/url]

3、編譯安裝Nagios core:
cd /usr/local/src
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 #自動配置httpd.conf,生成文件保存於/etc/httpd/conf.d/nagios.conf

4、安裝插件:
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

5、配置一個nagiosadmin用戶用於nagios的web接口登錄
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart

6、更改E-mail地址:
vi /usr/local/nagios/etc/objects/contacts.cfg

7、設置nagios,httpd開機啟動
chkconfig –add nagios
chkconfig nagios on
chkconfig httpd on
檢查配置文件是否正確 :/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start
注意:如果你開啟了selinux 需要配置如下二步:
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
#如不想要SElinux,也可以修改/etc/selinux/config使之永久關閉
setenforce 0

#到目前為止,基礎的安裝已經完成了!打開浏覽器訪問Nagios

http://ip/nagios

後續會為大家介紹如何使用Nagios來監控Windows,Linux和網絡設備的相關信息,繼續關注哦….

Copyright © Linux教程網 All Rights Reserved