环境:CentOS6.5 minimal
目标:安装Ganglia核心组件(gmond, gmetad, gmetric, gstat, libganglia)、Ganglia web
准备
yum加入 epel 源
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum加入 remi 源
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
下载
http://ganglia.info/
安装依赖包
yum install gcc apr apr-devel libconfuse libconfuse-devel expat-devel pcre pcre-devel –y
如果需安装gmetad
yum install rrdtool rrdtool-devel -y
如果需安装gweb
yum install rsync -y
安装gmond
tar -zxvf ganglia-3.6.0.tar.gz
cd ganglia-3.6.0/
./configure
make && make install
安装gmetad
./configure --with-gmetad
make && make install
配置gmond、gmetad服务
cp gmetad/gmetad.init /etc/init.d/gmetad
chkconfig --add gmetad
cp gmond/gmond.init /etc/init.d/gmond
chkconfig --add gmond
vim /etc/init.d/gmond
修改如下(find / =name 'gmond'搜索之):
GMOND=/usr/local/sbin/gmond
vim /etc/init.d/gmetad
修改如下(find / =name 'gmetad'搜索之):
GMETAD=/usr/local/sbin/gmetad
为维护方便,修改配置路径:
mkdir -p /etc/ganglia
ln -s /usr/local/etc/gmetad.conf /etc/ganglia/gmetad.conf
gmond -t > /usr/local/etc/gmond.conf
ln -s /usr/local/etc/gmond.conf /etc/ganglia/gmond.conf
安装PHP
PHP5.3
yum install php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt -y
PHP5.5
yum --enablerepo=remi,remi-php55 install php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt
安装一个即可
chkconfig php-fpm on
安装Nginx
yum install nginx -y
chkconfig nginx on
Nginx配置php
cd /etc/nginx/conf.d/
mv default.conf defalut.conf.orig
vim /etc/nginx/conf.d/defalut.conf
新增如下代码:
location ~ \.php$ {
root /var/www;
fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; include fastcgi_params; } 启动服务
service gmond start
service gmetad start
service php-fpm start
service nginx start
测试PHP+Nginx
cd /var/www
vim test.php
<?php
phpinfo(); ?>
访问:http//<php server ip>/test.php,出现如下界面即为调试成功
安装Ganglia Web
tar -zxvf ganglia-web-3.5.12.tar.gz
cd ganglia-web-3.5.12/
vim Makefile
GDESTDIR = /var/www/ganglia
APACHE_USER = apache # 与 /etc/php-fpm.d/www.conf 中user保持一致
make install
Nginx新增ganglia文件目录访问配置
vim /etc/nginx/conf.d/defalut.conf
location /ganglia {
root /var/www; index index.html index.htm index.php; }
cd /var/www
chown apache:apache ganglia/
mkdir -p /var/lib/ganglia/rrds
chown nobody:nobody /var/lib/ganglia/rrds
访问Ganglia Web
http://<ganglia server ip >/ganglia
呈现如下界面:
|