安装依赖组件:
yum install httpd php gcc glibc glibc-common unzip gd gd-devel -y
创建系统用户:
useradd -m nagios; passwd nagios; groupadd ngcmd; usermod -a -g nagcmd nagios; usermod -a -g nagcmd apache;
下载安装包:
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.2.1.tar.gz
解压:
tar -zxvf nagios-4.2.1.tar.gz; cd nagios-4.2.1/;
配置编译:
./configure --with-command-group=nagcmd; make all; make install; make install-init; make install-config; make install-commandmode;
创建apache配置文件:
make install-webconf;
为nagios的web界⾯创建nagiosadmin⽤户,并设置密码:
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin;
下载nagios插件:
wget https://nagios-plugins.org/download/nagios-plugins-2.1.2.tar.gz;
解压:
tar -zxvf nagios-plugins-2.1.2.tar.gz; cd nagios-plugins-2.1.2;
配置编译安装:
./configure --with-nagios-user=nagios --with-nagios-group=nagios; make; make install;
配置自动启动:
chkconfig --add nagios; chkconfig nagios on;
验证配置文件:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg;
重启服务:
systemctl restart nagios;
进入web界面:
http://localhost/nagios
参考:
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END