ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RHEL 7.1编译安装Ganglia 3.7.1

RHEL 7.1编译安装Ganglia 3.7.1

原创 Linux操作系统 作者:luashin 时间:2016-03-13 21:46:32 0 删除 编辑

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/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9034054/viewspace-2056674/,如需转载,请注明出处,否则将追究法律责任。

上一篇: DRBD主备切换
请登录后发表评论 登录
全部评论

注册时间:2015-02-18

  • 博文量
    290
  • 访问量
    1056760