Ganglia【部署 01】Flume监控工具Ganglia的安装与配置(CentOS 7

  1. 安装其他依赖
yum -y install rrdtool perl-rrdtool rrdtool-devel
yum -y install apr-devel

  1. 安装ganglia的三大组件
yum -y install ganglia-gmetad 
# 安装ganglia-web时间比较久【也有可能是我的网络不好】
yum -y install ganglia-web
yum install -y ganglia-gmond

  1. 修改配置文件

【养成好习惯,修改配置文件前先备份一下,正所谓有备无患 😏 这里要修改4个配置文件】

【第 1️⃣ 个配置:ganglia.conf】

这里解决了Web页面报:You don’t have permission to access /ganglia on this server. 的问题。

vim /etc/httpd/conf.d/ganglia.conf

# 原内容
Alias /ganglia /usr/share/ganglia

<Location /ganglia>
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
  Allow from ::1
  # Allow from .example.com
</Location>

# 修改后
Alias /ganglia /usr/share/ganglia

<Location /ganglia>
 Require all granted
</Location>

【第 2️⃣ 个配置文件:gmetad.conf】

vim /etc/ganglia/gmetad.conf
# 配置数据源 名称 IP地址
data_source "tcloud\_source" tcloud

【第 3️⃣ 个配置文件:gmond.conf】

vim /etc/ganglia/gmond.conf 

# 修改后的模样
cluster {
 name = "tcloud\_source"
 owner = "unspecified"
 latlong = "unspecified"
 url = "unspecified"
}
udp_send_channel {
 host = tcloud
 port = 8649
 ttl = 1
}
udp_recv_channel {
 port = 8649
 bind = tcloud
 retry_bind = true
}

【第 4️⃣ 个配置文件:/etc/selinux/config】

vim /etc/selinux/config

# 配置这两项
SELINUX=disabled
SELINUXTYPE=targeted
# selinux修改需要重启才能生效 临时生效命令
[root@tcloud ~]# setenforce 0
setenforce: SELinux is disabled

2. 启动验证

# 启动 httpd 服务
[root@tcloud ~]# systemctl start httpd.service
# 启动 gmetad 服务
[root@tcloud ~]# systemctl start gmetad.service
# 启动 gmond 服务
[root@tcloud ~]# systemctl start gmond.service

访问 http://tcloud/ganglia 进行验证

在这里插入图片描述
如果出现以上权限问题,修改/var/lib/ganglia目录的权限:

chmod -R 777 /var/lib/ganglia

成功页面为:

在这里插入图片描述

3. 监控测试

  1. 修改 ${FLUME_HOME}/conf/flume-env.sh配置
vim /usr/local/flume/conf/flume-env.sh
# 添加一下配置【添加的时候不要换行】这里是为了大家看得清楚
	JAVA\_OPTS="
 -Dflume.monitoring.type=ganglia 
 -Dflume.monitoring.hosts=tcloud:8649 
 -Xms100m -Xmx200m
 "

  1. 启动一个Flume任务进行测试【我们用 付诸实践 01 里的第一个进行举例】需要注意的是要增加一些监控参数。
# 1.启动
[root@tcloud ~]# flume-ng agent \
-n a1 \
-c conf \
-f /home/flume/test/test-exec-memory-logger.properties \
-Dflume.root.logger=INFO,console \
-Dflume.monitoring.type=ganglia \
-Dflume.monitoring.hosts=tcloud:8649

# 2.发送数据进行测试
[root@tcloud ~]# echo "Test" >> /tmp/log.txt
[root@tcloud ~]# echo "Ganglia" >> /tmp/log.txt

页面显示【云服务器性能不行,为了截这张图等了很久 🚥】:

在这里插入图片描述点击小图可以看详情:

在这里插入图片描述
图例说明:

| 字段(图表名称) | 字段含义 |

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值