nagios core安装
- selinux修改 本文档适合在selinux的disabled或permissive模式下
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
- 检查安装pre-requisite packages
yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix
- 下载源码包
cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.1.tar.gz
tar xzf nagioscore.tar.gz
- 编译
cd /tmp/nagioscore-nagios-4.4.1/
./configure
make all
- 创建用户和用户组
make install-groups-users
usermod -a -G nagios apache
- 安装各项文件
安装binaries
make install
安装service/deamon
make install-daemoninit
systemctl enable httpd.service
安装command mode 安装和配置外部命令文件
make install-commandmode
安装Configuration Files 安装SAMPLE配置文件,nagios需要一些配置文件才能启动
make install-config
Install Apache Config Files 安装Apache web server 配置文件,如果有必要则配置Apache settings
make install-webconf
- 配置防火墙
firewall-cmd --zone=public --add-port=80/tcp
firewall-cmd --zone=public --add-port=80/tcp --permanent
- 创建nagios管理员用户账户
用于登录web界面,若要再添加额外的账户,要在指令中去掉-c选项,手动输入两次密码确认
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
- 启动apache和nagios
systemctl start httpd.service
systemctl start nagios.service
- 测试安装
在浏览器输入一下链接:
http://192.168.0.230/nagios
http://域名/nagios
仅安装nagios core虽然能运行服务,但是不能进行监控,在web页面能看到相关错误信息
[图片上传失败...(image-c5def0-1534665384068)]
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
- 下载nagios plugin 源码包
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
- 测试插件安装
刷新nagios网页 [图片上传失败...(image-aa0264-1534665384068)]
- nagios服务控制相关命令
systemctl start nagios.service
systemctl stop nagios.service
systemctl restart nagios.service
systemctl status nagios.service
END
网友评论