Flume监控之Ganglia:
1 Ganglia的安装与部署
1) 安装httpd服务与php
# yum -y install httpd php
已安装:
httpd.x86_64 0:2.4.6-89.el7.centos.1 php.x86_64 0:5.4.16-46.el7
作为依赖被安装:
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7
httpd-tools.x86_64 0:2.4.6-89.el7.centos.1 mailcap.noarch 0:2.1.41-2.el7
php-cli.x86_64 0:5.4.16-46.el7 php-common.x86_64 0:5.4.16-46.el7
完毕!
2) 安装其他依赖
# yum -y install rrdtool perl-rrdtool rrdtool-devel
# yum -y install apr-devel
3) 安装ganglia
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
获取http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
警告:/var/tmp/rpm-tmp.KbkMeA: 头V3 RSA/SHA256 Signature, 密钥 ID 0608b895: NOKEY
准备中... ################################# [100%]
软件包 epel-release-7-11.noarch (比 epel-release-6-8.noarch 还要新) 已经安装
file /etc/rpm/macros.ghc-srpm from install of epel-release-6-8.noarch conflicts with file from package redhat-rpm-config-9.1.0-87.el7.centos.noarch
# yum -y install ganglia-gmetad
# yum -y install ganglia-gmond
# yum -y install ganglia-web
4) 修改配置文件/etc/httpd/conf.d/ganglia.conf
# vi /etc/httpd/conf.d/ganglia.conf
修改的配置:
#
# Ganglia monitoring system php web frontend
#
Alias /ganglia /usr/share/ganglia
<Location /ganglia>
# Require local
Require all granted
# Require ip 10.1.2.3
# Require host example.org
</Location>
特别注意:以下配置是不能起作用的
# Ganglia monitoring system php web frontend
Alias /ganglia /usr/share/ganglia
<Location /ganglia>
Order deny,allow
#Deny from all
Allow from all
# Allow from 127.0.0.1
# Allow from ::1
# Allow from .example.com
</Location>
5) 修改配置文件/etc/ganglia/gmetad.conf
# vi /etc/ganglia/gmetad.conf
#data_source "my cluster" localhost
data_source "hdp-1" hdp-1
# The name of this Grid. All the data sources above will be wrapped in a GRID
# tag with this name.
# default: unspecified
gridname "MyGrid"
6) 修改配置文件/etc/ganglia/gmond.conf
# vi /etc/ganglia/gmond.conf
cluster {
#name = "unspecified"
name = "hdp-1"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
udp_send_channel {
#bind_hostname = yes # Highly recommended, soon to be default.
# This option tells gmond to use a source address
# that resolves to the machine's hostname. Without
# this, the metrics may appear to come from any
# interface and the DNS names associated with
# those IPs will be used to create the RRDs.
#mcast_join = 239.2.11.71
host = localhost
port = 8649
ttl = 1
}
/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
#mcast_join = 239.2.11.71
port = 8649
#bind = 239.2.11.71
bind = localhost
retry_bind = true
# Size of the UDP buffer. If you are handling lots of metrics you really
# should bump it up to e.g. 10MB or even higher.
# buffer = 10485760
}
如果不是disabled状态,需修改以下配置文件:
vim /etc/selinux/config
或者临时关闭SELinux:
# setenforce 0
7) 修改配置文件/etc/selinux/config
vi /etc/selinux/config
修改为:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
启动ganglia
# service httpd start
# service gmetad start
# service gmond start
打开网页浏览ganglia页面