Transferred from: http://blog.csdn.net/xxd851116/article/details/21527055
Http://www.dataguru.cn/article-3816-1.html
Ganglia consists of three parts, Gmond, Gmetad and Gweb.
Gmond (Ganglia monitoring Daemon) is a lightweight service that is installed on each node host that needs to collect metrics data. Gmond completes the actual data collection of the metrics on each host and shares the data through the Listen/advertise protocol and other nodes within the cluster. With Gmond, you can easily collect many system metrics data, such as CPU, memory, disk, network, and active process data.
Gmetad (Ganglia Meta Daemon) is a service that collects metric data from other Gmetad or gmond sources and stores it in the RRD format to disk. Gmetad provides a simple query mechanism for specific metrics information collected from host groups and supports hierarchical authorization, making it possible to create a federated monitoring domain.
Gweb (Ganglia Web) Gweb is a PHP front-end that uses a browser to display the data stored by Gmetad. A graphical representation of the various metrics data collected in the running state of a cluster in a web interface.
Prepare the Environment
# lsb_release-a
LSB Version:: base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64: Graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor Id:centos
Description:centos Release 6.5 (Final)
release:6.5
Codename:final
S1, installation Gmond
Search the Gmond installation package in the local software library
[email protected] ~]# Yum search Ganglia-gmond
Loaded Plugins:fastestmirror
Loading mirror speeds from cached hostfile
* base:centos.ustc.edu.cn
* extras:centos.ustc.edu.cn
* updates:centos.ustc.edu.cn
Warning:no matches found For:ganglia-gmond
No Matches found
The search failed to display, possibly the current RPM release without the ganglia installation package.
[Email protected] ~]# RPM-UVH \
> http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Warning:/var/tmp/rpm-tmp. L2dc50:header V3 rsa/sha256 Signature, key ID 0608b895:nokey
Preparing ... ########################################### [100%]
1:epel-release ########################################### [100%]
[Email protected] ~]#
Re-search (first execution will download epel/primary_db)
[email protected] ~]# Yum search Ganglia-gmond
Loaded Plugins:fastestmirror
Loading mirror speeds from cached hostfile
Omitted some lines ...
Ganglia-gmond.x86_64:ganglia Monitoring Daemon
Ganglia-gmond-python.x86_64:ganglia Monitor daemon python DSO and metric modules
Omitted some lines ...
[Email protected] ~]#
Installation
[email protected] ~]# Yum install ganglia-gmond-y
Yum installation automatically resolves headache-dependent package issues
S2, installation Gmetad
As described in the Gmond installation, if the local software library does not provide Gmetad, you will need to install Epel.
[email protected] ~]# Yum install ganglia-gmetad-y
You will find the following dependent packages installed:
Dependency installed:
Dejavu-fonts-common.noarch 0:2.30-2.el6 Dejavu-lgc-sans-mono-fonts.noarch 0:2.30-2.el6 Dejavu-sans-mono-fonts.noarch 0:2.30-2.el6 fontpackages-filesystem.noarch 0:1.41-1.1.el6 rrdtool.x86_64 0:1.3.8-6. El6
S3, installation Gweb
Wiki:http://sourceforge.net/apps/trac/ganglia/wiki/ganglia-web-2#installation
Before you install and configure Gweb, check that you have
Meet the following requirements:
Apache Web Server
PHP 5.2 and later
Installation and enablement of PHP JSON extensions
First install Apache and PHP 5
[[email protected] ~]# yum install httpd PHP
You will find the following dependent packages installed:
Dependency installed:
apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 httpd-tools.x86_64 0:2.2.15-29.el6.centos mailcap.noarch 0:2.1.31-2.el6 php-c li.x86_64 0:5.3.3-27.el6_5 php-common.x86_64 0:5.3.3-27.el6_5
PHP-enabled JSON extensions are required, and JSON is already included in PHP 5.2 and later.
Check the status of the JSON extension by examining the/etc/php.d/json.ini file, and if the JSON extension is enabled, the file should contain something similar to the following statement:
Extension=json.ini
Download the latest version of Gweb (https://sourceforge.net/projects/ganglia/files/gweb/)
This example is currently the latest version of 3.5.12
[Email protected] ~]# wget http://ncu.dl.sourceforge.net/project/ganglia/ganglia-web/3.5.12/ganglia-web-3.5.12.tar.gz
[Email protected] down]# TAR-ZXVF ganglia-web-3.5.12.tar.gz
[Email protected] down]# CD ganglia-web-3.5.12
Compiling makefile
[Email protected] ganglia-web-3.5.12]# vim Makefile
You can view some user default configurations:
##########################################################
# User Configurables:
##########################################################
# location where Gweb should is installed to (excluding Conf, Dwoo dirs).
Gdestdir =/usr/share/ganglia-webfrontend
# location where default Apache configuration should is installed to.
Gconfdir =/etc/ganglia-web
# Gweb Statedir (where conf dir and dwoo templates dir is stored)
Gweb_statedir =/var/lib/ganglia-web
# Gmetad RootDir (parent location of RRD folder)
Gmetad_rootdir =/var/lib/ganglia
Apache_user = Www-data
##########################################################
To modify the default configuration:
Gdestdir =/var/www/html/ganglia2
Apache_user = Apache
Note: Gdestdir and Apache_user are consistent with DocumentRoot, Apache in Apache configuration files (/etc/httpd/conf/httpd.conf)
Make install
S4, status check
Check if httpd is started:
[[Email protected] ~]# service httpd status
Start httpd:
[[Email protected] ~]# service httpd start
Check if Gmetad is started:
[[Email protected] ~]# service Gmetad status
Start Gmetad:
[[Email protected] ~]# service Gmetad start
Check if the local Gmond is started:
[[Email protected] ~]# service Gmond status
Start Gmond:
[[Email protected] ~]# service Gmond start
S5, close SELinux
If you skip this step, the following exception will appear when you open http://<server IP address>/ganglia2:
There is an error collecting ganglia data (127.0.0.1:8652): Fsockopen Error:permission denied
What is SELinux?
Http://wiki.centos.org/zh/HowTos/SELinux
To view the SELinux status:
[Email protected] ~]# Sestatus
SELinux status:enabled
SELINUXFS Mount:/selinux
Current Mode:permissive
Mode from config file:enforcing
Policy version:24
Policy from config file:targeted
To turn off SELinux:
[Email protected] ~]# Setenforce 0
Setenforce This command can instantly switch between the enforcing and Permissive modes, but these changes will not be retained when the system reboots.
To be effective after the next boot, you need to modify the selinux= behavior enforcing within the/etc/selinux/config.
S6, access ganglia monitoring platform
Http://<server IP address>/ganglia2/
The directory "/GANGLIA2" can be modified in the Ganglia-web makefile file and will need to be recompiled after modification.
Ganglia Authoritative Guide-Installing the Ganglia process