nagios是一款开源的系统和网络监控应用,它可以监视你指定的主机与服务,当出现问题时提醒您以帮助你改善系统。 nagios最初在linux下运行,但它大多数其他unix下运行。 nagios 功能包括: 监控网络服务( smtp , pop3 , http , nntp , ping等) 监控主机
nagios是一款开源的系统和网络监控应用,它可以监视你指定的主机与服务,当出现问题时提醒您以帮助你改善系统。 nagios最初在linux下运行,但它大多数其他unix下运行。
nagios 功能包括:
监控网络服务( smtp , pop3 , http , nntp , ping等)监控主机资源(处理器负载,磁盘使用情况等)简单的插件设计,让用户能够轻松开发自己的服务检查并行化服务检查定义网络主机层次结构使用“父”的主机,使检测和区分主机当服务或主机发生问题是通知你(通过电子邮件,寻呼机或用户定义的方法)定义事件处理程序能力,服务或主机运行过程中主动解决问题日志文件支持执行冗余监控主机可选web界面查看当前网络状态,通知和问题历史,日志文件等。在安装之前你最好已经安装了lamp服务器软件,另外你还需要安装一些依赖包,使用下面的命令:
sudo apt-get install wget build-essential php5-gd wget libgd2-xpm libgd2-xpm-dev libapache2-mod-php5 apache2-utils daemon
下载nagios及插件:
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
wget http://nchc.dl.sourceforge.net/project/nagios-cn/sourcecode/zh_cn%203.2.3/nagios-cn-3.2.3.tar.bz2
wget http://nchc.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.2.3/nagios-3.2.3.tar.gz
添加 nagios 用户和群组
adduser nagios
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -g nagcmd nagios
/usr/sbin/usermod -g nagcmd www-data
现在安装 nagios
尽量使用 root 身份登录,运行以下命令
解压缩下载的文件(nagios的内核和插件)
1、nagios内核安装:
tar zxvf nagios-3.2.3.tar.gz
tar zxvf nagios-plugins-2.0.3.tar.gz
cd nagios-3.2.3/
apt-get install sendmail
./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-mail=/usr/sbin/sendmail
make all
make install
make install-init
make install-commandmode
make install-config
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
2、插件安装
cd ..
cd nagios-plugins-2.0.3/
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
ln -s /etc/init.d/nagios /etc/rcs.d/s99nagios
apt-get install libxml2
apt-get install libxml2-dev
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server
sudo touch /var/www/test.php
vim /var/www/test.php
sudo apt-get install php5-gd php5-curl php5-xdebug
sudo /etc/init.d/nagios restart
3、安装中文插件
cd ..
tar xvf nagios-cn-3.2.3.tar.bz2
cd nagios-cn-3.2.3/
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make all
make
make install
make install-init
make install-commandmode
make install-config
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
sudo /etc/init.d/nagios restart
访问nagios地址:http://localhost/nagios
