×

扫描二维码登录本站

QQ登录

只需一步,快速开始

centos6安装nagios-4.0.7的细节

标签: 暂无标签
来自:网络



Centos6.3的安装就不再讲了,我用的是vbox虚拟机来安装的。                      nagios培训
配置好163的源
我的A机为192.168.1.107当成监控机。也就是安装nagios服务器的机器。
我的B机为192.168.1.108当成被监控机。也就是安装nagios-plugnrpe的机器。
我们先安装监控机,也就是服务器。
先安装yum install gcc mysql httpd php gd openssl openssl-devel mysql-server vim wget
Wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.7.tar.gz
Wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
Wget http://nchc.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz            nagios实施

Ls 可以看到nagios-4.0.7.tar.gz nagios-plugins-2.0.3.tar.gz nrpe-2.14.tar.gz
yum install wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp
useradd nagios
passwd nagios
groupadd nagcmd
usermod –a –G nagcmd nagios
tar –xvzf nagios-4.0.7.tar.gz
cd nagios-4.0.7
./configure –with-command-group=nagcmd
可以先./configure –help先看看帮助,应为默认为主是用nagios用户,不需要指定—with-nagios-user或其它什么的。

Make all
Make install
Make install-init
Make install-commandmode
Make install-config
Make install-webconf

Cp –R contrib/eventhandlers/ /usr/local/nagios/libexec/
Chown –R nagios:nagios /usr/local/nagios/libexec/eventhandlers                 监控软件
/usr/local/nagios/bin/nagios –v /usr/local/nagios/etc/nagios.conf
/etc/init.d/nagios start 或者service nagios start
Chkconfig –add nagios
Chkconfig nagios on
Chkconfig httpd on
Service httpd start

Htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin
输入密码nagios

安装nagios-plugins
Tar –xvzf nagios-plugins-2.0.3.tar.gz
Cd nagios-plugins-2.0.3
./configure –with-nagios-user=nagios –with-nagios-group=nagios
Make
Make install
前面这步做了可以略过,反正要做一次。
Chkconfig nagios on 或者chkconfig –level 35 nagios on
Chkconfig httpd on 或者 chkconfig –level 35 httpd on

Iptables –L –n
Vim /etc/sysconfig/selinux selinux改成disabled这个需重启生效。

http://192.168.1.107/nagios/ 这个是nagios地址,要输入用户名和密码的nagiosadmin nagios                        nagios配置

安装NRPE插件。
Tar –xvzf nrpe-2.14.tar.gz
Cd nrpe-2.14
./configure
Make & make all
Make install-plugin
check_nrpe放到/usr/local/nagios/libex下。才能使用check_nrpe



在被监控机器上安装。
Nagios-plugins安装.
Useradd nagios
Passwd nagios
Tar –xvzf nagios-plugins-2.0.3.tar.gz
Cd nagios-plugins
./configure
Make
Make install
Chown –R nagios:nagios /usr/local/nagios

安装nrpe-2.14
Tar –xvzf nrpe-2.14.tar.gz
Cd nrpe-2.14
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config

yum install xinetd
chkconfig –add xinetd
chkconfig xinetd on
make install-xinetd

vim /etc/xinetd.d/nrpe
在该文件的only_from  = 127.0.0.1 192.168.1.107  //在后面增加监控主机的地址,以空格间隔                      开源监控软件
vim /usr/local/nagios/etc/nrpe.cfg 这里也是充许访问里添加 192.168.107
vim /etc/services
根据其文件格式,添加nrpe      5666/tcp 这行。
Service xinetd restart
Netstat –at |grep nrpe
Netstat –an | grep 5666

Vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT (该语句有待,不过我另一台也是这样配的)
好像不添加上面这个不得行,会报check_nrpe:Error - Could not complete SSL handshake

运行ipables –F 清空一下规则,然后保存。
然后iptables –L –n 查看确认后。
Service iptables save
Service iptables restart

/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1     //测试NRPE是否正常工作                   nagios安装
NRPE v2.8.1           //正常的结果会显示当前NRPE的版本号


其实在http://192.168.1.107/nagios/下会报一个http测试403错误.这是因为192.168.0.107上的httpd没有安装web。我在/var/www/html下创建一个echo “<?php phpinfo(); ?>” >test.php ;&cp test.php index.php测试正常。
这个是从控监机查看的被监控机的硬盘使用率的图  

这个是nagios自带的几种服务的检测,新安装的如果没有在服务器上安装web的话会报个web测试错误,我有个test.php这个了,检测全部正常。

这个是nagios的home图。


想做Nagios Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流  QQ群号 476809427






上一篇:nagios插件性能数据格式解读
下一篇:NPC就是Nagios Plugin for Cacti
monicazhang

写了 2297 篇文章,拥有财富 12859,被 21 人关注

您需要登录后才可以回帖 登录 | 立即注册
B Color Link Quote Code Smilies

成为第一个吐槽的人

手机版|小黑屋|最新100贴|论坛版块|ITIL先锋论坛 |粤ICP备11099876号|网站地图
Powered by Discuz! X3.4 Licensed  © 2001-2017 Comsenz Inc.
返回顶部