安装nagios检测hadoop
Nagios是常用的系统监控工具,提供了很多基本服务的监控脚本,如HTTP,MYSQL等,同时具有不错的可扩展性,自己可定制针对特定参数的监控脚本以及报警的方式.
我现在有三台机器:192.168.0.26 namenode2 主机
192.168.0.27 datanode1 从机
192.168.0.28 datanode2 从机
一.在机子上面安装nagios
1.先在主机上安装apache2 nagios3 nagios-nrpe-plugin这三个,apahce2有的话就不用安装了
sudo
apt-get
install
apache2 nagios3 nagios-nrpe-plugin
在装的过程中,会让你设置nagios报警邮件,选择【Internet Site】,使用SMTP协议发送邮件
要求输入邮件服务器的域名,由于不需要搭建邮件服务器,直接点击【OK】
设置nagios web登陆密码
登陆nagios,http://192.168.0.26/nagios3 账号/密码:nagiosadmin/123456
2.sudo
apt-get
install
nagios3-doc
可以在网页上看nagios的doc
3.在从机上面只需要安装nagios-nrpe-server
sudo
apt-get
install
nagios-nrpe-server
4.启动nagios的命令:
sudo /etc/init.d/nagios3 start
5.cd /etc/nagios3
sudo nagios3 –v nagios.cfg
没有出现错误,一般在启动前,你想查看有没有错误信息,就可以用这个
二.配置检测其它机子
1.在/etc/nagios3/conf.d目录下创建要监控的主机文件hosts.cfg
sudo nano /etc/nagios3/conf.d/hosts.cfg,添加以下内容:
#add namenode2 define host{ use generic-host ; 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 namenode2 alias namenode2 address 192.168.0.26 } #add datanode1 define host{ use generic-host ; 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 datanode1 alias datanode1 address 192.168.0.27 } #add datanode2 define host{ use generic-host ; 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 datanode2 alias datanode2 address 192.168.0.28 }
2.修改/etc/nagios3/conf.d目录下的hostgroups_nagios2.cfg文件,新增主机组,增加以下内容:
# Some generic hostgroup definitions # A simple wildcard hostgroup define hostgroup { hostgroup_name all alias All Servers members * } # A list of your Debian GNU/Linux servers define hostgroup { hostgroup_name debian-servers alias Debian GNU/Linux Servers members namenode2,datanode1,datanode2 } # A list of your web servers define hostgroup { hostgroup_name http-servers alias HTTP servers members namenode2,datanode1,datanode2 } # A list of your ssh-accessible servers define hostgroup { hostgroup_name ssh-servers alias SSH servers members namenode2,datanode1,datanode2 }
修改完这2个以后,重启nagios
sudo /etc/init.d/nagios3 restart
输入用http://192.168.0.26/nagios3输入nagiosadmin密码,就进入nagios监控画面。