9.2 在被监控机(Nagios-Linux)上
a. 增加用户&设定密码
# useradd nagios
# passwd nagios

b. 安装Nagios 插件
这一步完成后会在/usr/local/nagios/下生成三个目录include、libexec和share。
修改目录权限
c. 安装NRPE


接下来安装NPRE插件,daemon和示例配置文件。
c.1 安装check_nrpe 这个插件
# make install-plugin
监控机需要安装check_nrpe 这个插件,被监控机并不需要,我们在这里安装它只是为了测试目的。
c.2 安装deamon
# make install-daemon
c.3 安装配置文件
# make install-daemon-config

现在再查看nagios 目录就会发现有5个目录了
按照安装文档的说明,是将NRPE deamon作为xinetd下的一个服务运行的。在这样的情况下xinetd就必须要先安装好,不过一般系统已经默认安装了。
d. 安装xinted 脚本
# make install-xinetd
可以看到创建了这个文件/etc/xinetd.d/nrpe。

在only_from 后增加监控主机的IP地址。
重启xinted 服务
# service xinetd restart
查看NRPE 是否已经启动
可以看到5666端口已经在了。
e. 测试NRPE是否则正常工作
使用上面在被监控机上安装的check_nrpe 这个插件测试NRPE 是否工作正常。
# /usr/local/nagios/libexec/check_nrpe -H localhost
会返回当前NRPE的版本
也就是在本地用check_nrpe连接nrpe daemon是正常的。
注:为了后面工作的顺利进行,注意本地防火墙要打开5666能让外部的监控机访问。
f. check_nrpe 命令用法
查看check_nrpe 命令用法
# /usr/local/nagios/libexec/check_nrpe –h


可以看到用法是:
check_nrpe –H 被监控的主机 -c 要执行的监控命令
注意:-c 后面接的监控命令必须是nrpe.cfg 文件中定义的。也就是NRPE daemon只运行nrpe.cfg中所定义的命令。
g.查看NRPE的监控命令
# cd /usr/local/nagios/etc
# cat nrpe.cfg |grep -v "^#"|grep -v "^$"
[root@Nagiso-Linux etc]# cat nrpe.cfg |grep -v "^#"|grep -v "^$"
log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1
dont_blame_nrpe=0
debug=0
command_timeout=60
connection_timeout=300
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_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
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
[root@Nagiso-Linux etc]#
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/shumachanpin/article-42965-11.html
质量数量)
战前北洋水师已经十年没有更新舰艇了