集群监控工具Ganglia的使用

Ganglia

Ganglia is a scalable, distributed monitoring tool for high-performance computing systems, clusters and networks.
The software is used to view either live or recorded statistics covering metrics such as CPU load averages or network utilization for many nodes.【en.wikipedia.org】

官网:http://ganglia.info/
GitHub:https://github.com/ganglia

Ganglia Monitoring Daemon (gmond)

Gmond is a multi-threaded daemon which runs on each cluster node you want to monitor.
Installation does not require having a common NFS filesystem or a database back-end, installing special accounts or maintaining configuration files.
Gmond has four main responsibilities:

  1. Monitor changes in host state.
  2. Announce relevant changes.
  3. Listen to the state of all other ganglia nodes via a unicast or multicast channel.
  4. Answer requests for an XML description of the cluster state.【en.wikipedia.org】

Ganglia Meta Daemon (gmetad)

Federation in Ganglia is achieved using a tree of point-to-point connections amongst representative cluster nodes to aggregate the state of multiple clusters.
At each node in the tree, a Ganglia Meta Daemon (gmetad) periodically polls a collection of child data sources, parses the collected XML, saves all numeric, volatile metrics to round-robin databases and exports the aggregated XML over a TCP socket to clients. Data sources may be either gmond daemons, representing specific clusters, or other gmetad daemons, representing sets of clusters. Data sources use source IP addresses for access control and can be specified using multiple IP addresses for failover. The latter capability is natural for aggregating data from clusters since each gmond daemon contains the entire state of its cluster. 【en.wikipedia.org】

Ganglia PHP Web Front-end

The Ganglia web front-end provides a view of the gathered information via real-time dynamic web pages. Most importantly, it displays Ganglia data in a meaningful way for system administrators and computer users. Although the web front-end to ganglia started as a simple HTML view of the XML tree, it has evolved into a system that keeps a colorful history of all collected data. 【en.wikipedia.org】

集群CentOS版本

LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.9 (Final)
Release: 6.9
Codename: Final

集群主节点安装

更新epel-release源

1
yum update && yum install epel-release

安装ganglia、rrdtool、gmetad、gmond、web

1
yum install ganglia-devel ganglia rrdtool ganglia-gmetad ganglia-gmond ganglia-web

设置web登录的用户名密码,生成用户名密码文件

1
htpasswd -c /etc/httpd/auth.basic adminganglia

用户adminganglia
密码**

修改httpd配置文件

1
vi /etc/httpd/conf.d/ganglia.conf
1
2
3
4
5
6
7
8
9
10
11
12
<Location /ganglia>
#Order deny,allow
#Allow from all
#Allow from 127.0.0.1
#Allow from ::1
# Allow from .example.com
AuthType basic
AuthName "Ganglia web UI"
AuthBasicProvider file
AuthUserFile "/etc/httpd/auth.basic"
Require user adminganglia
</Location>

修改gmetad.conf文件

1
vi /etc/ganglia/gmetad.conf
1
2
3
4
5
6
gridname “BigDataOnlineGrid"
data_source "master01" 10 master01.online.com
data_source "master02" 10 master02.online.com
data_source "slave01" 10 slave01.online.com
data_source "slave02" 10 slave02.online.com
data_source "slave03" 10 slave03.online.com

修改gmond.conf文件

1
vi /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
30
31
# 集群名称
cluster {
name = "BigdataOnline-Gmond"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
# udp设置
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 = master01.online.com
port = 8649
ttl = 1
}

udp_recv_channel {
#mcast_join = 239.2.11.71
port = 8649
#bind = 239.2.11.71
bind = master01.online.com
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
}

添加到系统服务中

1
2
3
4
5
6
7
chkconfig --add gmetad
chkconfig --add gmond
chkconfig --add httpd

chkconfig gmetad on
chkconfig gmond on
chkconfig httpd on

启动服务

1
2
3
service gmetad start
service gmond start
service httpd start

集群从节点安装

1
yum install ganglia-gmond

修改gmond.conf文件

1
vi /etc/ganglia/gmond.conf
1
2
3
4
5
6
cluster {
name = "BigdataOnline-Gmond"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}

添加到系统服务中

1
2
3
chkconfig --add gmond

chkconfig gmond on

启动gmond服务

1
service gmond start

访问主节点的web

http://master01.online.com/ganglia/

输入用户名密码

Image
Image
Image
Image
Image
Image

邵志鹏 wechat
扫一扫上面的二维码关注我的公众号
0%