官方文档地址:Nagios Docs
一、基础环境的准备
1、关闭selinux
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
2、关闭防火墙
二、安装Nagios Core
1、需要安装的依赖
yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix
2、下载Nagios
cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.1.tar.gz
tar xzf nagioscore.tar.gz
3、编译
cd /tmp/nagioscore-nagios-4.4.1/
./configure
make all
4、创建用户和组(nagios)
make install-groups-users
usermod -a -G nagios apache
5、安装二进制文件
make install
6、安装系统的服务管理,centos6和centos7不同
>>>centos6
make install-daemoninit
chkconfig --level 2345 httpd on
>>>centos7
make install-daemoninit
systemctl enable httpd.service
7、安装command mode
make install-commandmode
8、安装配置文件
make install-config
9、安装apache配置文件
make install-webconf
10、创建nagios管理账户
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
11、启动apache服务
>>>centos6
service httpd start
>>>centos7
systemctl start httpd.service
12、启动nagios服务
>>>centos6
service nagios start
>>>centos7
systemctl start nagios.service
13、访问nagios dashboard
http://192.168.56.7/nagios
正常打开需要验证nagios管理用户
用户:nagiosadmin
密码:第10步创建的密码
14、安装nagios plugin
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release
yum install -y perl-Net-SNMP
cd /tmp
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
tar zxf nagios-plugins.tar.gz
cd /tmp/nagios-plugins-release-2.2.1/
./tools/setup
./configure
make && make install
接下来安装nrpe!