Nagios是一款开源的系统和网络监控应用,它可以监视你指定的主机与服务,当出现问题时提醒您以帮助你改善系统。 Nagios最初在Linux下运行,但它大多数其他Unix下运行。 Nagios 功能包括: 监控网络服务( SMTP , POP3 , HTTP , NNTP , PING等) 监控主机
Nagios是一款开源的系统和网络监控应用,它可以监视你指定的主机与服务,当出现问题时提醒您以帮助你改善系统。 Nagios最初在Linux下运行,但它大多数其他Unix下运行。
Nagios 功能包括:
在安装之前你最好已经安装了lamp服务器软件,另外你还需要安装一些依赖包,使用下面的命令:
sudo apt-get install wget build-essential php5-gd wget libgd2-xpm libgd2-xpm-dev libapache2-mod-php5 apache2-utils daemon<br>
<span><span>下载Nagios及插件:</span></span>
<span><span>wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz<br>
wget http://nchc.dl.sourceforge.net/project/nagios-cn/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2<br>
wget http://nchc.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.2.3/nagios-3.2.3.tar.gz<br>
</span></span>
添加 Nagios 用户和群组
adduser nagios<br> /usr/sbin/groupadd nagcmd<br> /usr/sbin/usermod -G nagcmd nagios<br> /usr/sbin/usermod -G nagcmd www-data<br>
现在安装 nagios
尽量使用 root 身份登录,运行以下命令
解压缩下载的文件(Nagios的内核和插件)
1、Nagios内核安装:
tar zxvf nagios-3.2.3.tar.gz <br> tar zxvf nagios-plugins-2.0.3.tar.gz <br> cd nagios-3.2.3/<br> apt-get install sendmail<br> ./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-mail=/usr/sbin/sendmail<br> make all<br> make install<br> make install-init<br> make install-commandmode<br> make install-config<br> make install-webconf<br> cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/<br> chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers<br> /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg<br> /etc/init.d/nagios start
2、插件安装<br> cd ..<br> cd nagios-plugins-2.0.3/<br> ./configure --with-nagios-user=nagios --with-nagios-group=nagios<br> make<br> make install<br> ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios<br> apt-get install libxml2<br> apt-get install libxml2-dev<br> sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server<br> sudo touch /var/www/test.php<br> vim /var/www/test.php<br> sudo apt-get install php5-gd php5-curl php5-xdebug<br> sudo /etc/init.d/nagios restart
3、安装中文插件<br> cd ..<br> tar xvf nagios-cn-3.2.3.tar.bz2 <br> cd nagios-cn-3.2.3/<br> ./configure --with-nagios-user=nagios --with-nagios-group=nagios<br> make all<br> make<br> make install<br> make install-init<br> make install-commandmode<br> make install-config<br> htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin<br>
sudo /etc/init.d/nagios restart <br>
访问nagios地址:http://localhost/nagios
<br>
<br>
<br>