Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1782326
  • 博文数量: 297
  • 博客积分: 285
  • 博客等级: 二等列兵
  • 技术积分: 3006
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-06 22:04
个人简介

Linuxer, ex IBMer. GNU https://hmchzb19.github.io/

文章分类

全部博文(297)

文章存档

2020年(11)

2019年(15)

2018年(43)

2017年(79)

2016年(79)

2015年(58)

2014年(1)

2013年(8)

2012年(3)

分类: LINUX

2015-12-02 13:15:08

1.  安装依赖

点击(此处)折叠或打开

  1. yum groupinstall -y "Development tools" "Basic Web Server"
  2. yum install pcre pcre-devel apr-devel apr-util-devel apr-util zlib-devel zlib rrdtool-devel rrdtool python-devel php
2.  添加用户

点击(此处)折叠或打开

  1. useradd ganglia
  2. passwd ganglia
3.  从源代码编译安装,先安装confuse.

点击(此处)折叠或打开

  1. cd /usr/local/src
  2. #install confuse
  3. wget http://download.savannah.gnu.org/releases/confuse/confuse-2.7.tar.gz
  4. tar zxvf confuse-2.7.tar.gz
  5. cd confuse-2.7/
  6. ../configure CFLAGS=-fPIC -disable-nls
  7. make && make install
然后编译安装ganglia

点击(此处)折叠或打开

  1. wget http://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.7.1/ganglia-3.7.1.tar.gz/download
  2. mv download ganglia-3.7.1.tar.gz
  3. tar zxvf ganglia-3.7.1.tar.gz
  4. cd ganglia-3.7.1/
  5. ./configure --prefix=/usr/local/ganglia --with-gmetad --enable-gexec --sysconfdir=/etc/ganglia  --with-python=/usr/bin/python
  6. make && make install
4. 配置gmetad 和gmond.

点击(此处)折叠或打开

  1. cp gmetad/gmetad.conf /etc/ganglia/
  2. /usr/local/ganglia/sbin/gmond -t |tee /etc/ganglia/gmond.conf
首先配置gmetad.

点击(此处)折叠或打开

  1. vim /etc/ganglia/gmetad.conf
  2. data_source "my cluster" YOUR_FQDN
  3. # setuid_username "nobody"
  4. setuid_username "ganglia"
然后配置gmond.

点击(此处)折叠或打开

  1. vim /etc/ganglia/gmond.conf
  2. setuid = yes
  3. #user = nobody
  4. user =ganglia
  5. udp_send_channel {
  6.       bind_hostname = yes # Highly recommended, soon to be default.
  7.                        # This option tells gmond to use a source address
  8.                        # that resolves to the machine
查看gmond的python 扩展,确保modpython.so 被编译出来。

点击(此处)折叠或打开

  1. locate modpython.so
  2. /usr/local/ganglia/lib64/ganglia/modpython.so
  3. #create gmond python directory
  4. mkdir -p /usr/local/ganglia/lib64/ganglia/python_modules
  5. /usr/local/ganglia/sbin/gmond -d10
  6. #应该能看到loaded module: python_module
  7. #copy python module / py.conf
  8. cp /usr/local/src/ganglia-3.7.1/gmond/python_modules/*/*.py  /usr/local/ganglia/lib64/ganglia/python_modules
  9. cp /usr/local/src/ganglia-3.7.1/gmond/python_modules/conf.d/*.pyconf /etc/ganglia/conf.d
配置启动项:

点击(此处)折叠或打开

  1. cp gmetad/gmetad.init /etc/rc.d/init.d/gmetad
  2. cp gmond/gmond.init /etc/rc.d/init.d/gmond
  3. vim /etc/init.d/gemtad(edit these)
  4.         #GMETAD=/usr/sbin/gmetad
  5.         GMETAD=/usr/local/ganglia/sbin/gmetad
  6.         #daemon $GMETAD
  7.         daemon $GMETAD -c /etc/ganglia/gmetad.conf
  8. vim /etc/init.d/gmond (edit these)
  9.         #GMOND=/usr/sbin/gmond
  10.         GMOND=/usr/local/ganglia/sbin/gmond
  11.         #daemon $GMOND
  12.         daemon $GMOND -c /etc/ganglia/gmond.conf
配置systemd服务

点击(此处)折叠或打开

  1. vim /usr/lib/systemd/system/gmetad.service(edit these lines)
  2. [Service]
  3. Type=forking
  4. #PIDFile=/usr/local/ganglia/var/run/gmetad.pid
  5. PIDFile=/var/run/gmetad.pid
  6. #ExecStart=/usr/local/ganglia/sbin/gmetad --pid-file=/usr/local/ganglia/var/run/gmetad.pid
  7. ExecStart=/usr/local/ganglia/sbin/gmetad -c /etc/ganglia/gmetad.conf --pid-file=/var/run/gmetad.pid
  8. EnvironmentFile=-/etc/ganglia/default/gmetad

点击(此处)折叠或打开

  1. vim /usr/lib/systemd/system/gmond.service(edit these lines)
  2. [Service]
  3. Type=forking
  4. #PIDFile=/usr/local/ganglia/var/run/gmond.pid
  5. PIDFile=/var/run/gmond.pid
  6. #ExecStart=/usr/local/ganglia/sbin/gmond --pid-file=/usr/local/ganglia/var/run/gmond.pid
  7. ExecStart=/usr/local/ganglia/sbin/gmond -c /etc/ganglia/gmond.conf --pid-file=/var/run/gmond.pid
为rrdtool 创建目录:

点击(此处)折叠或打开

  1. mkdir -p /var/lib/ganglia/rrds
  2. chown ganglia:ganglia /var/lib/ganglia/rrds
启动服务:

点击(此处)折叠或打开

  1. systemctl daemon-reload
  2. systemctl start gmetad
  3. systemctl start gmond
至此,netstat 可以看到端口监听,可以telnet localhost 8649, 能看到xml,ps -ef 证实 gmetad 和gmond 确实是以ganglia 用户在运行,"/var/lib/ganglia/rrds" 目录下有文件生成.

点击(此处)折叠或打开

  1. netstat -tnlp
  2. Active Internet connections (only servers)
  3. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  4. tcp 0 0 0.0.0.0:8649 0.0.0.0:* LISTEN 18465/gmond
  5. tcp 0 0 0.0.0.0:8651 0.0.0.0:* LISTEN 17783/gmetad
  6. tcp 0 0 0.0.0.0:8652 0.0.0.0:* LISTEN 17783/gmetad

5. 配置ganglia-web

点击(此处)折叠或打开

  1. wget http://sourceforge.net/projects/ganglia/files/ganglia-web/3.7.1/ganglia-web-3.7.1.tar.gz
  2. tar xzvf ganglia-web-3.7.1.tar.gz
  3. vi Makefile(Edit these)
  4. GDESTDIR = /var/www/html/ganglia
  5. APACHE_USER = apache
  6. ZZ 
  7. make install
6.从GUI 登陆.

点击(此处)折叠或打开

  1. http://YOUR_IP/ganglia/


阅读(1737) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~