共计 4344 个字符,预计需要花费 11 分钟才能阅读完成。
RHEL 7.1 编译安装 Ganglia 3.7.1
1. 安装依赖
yum groupinstall -y “Development tools” “Basic Web Server”
yum install pcre pcre-devel apr-devel apr-util-devel apr-util zlib-devel zlib rrdtool-devel rrdtool python-devel php
2. 添加用户
useradd ganglia
passwd ganglia
3. 从源代码编译安装,先安装 confuse.
cd /usr/local/src
#install confuse
wget http://download.savannah.gnu.org/releases/confuse/confuse-2.7.tar.gz
tar zxvf confuse-2.7.tar.gz
cd confuse-2.7/
../configure CFLAGS=-fPIC -disable-nls
make && make install
然后编译安装 ganglia
wget http://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.7.1/ganglia-3.7.1.tar.gz/download
mv download ganglia-3.7.1.tar.gz
tar zxvf ganglia-3.7.1.tar.gz
cd ganglia-3.7.1/
./configure –prefix=/usr/local/ganglia –with-gmetad –enable-gexec –sysconfdir=/etc/ganglia –with-python=/usr/bin/python
make && make install
4. 配置 gmetad 和 gmond.
cp gmetad/gmetad.conf /etc/ganglia/
/usr/local/ganglia/sbin/gmond -t |tee /etc/ganglia/gmond.conf
首先配置 gmetad.
vim /etc/ganglia/gmetad.conf
data_source “my cluster” YOUR_FQDN
# setuid_username “nobody”
setuid_username “ganglia”
然后配置 gmond.
vim /etc/ganglia/gmond.conf
setuid = yes
#user = nobody
user =ganglia
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
查看 gmond 的 python 扩展,确保 modpython.so 被编译出来。
locate modpython.so
/usr/local/ganglia/lib64/ganglia/modpython.so
#create gmond python directory
mkdir -p /usr/local/ganglia/lib64/ganglia/python_modules
/usr/local/ganglia/sbin/gmond -d10
# 应该能看到 loaded module: python_module
#copy python module / py.conf
cp /usr/local/src/ganglia-3.7.1/gmond/python_modules/*/*.py /usr/local/ganglia/lib64/ganglia/python_modules
cp /usr/local/src/ganglia-3.7.1/gmond/python_modules/conf.d/*.pyconf /etc/ganglia/conf.d
配置启动项:
cp gmetad/gmetad.init /etc/rc.d/init.d/gmetad
cp gmond/gmond.init /etc/rc.d/init.d/gmond
vim /etc/init.d/gemtad(edit these)
#GMETAD=/usr/sbin/gmetad
GMETAD=/usr/local/ganglia/sbin/gmetad
#daemon $GMETAD
daemon $GMETAD -c /etc/ganglia/gmetad.conf
vim /etc/init.d/gmond (edit these)
#GMOND=/usr/sbin/gmond
GMOND=/usr/local/ganglia/sbin/gmond
#daemon $GMOND
daemon $GMOND -c /etc/ganglia/gmond.conf
配置 systemd 服务
vim /usr/lib/systemd/system/gmetad.service(edit these lines)
[Service]
Type=forking
#PIDFile=/usr/local/ganglia/var/run/gmetad.pid
PIDFile=/var/run/gmetad.pid
#ExecStart=/usr/local/ganglia/sbin/gmetad –pid-file=/usr/local/ganglia/var/run/gmetad.pid
ExecStart=/usr/local/ganglia/sbin/gmetad -c /etc/ganglia/gmetad.conf –pid-file=/var/run/gmetad.pid
EnvironmentFile=-/etc/ganglia/default/gmetad
vim /usr/lib/systemd/system/gmond.service(edit these lines)
[Service]
Type=forking
#PIDFile=/usr/local/ganglia/var/run/gmond.pid
PIDFile=/var/run/gmond.pid
#ExecStart=/usr/local/ganglia/sbin/gmond –pid-file=/usr/local/ganglia/var/run/gmond.pid
ExecStart=/usr/local/ganglia/sbin/gmond -c /etc/ganglia/gmond.conf –pid-file=/var/run/gmond.pid
为 rrdtool 创建目录:
mkdir -p /var/lib/ganglia/rrds
chown ganglia:ganglia /var/lib/ganglia/rrds
启动服务:
systemctl daemon-reload
systemctl start gmetad
systemctl start gmond
至此,netstat 可以看到端口监听,可以 telnet localhost 8649, 能看到 xml,ps -ef 证实 gmetad 和 gmond 确实是以 ganglia 用户在运行,”/var/lib/ganglia/rrds” 目录下有文件生成.
netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8649 0.0.0.0:* LISTEN 18465/gmond
tcp 0 0 0.0.0.0:8651 0.0.0.0:* LISTEN 17783/gmetad
tcp 0 0 0.0.0.0:8652 0.0.0.0:* LISTEN 17783/gmetad
5. 配置 ganglia-web
wget http://sourceforge.net/projects/ganglia/files/ganglia-web/3.7.1/ganglia-web-3.7.1.tar.gz
tar xzvf ganglia-web-3.7.1.tar.gz
vi Makefile(Edit these)
GDESTDIR = /var/www/html/ganglia
APACHE_USER = apache
ZZ
make install
6. 从 GUI 登陆.
http://YOUR_IP/ganglia/
下面关于 Ganglia 的文章您也可能喜欢,不妨参考下:
Ganglia 3.1.x 下扩展 Python 模块(翻译自官方 wiki) http://www.linuxidc.com/Linux/2014-04/99565.htm
使用 Ganglia 监控 Hadoop 集群 http://www.linuxidc.com/Linux/2012-05/61349.htm
在 VMware Workstation 的 Ubuntu 下安装和配置 Hadoop 与 Ganglia http://www.linuxidc.com/Linux/2013-06/85856.htm
Ganglia 安装部署之一建立 Grid http://www.linuxidc.com/Linux/2013-05/83673.htm
Ganglia 极其简单安装教程 yum 版 http://www.linuxidc.com/Linux/2012-12/76536.htm
Ganglia 快速开始向导(翻译自官方 wiki)http://www.linuxidc.com/Linux/2013-11/92747.htm
CentOS 集群上安装 Ganglia-3.6.0 监控 Hadoop-2.2.0 和 HBase-0.96.0 http://www.linuxidc.com/Linux/2014-01/95804.htm
Ganglia 在 CentOS 6.5 的安装 http://www.linuxidc.com/Linux/2014-05/102024.htm
在 Ubuntu 14.04 Server 上安装 Ganglia http://www.linuxidc.com/Linux/2014-08/105838.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-12/126199.htm