系统版本:CentOS 7.3
Nagios 版本:3.4.3
Nagio 以及插件下载地址:
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.3.tar.gz wget http://www.nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz wget http://nginx.org/download/nginx-1.9.15.tar.gz wget http://www.cpan.org/modules/by-module/FCGI/FCGI-0.78.tar.gz wget http://www.cpan.org/modules/by-module/FCGI/FCGI-ProcManager-0.27.tar.gz wget http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/IO-1.25.tar.gz wget http://www.cpan.org/authors/id/I/IN/INGY/IO-All-0.86.tar.gz wget http://www.mike.org.cn/wp-content/uploads/2011/07/perl-fcgi.zip
安装路径:/usr/local/nagios
数据路径:/data/nagios
1、 安装前准备
设置 nagios 运行的用户和组,并设置 nagios 目录。
useradd -s /sbin/nologin nagios mkdir /usr/local/nagios chown -R nagios.nagios /usr/local/nagios
2、 解压文件 ,并编译安装
tar xvf nagios-3.4.3.tar.gz cd nagios #编译文件 ./configure --prefix=/usr/local/nagios/ --whit-command-group=nagcmd #安装 make all make install make install-init make install-config make install-commandmode #修改配置文件(修改邮箱) vi /usr/local/nagios/etc/objects/contacts.cfg #配置 WEB 界面 make install-webconfig #配置 ngiosadmin 帐号密码 htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
3、安装 nagios 插件
tar xvf nagios-plugins-2.2.1.tar.gz cd nagios-plugins-2.2.1 ./configure --with-nagios-user=nagios --with-nagios-group=nagios make make install
4、 安装 nrpe
tar xvf nrpe-2.14.tar.gz cd nrpe-2.14 ./config ./configure make install-plugin make install-daemon make install-daemon-config
5、 检测配置文件是否正确
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
6、 启动 nagios
#方式一 /usr/local/nagios/bin/nrpe -n -c /usr/local/nagios/etc/nrpe.cfg -d #方式二 /etc/init.d/nagios start