CentOS 6.4上通过yum安装Nagios-3.5.0

原文见:http://sharadchhetri.com/2013/05/19/installing- nagios- 3- 5-0-in-centos-6-4-using- yum/
#安装:
rpm -ivh http: //dl .fedoraproject.org /pub/epel/6/i386/epel-release-6-8 .noarch.rpm
yum  install  nagios nagios-devel nagios-plugins* gd gd-devel httpd php  gcc  glibc glibc-common openssl
#设置密码, 默认用户名和密码都是nagiosadmin
htpasswd -c  /etc/nagios/passwd  nagiosadmin  #回车然后输入密码
#检查以下配置是否一样:vi /etc/nagios/cgi.cfg
=============================
     # AUTHENTICATION USAGE
     use_authentication=1
     # SYSTEM/PROCESS INFORMATION ACCESS
     authorized_for_system_information=nagiosadmin
     # CONFIGURATION INFORMATION ACCESS
     authorized_for_configuration_information=nagiosadmin
     # SYSTEM/PROCESS COMMAND ACCESS
     authorized_for_system_commands=nagiosadmin
     # GLOBAL HOST/SERVICE VIEW ACCESS
     authorized_for_all_services=nagiosadmin
     authorized_for_all_hosts=nagiosadmin
     # GLOBAL HOST/SERVICE COMMAND ACCESS
     authorized_for_all_service_commands=nagiosadmin
     authorized_for_all_host_commands=nagiosadmin
#========================================
#设置开机自启动:
chkconfig --level 3 nagios on
chkconfig --level 3 httpd on
#启动:
/etc/init .d /httpd  start
/etc/init .d /nagios  start
#注意SELINUX和IPTABLE 以及你的80端口是否被占用

安装完成,http://ip/nagios 就能看到效果

下面配置要管理的节点:

#新建这个文件,里面添加要监控的机器
#vi /etc/nagios/conf.d/hosts.cfg
#===================
define host{
use linux-server
host_name mysql-node01
alias  mysql-node01
address 192.168.1.110   #这个IP是我mysql机器所的IP
}
#=================
#添加被监控机器需要被监控那些项目 
#vi /etc/nagios/conf.d/services.cfg
#===========================
define service{
use generic-service
host_name mysql-node01
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
define service{
use generic-service
host_name mysql-node01
service_description Current Load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name mysql-node01
service_description Total Processes
check_command check_nrpe!check_users
}
#===========================
#这里对mysql那台机器进行了3项监控: ping load totalProcesses
#其中ping没用到nrpe
#在末尾为nrpe添加命令
#vi /etc/nagios/objects/commands.cfg
#===========================
define  command {
command_name check_nrpe
command_line $USER1$ /check_nrpe  -H $HOSTADDRESS$ -c $ARG1$
}
#===========================
#各种重启
/etc/init .d /nagios  restart
/etc/init .d /nrpe  restart
/etc/init .d /httpd  restart

注意iptables,服务端和客户端均需要5666端口能被互相访问

参考此文配置客户端:

原文见:http://sharadchhetri.com/2013/03/02/how-to-install-and-configure-nagios-nrpe-in-centos-and-red-hat/

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#安装nrpe
rpm -ivh dl.fedoraproject.org /pub/epel/6/i386/epel-release-6-8 .noarch.rpm
 
yum install -y nrpe nagios-plugins-all openssl
 
#修改配置文件,先备份是好习惯
vi /etc/nagios/nrpe .cfg
#找到allowed_hosts=127.0.0.1,在后面加上server端的IP,这样server端才能监控这台机器,比如我加的:
allowed_hosts=127.0.0.1,192.168.1.103
 
#开机自启
chkconfig --level 3 on
 
#启动
/etc/init .d /nrpe start

配置完后,刷新nagios页面,就能看到mysql-node01了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值