Configuring Ganglia on CentOS6.5

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dazuiba008/article/details/82220471

接前面的,安装还是相对比较简单,遇到最多的问题也就是缺少某些包,这个少什么装什么就可以了

下面看一下配置服务端:

下载ganglia-web源码包,

 

#wget http://sourceforge.net/projects/ganglia/files/ganglia-web/3.5.12/ganglia-web-3.5.12.tar.gz

#tar -zxvf ganglia-web-3.5.12.tar.gz

#mkdir /var/www/html/ganglia

# pwd
/root/ganglia-web-3.5.12

#cp -r /root/ganglia-web-3.5.12/* /var/www/html/ganglia/

chown nobody:nobody /var/www/html/ganglia/

修改conf.php

 

#cp conf_default.php conf.php

扫描二维码关注公众号,回复: 3060112 查看本文章

#more conf.php

$conf['gweb_confdir'] = "/var/www/html/ganglia"; #修改和之前位置一致的路径

$conf['gmetad_root'] = "/var/lib/ganglia";
$conf['rrds'] = "${conf['gmetad_root']}/rrds";

$conf['dwoo_compiled_dir'] = "${conf['gmetad_root']}/dwoo/compiled";
$conf['dwoo_cache_dir'] = "${conf['gmetad_root']}/dwoo/cache"; #修改为个接下来创建的目录一致的路径

$conf['rrdtool'] = "/usr/bin/rrdtool";

添加相关服务:(gmetad和gmond)

 

[root@db-192-168-1-34 /]# cp /root/ganglia-3.6.0/gmetad/gmetad.init /etc/init.d/gmetad
[root@db-192-168-1-34 /]# cp -f /usr/local/ganglia/sbin/gmetad /usr/sbin/gmetad
[root@db-192-168-1-34 /]# chkconfig --add gmetad
[root@db-192-168-1-34 /]# service gmetad start
Starting GANGLIA gmetad: [ OK ]
[root@db-192-168-1-34 /]# cp /root/ganglia-3.6.0/gmond/gmond.init /etc/rc.d/init.d/gmond
[root@db-192-168-1-34 /]# cp -f /usr/local/ganglia/sbin/gmond /usr/sbin/gmond
[root@db-192-168-1-34 /]# chkconfig --add gmond
[root@db-192-168-1-34 /]# service gmond start
Starting GANGLIA gmond: Configuration file '/etc/ganglia/gmond.conf' not found.
[ OK ]

上面提示没有找到gmond的配置文件,那么手动生成一个

 

[root@db-192-168-1-34 /]# gmond -t |tee /etc/ganglia/gmond.conf
[root@db-192-168-1-34 /]# service gmond restart
Shutting down GANGLIA gmond: [ OK ]
Starting GANGLIA gmond: [ OK ]

修改gmond.conf

 

[root@db-192-168-1-34 bin]# more /etc/ganglia/gmond.conf
/* This configuration is as close to 2.5.x default behavior as possible
The values closely match ./gmond/metric.h definitions in 2.5.x */
globals {
daemonize = yes
setuid = yes
user = nobody
debug_level = 0
max_udp_msg_len = 1472
mute = no
deaf = no
allow_extra_data = yes
host_dmax = 86400 /*secs. Expires (removes from web interface) hosts in 1 day */
host_tmax = 20 /*secs */
cleanup_threshold = 300 /*secs */
gexec = no
# By default gmond will use reverse DNS resolution when displaying your hostname
# Uncommeting following value will override that value.
# override_hostname = "mywebserver.domain.com"
# If you are not using multicast this value should be set to something other than 0.
# Otherwise if you restart aggregator gmond you will get empty graphs. 60 seconds is reasonable
send_metadata_interval = 0 /*secs */

}

/*
* The cluster attributes specified will be used as part of the <CLUSTER>
* tag that will wrap all hosts collected by this instance.
*/
cluster {
name = "skycluster"
owner = "nobody"

latlong = "unspecified"
url = "unspecified"
}

这里我只修改标红的即可,修改完后记得重启服务service gmond restart

修改 /etc/ganglia/gmetad.conf配置文件

 

data_source "skycluster" 192.168.1.34 其他都用了默认的配置

#service gmetad restart

创建rrd存放数据的目录以及dwoo目录并修改属性

 

mkdir -p /var/lib/ganglia/rrds

chown nobody:nobody /var/lib/ganglia/rrds

mkdir -p /var/lib/ganglia/dwoo/cache

mkdir -p /var/lib/ganglia/dwoo/compiled

chown nobody:nobody /var/lib/ganglia/dwoo/cache

chown nobody:nobody /var/lib/ganglia/dwoo/compiled

到这里差不多就配置完成了

 

网页键入地址http://192.168.1.34/ganglia

提示报错:You don't have permission to access /ganglia on this server

查看apache相关配置

 

#cd /etc/httpd/conf.d/

# more ganglia.conf.bak
#
# Ganglia monitoring system php web frontend
#

Alias /ganglia /usr/share/ganglia

<Location /ganglia>
Order allow,deny
allow from all
# Allow from .example.com
</Location>

这里可以看到配置和我们的路径/var/www/html/ganglia/并不一致,于是我们不使用此配置

 

确保允许访问,这里我们配置Allow from all

# more /etc/httpd/conf/httpd.conf

# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

通过gstat测试是否输出数据

 

# gstat -a
CLUSTER INFORMATION
Name: skycluster
Hosts: 1
Gexec Hosts: 0
Dead Hosts: 0
Localtime: Fri Jul 18 16:28:25 2014

CLUSTER HOSTS
Hostname LOAD CPU Gexec
CPUs (Procs/Total) [ 1, 5, 15min] [ User, Nice, System, Idle, Wio]

db-192-168-1-34.sky-mobi.com
8 ( 0/ 210) [ 0.19, 0.09, 0.03] [ 0.0, 0.0, 0.0, 99.9, 0.0] OFF


再次键入http://192.168.1.34/ganglia

Configuring Ganglia on CentOS6.5 - dazuiba_008 - 魂醉的一亩二分地

 

猜你喜欢

转载自blog.csdn.net/dazuiba008/article/details/82220471