码迷,mamicode.com
首页 > 移动开发 > 详细

监控和安全运维 1.5 nagios监控客户端-1

时间:2016-01-04 23:53:44      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

3. Nagios安装 - 客户端(192.168.0.12)
在客户端机器上

 rpm -ivh  http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm
yum install -y nagios-plugins nagios-plugins-all nrpe nagios-plugins-nrpe 

修改配置文件

vim /etc/nagios/nrpe.cfg
“allowed_hosts=127.0.0.1” 改为 “allowed_hosts=127.0.0.1,192.168.1.117” 后面的ip为服务端ip; 

找到” dont_blame_nrpe=0” 改为  “dont_blame_nrpe=1

 

启动客户端

/etc/init.d/nrpe start

 

4. 监控中心(192.168.1.117)添加被监控主机(192.168.1.111)

在服务端

cd /etc/nagios/conf.d/
vim 192.168.1.111.cfg  

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name 192.168.1.111
alias 1.111
address 192.168.1.111
}


define service{
use generic-service
host_name 192.168.1.111
service_description check_ping
check_command check_ping!100.0,20%!200.0,50%
max_check_attempts 5
normal_check_interval 1
}


define service{
use generic-service
host_name 192.168.1.111
service_description check_ssh
check_command check_ssh
max_check_attempts 5
normal_check_interval 1
}


define service{
use generic-service
host_name 192.168.1.111
service_description check_http
check_command check_http
max_check_attempts 5
normal_check_interval 1
}

 

5. 配置文件的简单说明
我们定义的配置文件中一共监控了三个service:ssh, ping, http

这三个项目是使用本地的nagios工具去连接远程机器,也就是说即使客户端没有安装nagios-plugins以及nrpe也是可以监控到的。其他的一些service诸如负载、磁盘使用等是需要服务端通过nrpe去连接到远程主机获得信息,所以需要远程主机安装nrpe服务以及相应的执行脚本(nagios-plugins)
max_check_attempts 5  #当nagios检测到问题时,一共尝试检测5次都有问题才会告警,如果该数值为1,那么检测到问题立即告警
normal_check_interval 1#重新检测的时间间隔,单位是分钟,默认是3分钟
notification_interval           60 #在服务出现异常后,故障一直没有解决,nagios再次对使用者发出通知的时间。单位是分钟。如果你认为,所有的事件只需要一次通知就够了,可以把这里的选项设为0


检测配置文件

nagios -v /etc/nagios/nagios.cfg

重启

service httpd restart; service nagios restart
/etc/init.d/nrpe start

 

 

http://www.apelearn.com/bbs/thread-7155-1-1.html

 

监控和安全运维 1.5 nagios监控客户端-1

标签:

原文地址:http://www.cnblogs.com/wangshaojun/p/5100487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!