Nagios Core 安装

Nagios
Nagios

 

 

 

 

 

 

 

参考官方安装文档

安装系统Centos7

[root@vnagios ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

1. 安装需要用到的软件包:

yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp unzip

2. 下载nagios

cd /tmp
wget http://nchc.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.2.3/nagios-4.2.3.tar.gz
wget http://nagios-plugins.org/download/nagios-plugins-2.1.4.tar.gz

3.添加用户以及组

[root@vnagios ~]# useradd nagios
[root@vnagios ~]# groupadd nagcmd
[root@vnagios ~]# usermod -a -G nagcmd nagios
[root@vnagios ~]# usermod -a -G nagios,nagcmd apache

4. 解压nagios core安装包

[root@vnagios tmp]# tar vzxf nagios-4.2.3.tar.gz
[root@vnagios tmp]# tar vzxf nagios-plugins-2.1.4.tar.gz

5. 编译安装

[root@vnagios nagios-4.2.3]# ./configure --with-command-group=nagcmd
make all
make install 
make install-init 
make install-config 
make install-commandmode 
make install-webconf 
[root@vnagios nagios-4.2.3]# cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
[root@vnagios nagios-4.2.3]# chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

检查下:

[root@vnagios nagios-4.2.3]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

启动nagios

[root@vnagios nagios-4.2.3]# /etc/init.d/nagios start
Reloading systemd:                                         [  OK  ]
Starting nagios (via systemctl):                           [  OK  ]
启动apache
[root@vnagios nagios-4.2.3]# service httpd start
Redirecting to /bin/systemctl start  httpd.service

设置访问密码账号
.
[root@vnagios nagios-4.2.3]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

配置nagios plugin

[root@vnagios nagios-4.2.3]# cd /tmp/nagios-plugins-2.1.4
[root@vnagios nagios-plugins-2.1.4]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
make 
make install

配置 nagios 服务

chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --level 35 httpd on

尝试访问下:
http:///nagios

这里地址为:http://192.168.146.136/nagios/

 

nagios2

Leave a Comment