新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

nagios用NRPE监控Linux主机服务端和客户端的安装配置-创新互联

安装配置nagios服务端:

创新互联主打移动网站、成都做网站、成都网站设计、网站改版、网络推广、网站维护、域名注册、等互联网信息服务,为各行业提供服务。在技术实力的保障下,我们为客户承诺稳定,放心的服务,根据网站的内容与功能再决定采用什么样的设计。最后,要实现符合网站需求的内容、功能与设计,我们还会规划稳定安全的技术方案做保障。

安装前的准备工作

yum -y install httpd gcc glibc glibc-common gd gd-devel php php-mysql mysql mysql-devel mysql-server
groupadd nagcmd
useradd -G nagcmd nagios
passwd nagios
usermod -a -G nagcmd apache

vim /etc/httpd/conf/httpd.conf

DirectoryIndex index.php index.html index.html.var  #找到这一行,添加index.php

编译安装nagios:

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.5.tar.gz
tar zxf nagios-4.0.5.tar.gz
cd nagios-4.0.5
./configure --with-command-group=nagcmd --enable-event-broker
make all
make install
make install-init
make install-commandmode
make install-config

附:在解压的时候如果提示下面的错误,是因为系统时间不对

tar: nagios-4.0.5/xdata/xsddefault.c: time stamp 2014-04-12 02:37:42 is 250653.223481153 s in the future

tar: nagios-4.0.5/xdata/xsddefault.h: time stamp 2014-04-12 02:37:42 is 250653.223419364 s in the future

tar: nagios-4.0.5/xdata: time stamp 2014-04-12 02:37:42 is 250653.223359922 s in the future

修改系统时间

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

service ntpd stop

ntpdate asia.pool.ntp.org ; hwclock -w

需要在httpd的配置文件目录(conf.d)中生成Nagios的Web程序配置文件,继续在此编译安装目录输入一条命令:

# make install-webconf

创建一个登录nagios web程序的用户,这个用户帐号在以后通过web登录nagios认证时所用:

# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin #输入登陆nagios的密码

# service httpd restart

编译、安装nagios-plugins

nagios的所有监控工作都是通过插件完成的,因此,在启动nagios之前还需要为其安装官方提供的插件。http://exchange.nagios.org/directory/Plugins nagios插件链接

wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz
tar zxf nagios-plugins-2.0.tar.gz
cd nagios-plugins-2.0
./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,

vim /etc/sysconfig/selinux  将其中的selinux后面的值“force”修改为“disable”或者

临时性的改动selinux也可以

# setenforce 0
# getenforce
Permissive

或者将nagios的CGI程序运行于SELinux/targeted模式而不用关闭selinux:

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

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

通过web界面查看nagios:

http://your_nagios_IP/nagios

输入帐号和密码

这时候可以看到本机的服务状态,如果没有出现页面,请检查iptables的80端口是否开放

如果出现下面提示,说明是selinux的问题,setenforce 0即可

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

安装NRPE,服务端需要自己的check_nrpe,和被监控端联系

下载页面

http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz?r=&ts=1363788540&use_mirror=hivelocity

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前名称:nagios用NRPE监控Linux主机服务端和客户端的安装配置-创新互联
分享URL:http://www.wjwzjz.com/article/iehhp.html
在线咨询
服务热线
服务热线:028-86922220
TOP