Centos7最小安装,编译Nagios

原创
2017/02/10 17:02
阅读数 204

centos7 最小安装

 

yum安装包:

yum install httpd php gcc glibc glibc-common gd gd-devel perl perl-devel unzip

 

建立新账号

useradd -m nagios

passwd nagios

 

groupadd nagcmd

usermod -a -G nagcmd nagios

usermod -a -G nagcmd apache

 

到官网下载核心与插件源代码:

nagios-4.2.4.tar.gz

nagios-plugins-2.1.4.tar.gz

 

编译核心

tar xzf 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

 

定制配置(可选)

vi /usr/local/nagios/etc/objects/contacts.cfg

 

安装网页接口

make install-webconf

建立管理员登录用户密码

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

重启httpd

service httpd restart

 

编译安装插件库

tar xzf nagios-plugins-2.1.3.tar.gz

cd nagios-plugins-2.1.3

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make

make install

 

设置开机启动nagios

chkconfig --add nagios

chkconfig nagios on

 

校验配置文件

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

没有错误,就可以启动

service nagios start

 

SELinux设置

停止SELinux

setenforce 0

添加设置

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/

chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

 

浏览器访问

http://localhost/nagios/

用户密码为刚才htpasswd添加的用户密码

 

参考:

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/quickstart-fedora.html

展开阅读全文
打赏
0
0 收藏
分享
加载中
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部