加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_泰州站长网 (http://www.0523zz.com/)- 视觉智能、AI应用、CDN、行业物联网、智能数字人!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

CentOS 6.3_Nagios配置笔记

发布时间:2016-01-18 00:09:09 所属栏目:Linux 来源:网络整理
导读:一、Nagios监控主机配置(IP:192.168.7.249) 1、安装nrpe服务 解压缩 [root@nagios ~]# tar -zxvf nrpe-2.14.tar.gz [root@nagios ~]# cd nrpe-2.14 编译 [[root

可以看到NRPE的端口是5666,下一步是make all

[root@web nrpe-2.14]# make all

输出如下

*** Compile finished ***

If the NRPE daemon and client compiled without any errors, you

can continue with the installation or upgrade process.

Read the PDF documentation (NRPE.pdf) for information on the next

steps you should take to complete the installation or upgrade.

接下来安装NPRE插件,daemon和示例配置文件

安装check_nrpe这个插件

[root@web nrpe-2.14]# make install-plugin

之前说过监控机需要安装check_nrpe这个插件,被监控机并不需要,我们在这里安装它是为了测试的目的

安装deamon

[root@web nrpe-2.14]# make install-daemon

安装配置文件

[root@web nrpe-2.14]# make install-daemon-config

现在再查看nagios目录就会发现有5个目录

[root@web nrpe-2.14]# ls /usr/local/nagios/

bin  etc  include  libexec  share

按照安装文档的说明,是将NRPE deamon作为xinetd下的一个服务运行的.在这样的情况下xinetd就必须要先安装好,不过一般系统已经默认装了

4、安装xinetd脚本

[root@web nrpe-2.14]# make install-xinetd

输出如下

/usr/bin/install -c -m 644 sample-config/nrpe.xinetd /etc/xinetd.d/nrpe

可以看到创建了这个文件/etc/xinetd.d/nrpe

编辑这个脚本

[root@web ~]# vim /etc/xinetd.d/nrpe

# default: on

# description: NRPE (Nagios Remote Plugin Executor)

service nrpe

{

       flags           = REUSE

       socket_type     = stream

       port            = 5666

       wait            = no

       user            = nagios

       group           = nagios

       server          = /usr/local/nagios/bin/nrpe

       server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd

       log_on_failure  += USERID

       disable         = no

       only_from       = 127.0.0.1    //在后面增加监控主机的地址,例如:192.168.7.249

}

改后

       only_from       = 127.0.0.1,192.168.7.249

配置nrpe信息

[root@web ~]# vi /usr/local/nagios/etc/nrpe.cfg      

81 allowed_hosts=127.0.0.1,192.168.7.249     //允许192.168.7.249服务器端对其监控

将219-223这5行注释掉,并在末尾添加如下命令:

command[check_ping]=/usr/local/nagios/libexec/check_ping -H 192.168.7.93 -w 3000.0,80% -c 5000.0,100% -p 5

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10

command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20

command[check_disk_sda3]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda3

command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z

command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200

command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%

command[check_http]=/usr/local/nagios/libexec/check_http -H 192.168.7.93

command[check_ssh]=/usr/local/nagios/libexec/check_ssh -H 192.168.7.93

command[check_mysql]=/usr/local/nagios/libexec/check_tcp -H 192.168.7.93 -p 3306

---------------------

注:这里客户端/usr/local/nagios/etc/nrpe.cfg内的command[check_mysql]与服务器端/usr/local/nagios/etc/object/services.cfg内的check_command check_nrpe!check_mysql

对应,services.cfg格式在服务器端/usr/local/nagios/etc/object/commands.cfg内有详解.

---------------------

(编辑:云计算网_泰州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读