五:配置ganglia
◆.链接命令文件
[root@adminganglia-3.2.0]# ln -s /usr/local/ganglia/bin/* /usr/local/bin/
[root@adminganglia-3.2.0]# ln -s /usr/local/ganglia/sbin/* /usr/local/sbin/
◆.配置gmetad
1.[root@adminganglia-3.2.0]# cd gmetad
2.[iyunv@admingmetad]# cp gmetad.init /etc/init.d/gmetad
3.[iyunv@admingmetad]# chkconfig --add gmetad;chkconfig --list gmetad
gmetad 0:off 1:off 2:on 3:on 4:on 5:on 6:off
4.[iyunv@admingmetad]# vi /etc/init.d/gmetad 修改GMETAD=/usr/sbin/gmetad为GMETAD=/usr/local/ganglia/sbin/gmetad
5.[iyunv@admingmetad]# vi /etc/ganglia/gmetad.conf,找到第45行:data_source "my cluster" localhost,把"my cluster"可一更改为自己喜欢的名称,比如wjcyf,其他默认即可
6.创建所需目录,并设置所有者和权限
[iyunv@admin gmetad]#mkdir -p /var/lib/ganglia/rrds
[iyunv@admingmetad]# chown nobody:nobody /var/lib/ganglia/rrds/
[iyunv@admingmetad]# chmod 1777 /var/lib/ganglia/rrds/
7.启动gmetad服务
[iyunv@admingmetad]# /etc/init.d/gmetad start
Starting GANGLIAgmetad: [ OK ]
◆.配置gmond
1.[iyunv@admingmetad]# cd ../gmond/
2.[iyunv@admingmond]# cp gmond.init /etc/init.d/gmond
3.[iyunv@admingmond]# chkconfig --add gmond ;chkconfig --list gmond
gmond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
4. [iyunv@admingmond]# vi /etc/init.d/gmond修改GMOND=/usr/sbin/gmond为GMOND=/usr/local/ganglia/sbin/gmond
5.生成默认配置文件gmond.conf
[iyunv@admingmond]# ./gmond -t >/etc/ganglia/gmond.conf
6. [iyunv@admingmond]# vi /etc/ganglia/gmond.conf,本次实验配置ganglia server节点为“单收”,配置文件需要修改的地方为下面红色文字所示,其余均默认
/* This configuration is as close to 2.5.x defaultbehavior as possible
The valuesclosely match ./gmond/metric.h definitions in 2.5.x */
globals {
daemonize =yes
setuid = yes
user = nobody
debug_level =0
max_udp_msg_len = 1472
mute = yes
deaf = no
allow_extra_data = yes
host_dmax = 0/*secs */
host_tmax = 20/*secs */
cleanup_threshold = 300 /*secs */
gexec = no
send_metadata_interval = 0 /*secs */
}
/*
* The clusterattributes specified will be used as part of the
* tag that willwrap all hosts collected by this instance.
*/
cluster {
name = "wjcyf"
owner ="unspecified"
latlong ="unspecified"
url ="unspecified"
}
/* The host section describes attributes of the host,like the location */
host {
location ="unspecified"
}
/* Feel free to specify as many udp_send_channels asyou like. Gmond
used to onlysupport having a single channel */
udp_send_channel {
#bind_hostname= yes # Highly recommended, soon to be default.
# This option tells gmond to use a source address
# that resolves to the machine's hostname. Without
# this, the metrics may appear to come from any
# interface and the DNS names associated with
# those IPs will be used to create the RRDs.
mcast_join =239.2.11.71
port = 8649
ttl = 1
}
/* You can specify as many udp_recv_channels as youlike as well. */
udp_recv_channel {
port= 8649
bind= 192.168.10.11
}
/* You can specify as many tcp_accept_channels as youlike to share
an xmldescription of the state of the cluster */
tcp_accept_channel {
port = 8649
acl {
default = "deny"
access {
ip= 127.0.0.1
mask= 32
action= "allow"
}
}
}
以下配置文件略
7.启动gmond服务
[iyunv@admingmond]# /etc/init.d/gmond start
Starting GANGLIAgmond: [ OK ]
【被监控端安装ganglia】
一:安装所需软件
[iyunv@node1 ~]#yum -y install apr-devel expat-devel pcre-devel python-devel
二:编译安装confuse
[root@node1ganglia-3.2.0]# tar xzf confuse-2.7.tar.gz
[root@node1ganglia-3.2.0]# cd confuse-2.7
[root@node1confuse-2.7]# ./configure --enable-shared --libdir=/usr/lib64
[root@node1confuse-2.7]# make
[root@node1confuse-2.7]# make install
三:编译安装ganglia
[root@node1ganglia-3.2.0]# ./configure --prefix=/usr/local/ganglia
>--sysconfdir=/etc/ganglia
>--enable-gexec
>--enable-status
[root@node1ganglia-3.2.0]# make
[root@node1ganglia-3.2.0]# make install
四:配置ganglia
1.创建ganglia配置文件存放目录
[iyunv@node1 ganglia-3.2.0]#mkdir /etc/ganglia
2.[root@node1ganglia-3.2.0]# cd gmond/
3.[iyunv@node1gmond]# cp gmond.init /etc/init.d/gmond
4.[iyunv@node1gmond]# chkconfig --add gmond ;chkconfig --list gmond
gmond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
5. [iyunv@node1gmond]# vi /etc/init.d/gmond修改GMOND=/usr/sbin/gmond为GMOND=/usr/local/ganglia/sbin/gmond
6.生成默认配置文件gmond.conf
[iyunv@node1gmond]# ./gmond -t >/etc/ganglia/gmond.conf
7.[iyunv@node1gmond]# vi /etc/ganglia/gmond.conf,本次实验配置被监控节点为“单发”,配置文件需要修改的地方为下面红色文字所示,其余均默认
/* This configuration is as close to 2.5.x defaultbehavior as possible
The valuesclosely match ./gmond/metric.h definitions in 2.5.x */
globals {
daemonize =yes
setuid = yes
user = nobody
debug_level =0
max_udp_msg_len= 1472
mute = no
deaf = yes
allow_extra_data = yes
host_dmax = 86400/*secs */
host_tmax = 20/*secs */
cleanup_threshold = 300 /*secs */
gexec = no
send_metadata_interval= 300 /*secs */
}
/*
* The clusterattributes specified will be used as part of the
* tag that willwrap all hosts collected by this instance.
*/
cluster {
name = "wjcyf"
owner ="unspecified"
latlong ="unspecified"
url ="unspecified"
}
/* The host section describes attributes of the host,like the location */
host {
location ="unspecified"
}
/* Feel free to specify as many udp_send_channels asyou like. Gmond
used to onlysupport having a single channel */
udp_send_channel {
host= 192.168.10.11
port= 8649
}
以下配置文件略