nagios 4.2.4
Install:
epel源
yum install -y nagios yum install -y nagios-plugins-all
private 目录下面的resource.cfg 文件记录 插件位置
监控、被监控都需要nrpe
yum install -y nrpe
/etc/nagios/nrpe.cfg 命令需要修改
安装完成以后
一、监控端
1、修改配置文件
vim /etc/nagios/nrpe.cfg allow hosts = 127.0.0.1 /usr/lib64/nagios/plugins/ //各插件存放路径
vim /etc/nagios/objects/command.cfg
最后加入,支持pnp以及check_nrpe
#‘check_nrpe‘ command definition define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ } # Bulk with NPCD mode # define command { command_name process-service-perfdata-file command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$ } define command { command_name process-host-perfdata-file command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$ }
vim /etc/nagios/nagios.cfg
cfg_dir=/etc/nagios/servers //指定被监控的主机配置文件的存放路径
创建 /etc/nagios/servers/s0.cfg 关于s0的相关监控项
可以自行添加监视的服务
define host{ use linux-server,host-pnp host_name s0 alias s0 address 192.168.1.88 } define service{ use generic-service,srv-pnp host_name s0 service_description load负载 check_command check_nrpe!check_load }
二、被监控端
vim /etc/nagios/nrpe.cfg
allow hosts = 192.168.1.202 (监控端服务器) /usr/lib64/nagios/plugins/ //执行命令存放的路径 在s0.cfg需要的命令在此文件中 command[check_tomcat1]=/usr/lib64/nagios/plugins/check_service tomcat1 #检查tomcat1服务的状态,需要check_service这个监控插件
具体文件见百度云网盘
nrpe.cfg 里面加上command[check_tomcat1] 以后 不重启nrpe 监控中会提示 check_tomcat1,没有定义
本文出自 “share,open source” 博客,请务必保留此出处http://liqilong2010.blog.51cto.com/3029053/1915065
原文地址:http://liqilong2010.blog.51cto.com/3029053/1915065