Cacti流量监控系统安装配置
安装mysql
- # useradd –g mysql mysql
- #./configure –prefix=/usr/local/mysql –with-unix-socket-path=/tmp/mysql.sock –with-big-tables –enable-thread-safe-client –localstatedir=/data/mysql/data –with-named-curses-libs=/usr/lib/libncursesw.so.5
- * 解决编译时configure: error: No curses/termcap library found的错误
- # make && make install
- # /usr/local/mysql/bin/mysql_install_db –user=mysql –datadir=/data/mysql/data
- # cp /data/src/mysql-5.0.40/support-files/my-huge.cnf /etc/my.cnf
- # /usr/local/mysql/bin/mysqld_safe –user=mysql –log-error=/data/mysql/mysql.error.log &
安装apache
- # ./configure –prefix=/usr/local/apache2 –enable-file-cache –enable-cache –enable-disk-cache –enable-mem-cache –enable-so -with-mpm=worker
- # make && make install
安装gd库
- # yum -y install yum-fastestmirror
- # yum -y install zlib-devel zlib
- # yum –y install libpng-devel libpng
- # yum –y install freetype-devel freetype
- # yum –y install libjpeg-devel libjpeg
- # yum –y install fontconfig-devel fontconfig
- # yum –y install libxml2-devel libxml2 libxml2-python
- # yum –y install gd-devel gd
安装php
- # cd /data/src/php-5.2.5
- ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-config-file-path=/usr/local/php/etc –with-mysql=/usr/local/mysql/ –with-gd –enable-gd-native-ttf –with-jpeg-dir –with-png-dir –with-ttf –with-zlib –with-freetype-dir=/usr/local/freetype/ –enable-mbstring –enable-sockets –with-snmp
- # make && make install
- # cp php.ini-dist /usr/local/php/lib/php.ini
- # vi /usr/local/php/etc/php.ini
- 加入include_path = “/usr/local/php/lib/php”
安装RRDtools
- # yum –y install cairo*
- # yum –y install pango*
- # yum –y install libart_lgpl-devel
- # cd /data/src/rrdtool-1.2.27
- # ./configure –prefix=/usr/local/rrdtool
- # make && make install
设置cacti用户及安装目录
- # useradd cacti
- # wget http://www.cacti.net/downloads/cacti-0.8.7b.tar.gz
- # tar xvfz cacti-0.8.7b.tar.gz
- # cp -rf /data/src/cacti-0.8.7b/* /data/cacti/
安装cacti补丁
- # wget http://www.cacti.net/downloads/patches/0.8.7b/upgrade_from_086k_fix.patch
- # wget http://www.cacti.net/downloads/patches/0.8.7b/snmp_auth_none_notice.patch
- # wget http://www.cacti.net/downloads/patches/0.8.7b/reset_each_patch.patch
- # patch -p1 -N < /data/src/upgrade_from_086k_fix.patch
- # patch -p1 -N < /data/src/snmp_auth_none_notice.patch
- # patch -p1 -N < /data/src/reset_each_patch.patch
- # chown -R cacti:cacti /data/cacti
- # chmod 755 /data/cacti
设置安装cacti数据库环境
- # /usr/local/mysql/bin/mysql
- mysql> create database cacti;
- mysql> grant select, insert, update, delete, index, alter, create, lock tables, create temporary tables, drop, references on cacti.* to ‘cactiuser’@’localhost’ identified by ‘cactiuser’;
- mysql> flush privileges;
- # /usr/local/mysql/bin/mysql -u cactiuser -p cacti < /data/cacti/cacti.sql
设置自动执行脚本
- # crontab –u cacti –e
- */5 * * * * /usr/local/php/bin/php /data/cacti/poller.php > /dev/null 2>&1
apache配置文件安装
- # vi /usr/local/apache2/conf/httpd.conf
- ServerName 211.103.188.204
- DirectoryIndex index.html index.php
- Alias /cacti /data/cacti
- AllowOverride None
- Options None
- Order allow,deny
- Allow from all
- AddType application/x-httpd-php .php .phtml
- AddType application/x-httpd-php-source .phps
- # /usr/local/apache2/bin/apachectl -k start
- # vi /usr/local/apache2/logs/error_log
- [Tue Jun 03 14:02:31 2008] [notice] caught SIGTERM, shutting down
- [Tue Jun 03 14:04:01 2008] [notice] Apache/2.2.6 (Unix) PHP/5.2.6 configured — resuming normal operations
安装cacti
安装cacti程序
rrdtool与php位置标红,指定php与rrdtool程序的正确路径即可。
默认用户名admin 默认密码 Vale.com-init
安装spine
- # wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7a.tar.gz
- # yum –y openssl-devel
- # cd /data/src/cacti-spine-0.8.7a
- # ./configure
- # make && make install
- # mkdir /usr/local/spine
- # cp spine /usr/local/spine
- # cp spine.conf /usr/loca/spine
修改
- configuration->setting->path->Alternate Poller Path,在Spine Poller File Path中填写/usr/local/spine/spine
- configuration->setting-> Poller ,在Poller Type中选择spine
设置安装中文字体
下载微软雅黑字体
- # cp /root/msyh.ttf /data/cacti
在cacti控制面板上设置Configuration->Settings->Path,将RRDTool Default Font Path的内容设置为/data/cacti/msyh.ttf
监控服务器snmp设置
- # yum –y install net-snmp-libs net-snmp-devel net-snmp-perl net-snmp-utils net-snmp
- # chkconfig –level 345 snmpd on
- # vi /etc/snmp/snmpd.conf
- #sec.name source community
- com2sec local localhost valeftp
- com2sec mynetwork 0.0.0.0/0 valeftp
- com2sec public default valeftp
- # sec.model sec.name
- group local v1 local
- group local v2c local
- group local usm local
- group mynetwork v1 mynetwork
- group mynetwork v2c mynetwork
- group mynetwork usm mynetwork
- group public v1 local
- group public v2c local
- group public usm local
- # incl/excl subtree mask
- view mib2 included .iso.org.dod.internet.mgmt.mib-2 80
- view all included .1 80
- # context sec.model sec.level match read write notif
- access local “” any noauth exact all all none
- access public “” any noauth exact all none none
- access mynetwork “” any noauth exact mib2 none none
- syslocation Right here, right now.
- syscontact Me
- # service snmpd restart
测试snmp
- # snmpwalk –v2c –c valeftp 127.0.0.1 system测试本机
- # snmpwalk –v2c –c valeftp RemoteIp system测试远程主机
【编辑推荐】