首页 > 代码库 > ganglia安装与配置

ganglia安装与配置

给ceph安装了一个ganglia监控,过程如下。

1. 环境说明

ceph是在centos6.5上安装的3台物理机:mon0, osd1, osd2,所以在这三台机器上都需要安装gmond;在osd2上安装gmetad。

2. 安装过程

先安装epel源:

rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
安装依赖包:
yum install apr-devel expat-devel
在mon0和osd1安装gmond:
yum install  ganglia ganglia-gmond httpd php apr apr-util
在osd2上安装gmetad:
yum install  ganglia ganglia-gmetad ganglia-gmond ganglia-web httpd php apr apr-util

3. 配置

配置web:

mkdir -p /var/www/html/ganglia/   //创建网站主目录下ganglia文件夹,用来访问ganglia
cp -a /usr/share/ganglia/* /var/www/html/ganglia/   //拷贝ganglia网站代码到该目录
chkconfig gmond on
chkconfig gmetad on
chkconfig httpd on

默认 /var/lib/ganglia/rrds的属主就是ganglia,不必像网上所说的改称nobody。

/var/www/html/ganglia/下的conf.php有可能无效,需要手动拷贝一份:

cp  /usr/share/ganglia/conf.php /var/www/html/ganglia

在centos6.5上还有可能遇到web访问forbidden的情况,需要修改/etc/httpd/conf.d/ganglia.conf:

Alias /ganglia /usr/share/ganglia

  <Location /ganglia>
    Order deny,allow
    Deny from all
    Allow from all   //修改为all
    Allow from ::1
    # Allow from .example.com
  </Location>

配置/etc/ganglia/gmond.conf

cluster {
  name = "ceph"   //cluster name
  owner = "unspecified"
  latlong = "unspecified"
  url = "unspecified"
}

/* The host section describes attributes of the host, like the location */
host {
  location = "unspecified"
}

/* Feel free to specify as many udp_send_channels as you like.  Gmond
   used to only support having a single channel */
udp_send_channel {
  host = 192.168.108.4   //gmetad ip
  port = 8649
}

/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
  port = 8649
  bind = 192.168.108.3   //本机ip
  family = inet4
}
配置 /etc/ganglia/gmetad.conf,这里只需修改一行:
data_source "ceph" 192.168.108.4:8649 //gmetad ip
启动各种服务,然后在web输入gmetad_ip/ganglia就可以看到监控界面了。

以上是单播的配置,还有多播配置,可以自己查询。

ganglia安装与配置