環境: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.rpmyum加入 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 呈現如下介面:
(完)