環境: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
下載
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
訪問: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
呈現以下界面:
(完)