一:安装前的准备工作
1)安装网站平台环境、编译工具
# yum -y install httpd php gd
#yum -y install gcc glibc glibc-common
2)创建运行账号
# groupadd nagcmd
# useradd -G nagcmd nagios # gpasswd -a apache nagcmd
二:编译安装nagios及nagios-plugins
1)安装nagios
# tar xf ~/nagios-4.3.1.tar.gz -C /usr/src/
# cd /usr/src/nagios-4.3.1/
# ./configure --with-command-group=nagcmd # make all //编译 # make install //安装程序 # make install-init //安装控制脚本 # make install-config //安装配置 # make install-commandmode //调权限 # make install-webconf //部署网站配置 # chkconfig --add nagios //加载服务配置
2)安装nagios-plugins
# tar xf ~/nagios-plugins-2.1.4.tar.gz -C /usr/src/ # cd /usr/src/nagios-plugins-2.1.4/ # ./configure --with-nagios-user=nagios --with-nagios-group=nagcmd # make # make install
三:启用及访问Nagios平台
1)为Nagios平台添加Web管理用户
#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
//建Web管理用户
2)启用nagios、httpd服务
# systemctl restart nagios //启用nagios # systemctl restart httpd //启用Web
3)访问nagios网页界面
firefox http://服务器地址/nagios/ 如图