Ganglia 的安装与部署及Flume1.9 数据流监控

背景

Ganglia主要用来监控系统性能的软件,通过曲线很容易见到每个节点的工作状态,对合理调整,分配系统资源,提高系统整体性能起到重要作用,支持浏览器方式访问,但不能监控节点硬件技术指标。Ganglia是分布式的监控系统。

Ganglia由gmond、gmetad和gweb三部分组成。

gmondGanglia Monitoring Daemon是一种轻量级服务,安装在每台需要收集指标数据的节点主机上。使用gmond,你可以很容易收集很多系统指标数据,如CPU、内存、磁盘、网络和活跃进程的数据等。

gmetadGanglia Meta Daemon整合所有信息,并将其以RRD格式存储至磁盘的服务。

gwebGanglia WebGanglia可视化工具gweb是一种利用浏览器显示gmetad所存储数据的PHP前端。在Web界面中以图表方式展现集群的运行状态下收集的多种不同指标数据。

 

安装 

 1. 安装 httpd 服务与 php

sudo yum -y install httpd php

2.安装其他依赖 

sudo yum -y install rrdtool perl-rrdtool rrdtool-devel
sudo yum -y install apr-devel

 3.安装ganglia

# 需要安装源(CentOs默认源是没有Ganglia源)
yum -y install epel-release

sudo yum -y install ganglia-gmetad

sudo yum -y install ganglia-web

sudo yum install -y ganglia-gmond

4.修改配置文件/etc/httpd/conf.d/ganglia.conf 

Alias /ganglia /usr/share/ganglia

	       Require all granted
           Allow from all
	#  Order deny,allow
	#  Deny from all
	#  Allow from ::1
   # Allow from .example.com

 5.修改配置文件/etc/ganglia/gmetad.conf

#            名称     对应的ip地址
data_source "master" 192.168.16.58

6.修改配置文件/etc/ganglia/gmond.conf

cluster {
	#########需要修改的项-name
    name = "master" 
	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 # 数据发送给 master
	#########需要修改的项-host
	host = 192.168.16.58
	port = 8649
	ttl = 1
udp_recv_channel {
# mcast_join = 239.2.11.71 port = 8649
# 接收来自任意连接的数据	
	#########需要修改的项-bind
	bind = 192.168.16.58
	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
}

 7.修改配置文件/etc/selinux/config

PS: selinux本次生效关闭必须重启,如果此时不想重启,可以临时生效之(不过现场测试目标文件和即将要改成的文件内容一致,似乎不需要更改)

# 不理解重启获取使其生效
sudo setenforce 0
# 需要修改的项 - SELINUX
SELINUX=disabled
# SELINUXTYPE= can take one of these two values: #	targeted - Targeted processes are protected, #	mls - Multi Level Security protection.
SELINUXTYPE=targeted

8.启动ganglia

sudo service httpd start

sudo service gmetad start

sudo service gmond start

9. 打开网页浏览 ganglia 页面

# 地址为
http://192.168.16.58/ganglia

PS: 如果完成以上操作依然出现权限不足错误,请修改/var/lib/ganglia目录的权限

sudo chmod -R 777 /var/lib/ganglia

展示效果如下 

Ganglia 的安装与部署及Flume1.9 数据流监控_第1张图片

监控flume1.9 

 创建flume配置

vi flume-netcat-logger.conf
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444

# Describe the sink
a1.sinks.k1.type = logger

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

启动命令 

启动后在另一个控制窗口nc localhost 44444,发送信息

../apache-flume-1.9.0-bin/bin/flume-ng agent \
--conf ../apache-flume-1.9.0-bin/conf/ \
--name a1 \
--conf-file ./flume-netcat-logger.conf -Dflume.root.logger=INFO,console \
-Dflume.monitoring.type=ganglia \
-Dflume.monitoring.hosts=192.168.16.44:8649

 监控效果

Ganglia 的安装与部署及Flume1.9 数据流监控_第2张图片

 

你可能感兴趣的:(技术实战,linux,运维,服务器)