在开始操作之前,先简单介绍几个概念
*SNMP :简单网络管理协议
它主要是根据用户的需求获取远程被监控主机的一些信息而已,
*RRDTOOL : 是一个强大的绘图工具
它主要是根据用户的需求将从SNMP协议(当然也可以是其他的方式,比如说sheel脚本等,)获取到信息,绘制成图像,
*cacti : cacti( http://www.cacti.net )
是一个基于PHP开发的强大的检测分析工具而已,cacti主要是通过SNMP或sheel脚本等方式获取到被监控主机的数据, 然后通过rrdtool存储更新数据,当用户需要查看数据的时候,使用rrdtool生成图表通过cacai展示给用户,
****************************************************************************************
下面将在一台默认安装有rhel5.8的系统上安装配置cacti
****************************************************************************************
上面说过cacit是一个php语言开发的网页工具,那么我们需要安装LAMP平台,还要生成图像展示给用户,需要安装rrdtool,如果要使用snmp协议监控其他主机或本机,需要安装snmp
****************************************************************************************
准备以下软件包,存放至/usr/src目录下
****************************************************************************************
apr-1.4.6.tar.bz2
apr-util-1.4.1.tar.bz2
cmake-2.8.8.tar.gz 这些包主要是LAMP环境所用到的软件包
httpd-2.4.2.tar.bz2
mysql-5.5.25a.tar.gz
php-5.4.4.tar.bz2
****************************************************************************************
rrdtool-1.4.7.tar.gz
cacti-spine-0.8.8a.tar.gz
cacti-0.8.8a.tar.gz
****************************************************************************************
准备完成好,下面来安装配置了,需要注意的是软件包一定要放到/usr/src目录,而且要配置好yum源,
一, 构建LAMP环境,这里使用脚本自动化编译安装并配置,(当然也可以使用yum安装,)
1. 构建LAMP平台,脚本内容如下
#!/bin/bash
# andy_f
# 编译安装LAMP平台
local_ip=`ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'`
# install path
http_path=/usr/local/apache
apr_path=/usr/local/apr
apr_util_path=/usr/local/apr-util
php_path=/usr/local/php
mysql_path=/usr/local/mysql
re=0
# install package name
apr="apr-1.4.6.tar.bz2"
apr_util="apr-util-1.4.1.tar.bz2"
http="httpd-2.4.2.tar.bz2"
php="php-5.4.4.tar.bz2"
cmake="cmake-2.8.8.tar.gz"
mysql="mysql-5.5.25a.tar.gz"
# Compiler parameters
make_apr="--prefix=$apr_path"
make_apr_util="--prefix=$apr_util_path --with-apr=$apr_path"
make_http="--prefix=$http_path --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=$apr_path --with-apr-util=$apr_util_path --enable-suexec --with-suexec"
make_mysql="-DCMAKE_INSTALL_PREFIX=$mysql_path -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci "
make_php="--prefix=$php_path --with-mysql=$mysql_path --with-config-file-path=$php_path/etc --with-openssl --enable-sockets --with-mysqli=$mysql_path/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml -with-apxs2=$http_path/bin/apxs --with-bz2"
###################################
host1=/cacti
##################################
check_apache() {
[ -e $apr_path ] && echo -e "
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3356/viewspace-2820784/ ,如需转载,请注明出处,否则将追究法律责任。