背景
Ganglia主要用来监控系统性能的软件,通过曲线很容易见到每个节点的工作状态,对合理调整,分配系统资源,提高系统整体性能起到重要作用,支持浏览器方式访问,但不能监控节点硬件技术指标。Ganglia是分布式的监控系统。
Ganglia由gmond、gmetad和gweb三部分组成。
gmond(Ganglia Monitoring Daemon)是一种轻量级服务,安装在每台需要收集指标数据的节点主机上。使用gmond,你可以很容易收集很多系统指标数据,如CPU、内存、磁盘、网络和活跃进程的数据等。
gmetad(Ganglia Meta Daemon)整合所有信息,并将其以RRD格式存储至磁盘的服务。
gweb(Ganglia Web)Ganglia可视化工具,gweb是一种利用浏览器显示gmetad所存储数据的PHP前端。在Web界面中以图表方式展现集群的运行状态下收集的多种不同指标数据。
安装
1. 安装 httpd 服务与 php
1sudo yum -y install httpd php
2.安装其他依赖
1
2sudo yum -y install rrdtool perl-rrdtool rrdtool-devel sudo yum -y install apr-devel
3.安装ganglia
1
2
3
4
5
6
7
8
9# 需要安装源(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
1
2
3
4
5
6
7
8
9Alias /ganglia /usr/share/ganglia <Location /ganglia> Require all granted Allow from all # Order deny,allow # Deny from all # Allow from ::1 # Allow from .example.com </Location>
5.修改配置文件/etc/ganglia/gmetad.conf
1
2
3# 名称 对应的ip地址 data_source "master" 192.168.16.58
6.修改配置文件/etc/ganglia/gmond.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30cluster { #########需要修改的项-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本次生效关闭必须重启,如果此时不想重启,可以临时生效之(不过现场测试目标文件和即将要改成的文件内容一致,似乎不需要更改)
复制代码1
2# 不理解重启获取使其生效 sudo setenforce 0
1
2
3
4
5# 需要修改的项 - 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
1
2
3
4
5
6sudo service httpd start sudo service gmetad start sudo service gmond start
9. 打开网页浏览 ganglia 页面
1
2# 地址为 http://192.168.16.58/ganglia
PS: 如果完成以上操作依然出现权限不足错误,请修改/var/lib/ganglia目录的权限
1sudo chmod -R 777 /var/lib/ganglia
展示效果如下
监控flume1.9
创建flume配置
1vi flume-netcat-logger.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21# 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,发送信息
1
2
3
4
5
6../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 数据流监控背景安装 监控flume1.9 的全部内容,更多相关Ganglia内容请搜索靠谱客的其他文章。
发表评论 取消回复