我是靠谱客的博主 眼睛大画板,这篇文章主要介绍GangLia搭建使用,现在分享给大家,希望可以做个参考。

需求: 采集多个节点中的负载情况,多个节点划分为多个集群监控

复制代码
1
2
3
4
5
6
7
8
9
ganglia的简单角色划分 ganglia-web : web展示 ganglia-gmetad 数据收集处理 ganglib-gmond 数据采集发送 这里不再详细介绍:查看文末的参考博客

计划的集群分布:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
node1(监控节点) web gmetad gmond(可以不安装,如果不用监控node1信息,这里不安装) cluster1(只安装配置gmond) node2 node3 cluster2(只安装配置gmond) node4 node5
复制代码
1
2
3
4
5
node1 部署: web gmetad gmond(可以不安装,因为我不需要监node1 信息)
复制代码
1
2
3
4
yum install -y ganglia-web.x86_64 yum install -y ganglia-gmetad.x86_64 yum install -y nginx php-fpm

配置文件:
/etc/nginx/conf.d/default.conf(不存在则新建)

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server { listen 8081 default_server; server_name _; root /usr/share/ganglia; index index.php; include /etc/nginx/default.d/*.conf; location / { } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }

端口号什么的根据自己的需要配置。

启动服务:

复制代码
1
2
3
4
service nginx start service gmetad start service gmond start (未安装配置则不需要开启)

根据centos版本: 可以使用systemctl restart gmetad ...

如果是内网配置,会发现页面显示异常,f12 调试发现,有一些js需要下载。
这里看到 ganglia的web目录是 /usr/share/ganglia

此时打开
/usr/share/ganglia

grep -rn xxx.js(加载不到的js文件名) --include=*.php

尝试查找包含了需要外部下载的js,在conf_default.php 中发现这些js需要从外网下载, (下面文件为已经修改过的版本)
所以手动下载,然后改为本地路径指向。
我打开了git bash 使用

复制代码
1
2
curl www.xxxx.js > xxx.js

下载之后再传到 /usr/share/ganglia/js

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
#By default we'll just download Jquery, Cubism and D3 required libraries from a CDN that offers #that for free. If that is undesirable you can override this in conf.php by putting #downloading the asset and putting relative path or absolute paths to it e.g. #$conf['cubism_js_path'] = "js/cubism.v1.min.js"; $conf['jquery_js_path'] = "js/jquery.min.js"; $conf['jquerymobile_js_path'] = "js/jquery.mobile.min.js"; $conf['jqueryui_js_path'] = "js/jquery-ui.min.js"; $conf['rickshaw_js_path'] = "js/rickshaw.min.js"; $conf['cubism_js_path'] = "js/cubism.v1.min.js"; $conf['d3_js_path'] = "js/d3.min.js"; $conf['protovis_js_path'] = "js/protovis.min.js";

这里的话,web显示应已经可以了。

下一步添加监控节点集群 。

首先需要在 node1 节点 配置
/etc/ganglia 目录下
gmetad.conf

这里贴一下更改的地方

复制代码
1
2
3
4
data_source "cluster1" node2 node3 data_source "cluster2" node4:8650 node5:8650 #不填写端口号的话,默认就是 8649 。这个端口号要与后面的gmond端配置一致,多个host只会从一个host获取。获取失败,则会再找一个获取。每一个host都包含了所有的信息。

其他节点部署gmond即可

yum install ganglia-gmond.x86_64 -y
配置 /etc/ganglia 下gmond.conf

cluster1 gmond 配置 node2 node3

复制代码
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
30
31
32
33
34
35
36
37
38
39
40
41
cluster { name = "cluster1" #这个是node1上的datasource 配置 owner = "unspecified" latlong = "unspecified" url = "unspecified" } /* The host section describes attributes of the host, like the location */ host { location = "unspecified" } /* Feel free to specify as many udp_send_channels as you like. Gmond used to only support having a single channel */ 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 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 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 } /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ tcp_accept_channel { port = 8649 #If you want to gzip XML output gzip_output = no }
复制代码
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cluster2 gmond 配置 node2 node3节点上(要注意一下端口号) cluster { name = "cluster2" #这个是node1上的datasource 配置 owner = "unspecified" latlong = "unspecified" url = "unspecified" } /* The host section describes attributes of the host, like the location */ host { location = "unspecified" } /* Feel free to specify as many udp_send_channels as you like. Gmond used to only support having a single channel */ 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 port = 8650 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 = 8650 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 } /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ tcp_accept_channel { port = 8650 #If you want to gzip XML output gzip_output = no }

问题:

复制代码
1
2
yum install ganglia-gmond.x86_64 -y

如果报错

复制代码
1
2
"Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"

解决:
打开epel仓库参数更改为: gpgcheck=0

参考 blog:
简单介绍 : http://blog.sina.com.cn/s/blog_eb0636d10102v3gt.html
部署: https://www.cnblogs.com/marility/p/9444357.html

最后

以上就是眼睛大画板最近收集整理的关于GangLia搭建使用的全部内容,更多相关GangLia搭建使用内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(68)

评论列表共有 0 条评论

立即
投稿
返回
顶部