标签:gateway service 监控主机 技术 防火墙
监控平台之-ganglia安装配置
小贝比尔IT技术交流网-小贝比尔
提醒:内存1G 硬盘15G(硬盘最好不要低于15G,不然安装期间会出问题)
Selinux和防火墙先关闭,安装成功后再配置
1.关闭selinux vim/etc/sysconfig/selinu更改:SELINUX=enforcing 为 SELINUX=disabled
2.关闭iptables service iptables stop
监控主机ip:192.168.0.90
Mask:255.255.255.0
Gateway:192.168.0.1
DNS:192.168.0.52
被监控主机:apps01.semi.htche.com (192.168.0.56)
web01.semi.htche.com (192.168.0.58)
res01.semi.htche.com (192.168.0.57)
db01.semi.htche.com(192.168.0.55)
准备:# yum update
# yum install vim-y
# Yum install wget -y
一. 前提依赖
1. 主机环境检查(全部主机节点)
# yum install gcc glibc glibc-common rrdtool rrdtool-devel apr apr-devel expat expat-devel pcre pcre-devel dejavu-lgc-sans-mono-fonts dejavu-sans-mono-fonts-y
2. dejavu
# yum install dejavu* -y
3. rrdtool
# yum install rrdtool* -y
4. apr
# yum install apr* -y
5. libexpat
# yum install expat* -y
6. libpcre
# yum install pcre* -y
7. Confuse
# cd /usr/src
# wget http://ftp.yzu.edu.tw/nongnu//confuse/confuse-2.7.tar.gz
# tar -zxf confuse-2.7.tar.gz
# cd confuse-2.7
# ./configure CFLAGS=-fPIC --disable-nls
# make && make install
8. Python
# cd /usr/src
# wget https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
#tar -jxf Python-2.7.3.tgz
# cd Python-2.7.3
# ./configure --prefix=/usr/local --enable-shared
# make && make install
配置共享库
# vim /etc/ld.so.conf
-- 增加如下内容
/usr/local/lib
启用配置
# ldconfig
检查是否生效
# ldconfig -v |grep"libpython2.7.so"
二. 编译安装
要yum安装zlib* yum install zlib* -y
# cd/usr/src
#wget http://jaist.dl.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.6.0/ganglia-3.6.0.tar.gz
# tar -zxf ganglia-3.6.0.tar.gz
# cd ganglia-3.6.0
# ./configure --prefix=/usr/local/ganglia --with-gmetad --enable-gexec --with-python=/usr/local
Welcome to..
______ ___
/ ____/___ _____ ____ _/ (_)___ _
/ / __/ __ `/ __ \/ __ `/ / / __ `/
/ /_/ / /_/ / / / / /_/ / / / /_/ /
\____/\__,_/_/ /_/\__, /_/_/\__,_/
/____/
Copyright (c) 2005 University of California, Berkeley
Version: 3.6.0
Library: Release 3.6.0 0:0:0
Type "make" to compile.
# make && make install
#mkdir -p /export/home/ganglia/
# cd /usr/src
#wgethttp://iweb.dl.sourceforge.net/project/ganglia/ganglia-web/3.5.10/ganglia-web-3.5.10.tar.gz
# tar -zxvf ganglia-web-3.5.10.tar.gz -C /export/home/ganglia/
# cd /export/home/ganglia/ganglia-web-3.5.10
# cp conf_default.php conf.php
# vim conf.php 调整为如下内容
$conf[‘gweb_confdir‘] = "/export/home/ganglia/ganglia-web-3.5.10";
$conf[‘gmetad_root‘] = "/export/home/ganglia";
# vim header.php
<?php
session_start();
ini_set(‘date.timezone‘,‘PRC‘); --修改时区为本地时区
if (isset($_GET[‘date_only‘])) {
$d = date("r");
echo $d;
exit(0);
}
配置临时目录
# cd /export/home/ganglia/ganglia-web-3.5.10/dwoo
# mkdir cache
# chmod 777 cache
# mkdir compiled
# chmod 777 compiled
注意:以下apache和php已在nagios环境下配置,由于ganglia和nagios在同一台机子上,所以安装ganglia时不要再重复安装apache和php
# cd /usr/src
# wget http://archive.apache.org/dist/httpd/httpd-2.2.23.tar.gz
# tar -zxvf httpd-2.2.23.tar.gz
# cd httpd-2.2.23
#./configure --prefix=/usr/local/apache2
# make && make install
要提前yum安装libxml2*
# yum install mysql-devel -y
# yum install libxml2* -y
# exportLDFLAGS=-L/usr/lib64/mysql
# mkdir /usr/lib/mysql
# cp /usr/lib64/mysql/*/usr/lib/mysql/
# cd /usr/src
# wget http://museum.php.net/php5/php-5.4.10.tar.gz
# tar -zxf php-5.4.10.tar.gz
# cd php-5.4.10
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr
# make && make install
# vim/usr/local/apache2/conf/httpd.conf
ServerName localhost:80
....
Listen 80
....
<IfModule dir_module>
DirectoryIndex index.html index.php
AddType application/x-httpd-php .php
</IfModule>
....
# 在文件最后增加如下内容
# ganglia
Alias /ganglia "/export/home/ganglia/ganglia-web-3.5.10"
<Directory "/export/home/ganglia/ganglia-web-3.5.10">
AuthType Basic
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
启动httpd服务
# /usr/local/apache2/bin/apachectl restart
三. 配置ganglia
# cd ganglia-3.6.0
# cp ./gmetad/gmetad.init /etc/init.d/gmetad
# cp ./gmetad/gmetad.conf /usr/local/ganglia/etc/
# vim /etc/init.d/gmetad --修改如下内容
GMETAD=/usr/local/ganglia/sbin/gmetad
# vim/usr/local/ganglia/etc/gmetad.conf -- 修改如下内容
data_source "htchecluster" 10 duangr-1 duangr-2 duangr-3
xml_port 8651
interactive_port 8652
rrd_rootdir "/export/home/ganglia/rrds"
case_sensitive_hostnames 0
修改rrds数据目录所有者
# mkdir/export/home/ganglia/rrds
# chown -R nobody:nobody /export/home/ganglia/rrds
启动gmetad服务,并设为开机自动运行
# service gmetad restart
# chkconfig --add gmetad
# cd ganglia-3.6.0
# cp ./gmond/gmond.init /etc/init.d/gmond
#./gmond/gmond -t > /usr/local/ganglia/etc/gmond.conf
# vim /etc/init.d/gmond --修改如下内容
GMOND=/usr/local/ganglia/sbin/gmond
# vim/usr/local/ganglia/etc/gmond.conf -- 修改如下内容
cluster {
name = "htchecluster"
owner = "nobody"
latlong = "unspecified"
url = "unspecified"
}
复制python module到ganglia部署目录
# mkdir /usr/local/ganglia/lib64/ganglia/python_modules
#cp ./gmond/python_modules/*/*.py /usr/local/ganglia/lib64/ganglia/python_modules
安装程序ganglia-3.6.0默认提供了一些python module的配置文件,只需要部署到 /usr/local/ganglia/etc/conf.d 目录下面即可生效
若对默认提供的这些监控脚本不太关心,可以跳过下面这步:
# cp ./gmond/python_modules/conf.d/*.pyconf /usr/local/ganglia/etc/conf.d
启动gmond服务,并设为开机自动运行
# service gmond restart
# chkconfig --add gmond
四. 安装完成
本文出自 “小贝比尔IT交流” 博客,谢绝转载!
标签:gateway service 监控主机 技术 防火墙
原文地址:http://xiaobeibier.blog.51cto.com/6296011/1665669