温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Nagios被监控端简单搭建

发布时间:2020-04-06 10:16:51 来源:网络 阅读:851 作者:qianghong000 栏目:移动开发


Nagios被监控端简单搭建

NRPE 总共由两部分组成:

check_nrpe 插件,位于监控主机上

NRPE daemon,运行在远程的Linux主机上(通常就是被监控机)

按照上图,整个的监控过程如下:

当Nagios 需要监控某个远程Linux 主机的服务或者资源情况时:

Nagios 会运行check_nrpe 这个插件,告诉它要检查什么;

check_nrpe 插件会连接到远程的NRPE daemon,所用的方式是SSL;

NRPE daemon 会运行相应的Nagios 插件来执行检查;

NRPE daemon 将检查的结果返回给check_nrpe 插件,插件将其递交给nagios做处理。

注意:NRPE daemon 需要Nagios 插件安装在远程的Linux主机上,否则,daemon不能做任何的监控。

a)      增加用户&设定密码:

# useradd nagios

# passwd nagios

b)      安装Nagios 插件

#yum -y install gc gcc openssl* openssl-devel xinetd

#mkdir -p /usr/local/install/nagios

# tar zxvf nagios-plugins-1.4.16.tar.gz

# cd nagios-plugins-1.4.16

#./configure--prefix=/usr/local/install/nagios/

# make && make install

这一步完成后会在/usr/local/install/nagios/下生成三个目录include、libexec和share。

修改目录权限

# chown nagios.nagios /usr/local/install/nagios

# chown -R nagios.nagios /usr/local/install/nagios/libexec

c)      安装NRPE

#tar zxvf nrpe-2.12.tar.gz

#cd nrpe-2.12

#./configure --prefix=/usr/local/install/nagios/

# make all

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

# make install-plugin

安装deamon和配置文件

# make install-daemon

# make install-daemon-config

安装xinted脚本

# make install-xinetd

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

d)      编辑xinted脚本:

vi /etc/xinetd.d/nrpe

#only_from       = 127.0.0.1  192.168.56.129   #only_from后增加监控主机的IP地址

编辑/etc/services文件,增加NRPE服务

# echo “nrpe           5666/tcp                #nrpe”>>/etc/services

重启xinted服务

# service xinetd restart

问题:出现xinetd: 未被识别的服务,yum -y install xinetd 后重启

查看NRPE是否已经启动

#netstat -an |grep 5666

tcp        0     0 :::5666                    :::*                        LISTEN 

#iptables -I INPUT -p tcp --dport 5666 -j ACCEPT

#service iptables save

e)      测试NRPE是否则正常工作,成功则返回版本号

#/usr/local/install/nagios/libexec/check_nrpe -H localhost


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI