nagios的安装比较简单,复杂的是设置和配置参数的设定。不过你要放松一点,毕竟我们要搞定它,不是吗?那就开始吧:
1:获得***的安装包
下载地址:http://www.nagios.org/download
2:以root身份登录服务器
目前***的版本是2.5:
1)nagios,版本2.5:
fetch http://superb-west.dl.sourceforge.net/sourceforge/nagios/nagios-2.5.tar.gz
or
wget http://superb-west.dl.sourceforge.net/sourceforge/nagios/nagios-2.5.tar.gz
2)获得nagios插件,版本1.4.3:
http://surfnet.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.3.tar.gz
3)获得图库文件:
http://dl.sf.net/nagios/imagepak-base.tar.gz
4)NRPE,版本2.5.2
http://ufpr.dl.sourceforge.net/sourceforge/nagios/nrpe-2.5.2.tar.gz
5)NSCA,版本2.6
http://kent.dl.sourceforge.net/sourceforge/nagios/nsca-2.6.tar.gz
3:切换到root用户
sudo su
4:解压缩
tar zxvf nagios-2.5.tar.gz
5:建立运行nagios的用户
adduser nagios
6:建立安装nagios的文件夹
使这个文件夹的所有者为nagios:nagios
mkdir /usr/local/nagios
chown nagios.nagios /usr/local/nagios
7:确认web服务器的用户
可能会通过web接口执行一些命令,必须确定web服务器以哪个用户运行的,通常为:apache:
grep "^User" /usr/local/apache2/conf/httpd.conf
8:建立命令文件组
这个新的组会包括apache的用户和nagios的用户
- pw groupadd nagcmd
- pw usermod apache -G nagcmd
- pw usermod nagios -G nagcmd
- ----------------------------------
- cat /etc/group
- nagcmd:*:9007:apache,nagios
- ----------------------------------
9:运行配置脚本并安装nagios
- cd nagios-2.5
- ./configure --prefix=/usr/local/nagios --with-gd-lib=/usr/local/lib --with-gd-inc=/usr/local/include
- ---------------------------------
- *** Configuration summary for nagios 2.5 07-13-2006 ***:
- General Options:
- -------------------------
- Nagios executable: nagios
- Nagios user/group: nagios,nagios
- Command user/group: nagios,nagios
- Embedded Perl: no
- Event Broker: yes
- Install ${prefix}: /usr/local/nagios
- Lock file: ${prefix}/var/nagios.lock
- Init directory: /usr/local/etc/rc.d
- Host OS: freebsd6.0
- Web Interface Options:
- ------------------------
- HTML URL: http://localhost/nagios/
- CGI URL: http://localhost/nagios/cgi-bin/
- Traceroute (used by WAP): /usr/sbin/traceroute
- Review the options above for accuracy. If they look okay,
- type 'make all' to compile the main program and CGIs.
- ---------------------------------
- make all
- make install
- make install-init
- make install-commandmode
- make install-config
10:安装nagios-plugins
- tar zxvf nagios-plugins-1.4.3.tar.gz
- cd nagios-plugins-1.4.3
- ./configure --prefix=/usr/local/nagios-plugins
- make all
- make install
安装完成以后在/usr/local/nagios-plugins-plugins会产生一个libexec的目录,将该目录全部移动到/usr/local/nagios目录下即可。
mv /usr/local/nagios-plugins-plugins/libexec/ /usr/local/nagios/
11:imagepak-base.tar.gz的安装
tar –xvzf imagepak-base.tar.gz
解压以后是base目录
mv base/ /usr/local/nagios/share/images/logos/
nagios的安装过程到这就结束了,您的操作一定要认真和准确,若果您对nagios还不是很熟悉,推荐您先看一下nagios监控网络服务器和网络服务概念篇做一个初步,这样会使得服务配置更顺利地进行。若果您的主机已经准备好以上工作,我们就开始配置nagios,参见:故障解决篇和配置篇