RHEL 7.1編譯安裝Ganglia 3.7.1

luashin發表於2016-03-13

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
tar -zxvf confuse-2.7.tar.gz
cd confuse-2.7/
../configure CFLAGS=-fPIC -disable-nls && make && make install
然後編譯安裝ganglia

wget %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 -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 登陸.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9034054/viewspace-2056674/,如需轉載,請註明出處,否則將追究法律責任。

相關文章