gweb & nginx configure

gweb是ganglia的组件之一, 前面我简单的写了一些gmond, gmetad的安装和配置.

http://blog.163.com/digoal@126/blog/static/1638770402014810227936/

http://blog.163.com/digoal@126/blog/static/1638770402014810346993/

简单来讲gmond用于采集监控数据, gmetad将采集到的监控数据写入rrd数据文件. gweb则负责可视化工作.

要使用gweb, 首先要安装一个web容器, 这里我选择nginx. 当然你也可以选择apache, openresty等.

nginx的安装和配置参考 : 

http://blog.163.com/digoal@126/blog/static/163877040201461822210354/

因为gweb要访问rrd数据文件, 所以一般和gmetad部署在一个地方. 如果你使用了grid模式的话, 那么gweb部署在最顶层的gmetad主机一起. 

gweb是php写的, 需要安装php

首先要安装pcre

http://www.pcre.org/
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.bz2
# tar -jxvf pcre-8.35.tar.bz2
# cd pcre-8.35
# ./configure --prefix=/opt/pcre8.35 --enable-utf8 --enable-unicode-properties --enable-pcretest-libreadline --enable-shared --enable-static --enable-jit --enable-pcre16 --enable-pcre32
# make && make install

[root@dba ~]# /opt/pcre8.35/bin/pcretest -C
PCRE version 8.35 2014-04-04
Compiled with
  8-bit support
  UTF-8 support
  Unicode properties support
  No just-in-time compiler support
  Newline sequence is LF
  \R matches all Unicode newlines
  Internal link size = 2
  POSIX malloc threshold = 10
  Parentheses nest limit = 250
  Default match limit = 10000000
  Default recursion depth limit = 10000000
  Match recursion uses stack

# vi /etc/profile
export PATH=/opt/pcre8.35/bin:$PATH
export MANPATH=/opt/pcre8.35/share/man:$MANPATH

# vi /etc/ld.so.conf
/opt/pcre8.35/lib

# ldconfig

安装freetype

# wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.bz2
# tar -jxvf freetype-2.5.3.tar.bz2
# cd freetype-2.5.3
# ./configure --prefix=/opt/freetype2.5.3
# make && make install
# vi /etc/profile
export PATH=/opt/freetype2.5.3/bin:$PATH
export MANPATH=/opt/freetype2.5.3/share/man:$MANPATH
# vi /etc/ld.so.conf
/opt/freetype2.5.3/lib
# ldconfig

安装postgresql

# useradd postgres
# tar -jxvf postgresql-9.3.5.tar.bz2
# cd postgresql-9.3.5
# ./configure --prefix=/opt/pgsql9.3.5 --with-pgport=5432 --with-perl --with-tcl --with-python --with-openssl --with-pam --with-ldap --with-libxml --with-libxslt --enable-thread-safety
# gmake world && gmake install-world
# ln -s /opt/pgsql9.3.5 /opt/pgsql
# vi /etc/profile
export PATH=/opt/pgsql/bin:$PATH
export MANPATH=/opt/pgsql/share/man:$MANPATH

# vi /etc/ld.so.conf
/opt/pgsql/lib
# ldconfig

# mkdir -p /data03/pgdata/pg_root
# chown postgres:postgres /data03/pgdata/pg_root
# su - postgres
$ vi .bash_profile
export PS1="$USER@`/bin/hostname -s`-> "
export PGPORT=5432
export PGDATA=/data03/pgdata/pg_root
export LANG=en_US.utf8
export PGHOME=/opt/pgsql
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export DATE=`date +"%Y%m%d%H%M"`
export PATH=$PGHOME/bin:$PATH:.
export MANPATH=$PGHOME/share/man:$MANPATH
export PGUSER=postgres
export PGHOST=$PGDATA
alias rm='rm -i'
alias ll='ls -lh'
export PGDATABASE=postgres

安装php

# yum install -y libpng libpng-devel
# wget http://cn2.php.net/get/php-5.5.14.tar.bz2/from/this/mirror
# tar -jxvf php-5.5.14.tar.bz2
# cp /opt/pcre8.35/include/pcre.h /opt/pcre8.35/lib/
# cd php-5.5.14
# ./configure --prefix=/opt/php5.5.14 --with-pcre-regex=/opt/pcre8.35/lib --enable-fpm --enable-opcache --with-pdo-pgsql=/opt/pgsql/bin --with-pgsql=/opt/pgsql/bin --enable-bcmath --enable-mbstring --enable-sockets --with-gd --with-gettext --with-libdir=lib64 --with-jpeg-dir --with-png-dir --with-freetype-dir=/opt/freetype2.5.3
# make && make install

# vi /etc/profile
export PATH=/opt/php5.5.14/bin:/opt/php5.5.14/sbin:$PATH
export MANPATH=/opt/php5.5.14/php/man:$MANPATH

配置并启动php-fpm

[root@150 ~]# php --ini
Configuration File (php.ini) Path: /opt/php5.5.14/lib
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

拷贝php和php-fpm的配置文件到对应的配置目录

# cp php-5.5.14/php.ini-production /opt/php5.5.14/lib/php.ini
# cp /opt/php5.5.14/etc/php-fpm.conf.default /opt/php5.5.14/etc/php-fpm.conf

配置php.ini

# vi /opt/php5.5.14/lib/php.ini
post_max_size = 16M
date.timezone = "Asia/Shanghai"
max_execution_time = 300
max_input_time = 300

启动php-fpm

[root@150 zabbix]# which php-fpm
/opt/php5.5.14/sbin/php-fpm
[root@150 zabbix]# php-fpm -R -c /opt/php5.5.14/etc
[root@150 zabbix]# netstat -anp|grep 9000
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      26627/php-fpm

下载gweb

http://sourceforge.net/projects/ganglia/files/ganglia-web/
# wget http://downloads.sourceforge.net/project/ganglia/ganglia-web/3.6.2/ganglia-web-3.6.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fganglia%2Ffiles%2Fganglia-web%2F3.6.2%2F&ts=1410420232&use_mirror=jaist
# tar -zxvf ganglia-web-3.6.2.tar.gz

创建一个web目录, 放gweb目录, 并修改目录权限

# mkdir /data01/web
# mv /opt/soft_bak/ganglia-web-3.6.2 /data01/web/ganglia-web
修改权限
# chown -R nobody /data01/web/ganglia-web

配置nginx.conf

# vi /opt/nginx1.6.0/conf/nginx.conf
user  nobody;
worker_processes  3;
error_log  logs/error.log;
pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;
        root   /data01/web/ganglia-web;
        location / {
            root   /data01/web/ganglia-web;
            index  index.html index.htm index.php;
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
}

启动nginx

# nginx -c /opt/nginx1.6.0/conf/nginx.conf

配置gweb conf.php

# cd /data01/web/ganglia-web/
# cp conf_default.php conf.php
可能需要修改的地方如下 :
# vi conf.php
$conf['gweb_confdir'] = "/data01/web/ganglia-web";
# Where gmetad stores the rrd archives.
$conf['gmetad_root'] = "/opt/ganglia-core-3.6.0";
$conf['rrds'] = "/data01/rrd";
#
# If you want to grab data from a different ganglia source specify it here.
# Although, it would be strange to alter the IP since the Round-Robin
# databases need to be local to be read.
#
$conf['ganglia_ip'] = "127.0.0.1";
$conf['ganglia_port'] = 8652;
# Leave this alone if rrdtool is installed in $conf['gmetad_root'],
# otherwise, change it if it is installed elsewhere (like /usr/bin)
$conf['rrdtool'] = "/opt/rrdtool1.4.8/bin/rrdtool";

打开WEB页面

http://172.16.3.221

gweb视图 : 


注意左下角的热度视图 :  


物理视图


主机视图


节点视图, 包括节点位置rack rank plane

主机硬件, 软件, LOAD, CPU等场景信息.

WEB页面错误解决办法 : 

错误1 : 

Fatal error:
Errors were detected in your configuration.
?DWOO compiled templates directory '/data01/web/ganglia-web/dwoo/compiled' is not writeable.
Please adjust $conf['dwoo_compiled_dir'].
?DWOO cache directory '/data01/web/ganglia-web/dwoo/cache' is not writeable.
Please adjust $conf['dwoo_cache_dir'].
in /data01/web/ganglia-web/eval_conf.php on line 126
解决办法 :
[root@db-172-16-3-221 ganglia-web]# mkdir -p /data01/web/ganglia-web/dwoo/compiled
[root@db-172-16-3-221 ganglia-web]# mkdir -p /data01/web/ganglia-web/dwoo/cache
[root@db-172-16-3-221 ganglia-web]# chown -R nobody /data01/web/ganglia-web

错误2 : 

图片无法显示
解决办法 :
配置正确的rrdtool路径. 例如:
# vi conf.php
$conf['rrdtool'] = "/opt/rrdtool1.4.8/bin/rrdtool";

[参考]
1. http://blog.163.com/digoal@126/blog/static/163877040201461822210354/

2. http://blog.163.com/digoal@126/blog/static/1638770402014810227936/

3. http://blog.163.com/digoal@126/blog/static/1638770402014810346993/

时间: 2024-10-30 19:39:12

gweb & nginx configure的相关文章

ganglia gweb AUTH configure with nginx

ganglia的认证是基于Zend框架来写的, 权限分布可见lib/GangliaAcl.php. (默认所有集群归属于ALL_CLUSTERS, 所有用户归属于GUEST, 默认GUEST角色有所有cluster的VIEW权限, 没有EDIT权限. ADMIN角色有所有cluster的VIEW和EDIT权限; 私有cluster: GUEST没有私有cluster的任何权限(其实是回收了VIEW权限)) 参考 :  http://framework.zend.com/manual/1.12/e

nginx configure fastdfs + SSL

./configure \ --prefix=/usr/local/nginx \ --with-http_stub_status_module \ --with-http_ssl_module \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/ac

安装LAMP PHP的./configure 参数,未出现MYSQ

编译参数: ./configure \ --prefix=/usr/local/php5 \ --with-apxs2=/usr/local/apache2/bin/apxs \ --enable-shared \ --with-libxml-dir \ --with-gd \ --with-openssl \ --enable-mbstring \ --with-mcrypt \ --with-mysqli \ --with-mysql \ --enable-opcache \ --enabl

nginx负载均衡篇一、nginx安装

现在国内许多家大的网站都已经采用了Nginx作为web服务器,毕竟nginx在高并发.资源消耗低.反向代理等方面有着不错的性能,现在咱也随下大众,学习下nginx,顺便做下负载均衡. 系统环境,rhel6.5 x86_64   ,去nginx官网(http://nginx.org/)看了下,发现主线版已经到了1.7.3,由于是测试,所以就下了个稳定版1.6.0(http://nginx.org/download/nginx-1.6.0.tar.gz) 解压文件: tar zxvf nginx-1

CentOS-6.3系统中安装配置Web服务器Nginx

Nginx 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器.nginx的并发能力确实在同类型的网页伺服器中表现较好.Nginx在一些Linux发行版和BSD的各个变种版本的安装包仓库中都会有,通过各个系统自带的软件包管理方法即可安装. 安装说明 系统环境:CentOS-6.3 软件:nginx-1.2.6.tar.gz 安装方式:源码编译安装 安装位置:/usr/local/nginx 下载地址:http://nginx.org/en/downlo

linux下查看nginx、apache、mysql、php的编译参数

下文我们一起来看一个linux下查看nginx.apache.mysql.php的编译参数例子,希望此例子对各位有帮助. 查看nginx.apache.mysql.php参数我们可以用到 /App/nginx/sbin/nginx -V 查看nginx参数 # cat config.nice 查看apache参数 #cat "/usr/local/mysql/bin/mysqlbug"|grep configure 查看mysql参数 /usr/local/php/bin/php -i

Nginx服务器缓存设置实例讲解

  用nginx作为web的缓存,位于内容源web服务器与客户端之间. web缓存的解决方案: 1 Squid Cache 2 Nginx的proxy_cache 先来看下,Nginx的proxy_cache 组成:proxy_cache相关指令集,fastcgi相关指令集 proxy_cache 哪个缓存区将被使用 proxy_cache_path 缓存文件的存放路径 proxy_cache_methods 缓存哪些HTTP方法 proxy_cache_min_users 缓存的最小使用次数

Nginx + LibreSSL - 尝鲜测试

tl;dr: 用上 LibreSSL 已经第二个夜晚了 ... 依然运行良好 7月11日,LibreSSL团队发布 LibreSSL 的可移植版本,这是第一个可在 OpenBSD, Linux, OSX, Solaris 和 FreeBSD 上运行的版本. [1,2,5,8] 本文会介绍一些 Nginx 与 Libressl 一起使用实践经验. ** 本文所用软件的版本** nginx 1.6.0 libressl 2.0.0 在reddit-discussion [11]中有描述一些使用最新开

Nginx安装

Nginx安装 首先,大家如果看到有什么不懂的地方,欢迎吐槽!!! 我会在当天或者第二天及时回复,并且改进~~ Nginx安装步骤: 一.添加用户 groupadd nginx useradd -M -s /sbin/nologin -g nginx nginx 二.解包 tar zxf nginx-1.0.14.tar -C /usr/local/src tar zxf pcre-8.30.tar -C /usr/local/src tar zxf zlib-1.2.7.tar -C /usr