nagios服務端搭建

原文鏈接: http://hi.baidu.com/liuchangwengo/item/c837b5681c6cbb92c4d2492b

 

1.環境搭建(centos\redhat    和 ubuntu)

yum install -y wget httpd phpgcc glibc glibc-common gd gd-devel make net-snmp

(For Ubuntu users:

sudo apt-get install wgetinstall build-essential apache2 php5-gd wget libgd2-xpm libgd2-xpm-dev

libapache2-mod-php5)

 


useradd nagios

groupadd nagcmd

usermod -a -G nagcmd nagios

 


2.軟件包下載:

cd /tmp

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz

wgethttp://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz

 


3.兩個軟件包的安裝


tar zxvf nagios-3.4.1.tar.gz

tar zxvfnagios-plugins-1.4.15.tar.gz

cd nagios

For RHEL/CentOS users:

./configure--with-command-group=nagcmd

For Ubuntu users:

./configure--with-nagios-group=nagios --with-command-group=nagcmd -–with-mail=/usr/bin/sendmail

Allsystems:

make all

make install

make install-init

make install-config

make install-commandmode

make install-webconf


cp -R contrib/eventhandlers//usr/local/nagios/libexec/

chown -R nagios:nagios/usr/local/nagios/libexec/eventhandlers

/usr/local/nagios/bin/nagios-v /usr/local/nagios/etc/nagios.cfg

/etc/init.d/nagios start

For RHEL/CentOS users:

/etc/init.d/httpd start

htpasswd –c/usr/local/nagios/etc/htpasswd.users nagiosadmin

cd /tmp/nagios-plugins-1.4.15

./configure--with-nagios-user=nagios --with-nagios-group=nagios

make

make install

chkconfig --add nagios

chkconfig --level 35 nagios on

chkconfig --add httpd

chkconfig --level 35 httpd on

 


For Ubuntu:

ln -s /etc/init.d/nagios/etc/rcS.d/S99nagios

http://<your.nagios.server.ip>/nagios


聯入Nagios的CGI時導致一個"內部服務錯誤"消息。
如果是SELinux處於強制安全模式時需要做
getenforce
令SELinux處於容許模式
setenforce 0
如果要永久性更變它,需要更改/etc/selinux/config裏的設置並重啓系統。
不關閉SELinux或是永久性變更它的方法是讓CGI模塊在SELinux下指定強制目標模式:
chcon ‐R ‐t httpd_sys_content_t /usr/local/nagios/sbin/
chcon ‐R ‐t httpd_sys_content_t /usr/local/nagios/share/

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章