监控nagios安装配置

回复 收藏
1--关闭服务器和selinux
[root@localhost-150 ~]# chkconfig  ip6tables off
[root@localhost-150 ~]# chkconfig  iptables off
[root@localhost-150 ~]# chkconfig --list|grep iptables
iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@localhost-150 ~]# chkconfig --list|grep ip6tables
ip6tables       0:off   1:off   2:off   3:off   4:off   5:off   6:off

[root@localhost-150 ~]# vi /etc/selinux/config

SELINUX=disabled
重启服务器
2--Nagios安装 - 服务端(192.168.1.151)

安装一个epel的扩展源
[root@64 ~]# wget -P /etc/yum.repos.d/  http://mirrors.aliyun.com/repo/epel-6.repo
安装扩展YUM源
[root@64 ~]# yum install -y httpd nagios nagios-plugins nagios-plugins-all nrpe nagios-plugins-nrpe
安装主要组件及工具
[root@64 ~]# htpasswd -c /etc/nagios/passwd nagiosadmin
创建用户和密码
[root@64 ~]# vim /etc/nagios/nagios.cfg
[root@64 ~]# nagios -v /etc/nagios/nagios.cfg
检测配置文件
Total Warnings: 0
Total Errors:   0
启动服务
[root@64 ~]# service httpd start
[root@64 ~]# service nagios start
浏览器访问: http://ip/nagios


2. Nagios安装 - 客户端(192.168.1.109)
[root@64 ~]# wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo
安装扩展YUM源
[root@64 ~]# yum install -y nagios-plugins nagios-plugins-all nrpe nagios-plugins-nrpe
[root@64 ~]#vim /etc/nagios/nrpe.cfg
找到“allowed_hosts=127.0.0.1” 改为 “allowed_hosts=127.0.0.1,192.168.1.151”
allowed_hosts=127.0.0.1,192.168.1.151
找到” dont_blame_nrpe=0” 改为  “dont_blame_nrpe=1” 
dont_blame_nrpe=1

 [root@64 ~]#  /etc/init.d/nrpe start

3. 监控中心(192.168.1.151)添加被监控主机(192.168.1.109)

[root@64 yum.repos.d]# cd /etc/nagios/conf.d/
[root@64 conf.d]# vim 192.168.1.109.cfg
define host{
        use                     linux-server            
        host_name           192.168.1.109
        alias                       1.109
        address                 192.168.1.109
        }

define service{
        use                     generic-service
        host_name               192.168.1.109
        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.109
        service_description     check_ssh
        check_command           check_ssh
        max_check_attempts      5   
        normal_check_interval 1   
        notification_interval           60
define service{
        use                     generic-service
        host_name               192.168.1.109
        service_description     check_http
        check_command           check_http
        max_check_attempts      5
        normal_check_interval 1
}
2016-05-07 11:06 举报
已邀请:
0

88888888

赞同来自:

如果服务打不开 建议看看防火墙或者重启服务
0

88888888

赞同来自:

如果服务打不开 建议看看防火墙或者重启服务

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: