Centos5.7 compile and install cacti
Compile and install cacti
# Enable snmp for the original php
Yum install net-snmp-devel net-snmp-utils-y
# Go To The php source code directory
Cd/usr/local/src/php/src/php-5.2.17/ext/snmp
./Configure -- with-php-config =/usr/local/php1/bin/php-config
Make & make install
# Edit php. ini to add
Extension = "snmp. so"
# Restart php-fpm
/Usr/local/php1/sbin/php-fpm restart
# Installing cacit
1. Install rrdtools
Cd/opt/src
Wgethttp: // oss. oetiker. ch/rrdtool/pub/rrdtool-1.4.5.tar.gz
Yum install pango-devel
Tar xvf rrdtool-1.4.5.tar.gz
Cd rrdtool-1.4.5
./Configure -- prefix =/opt/rrdtool
Make & make install
# Enable rrdtool to support Chinese display
Vi src/rrd_graph.c
Add the following content at the location of setlocale (LC_CTYPE, "").
Setlocale (LC_ALL, "zh_CN.gb2312 ");
2. Install spine
Wgethttp: // www.cacti.net/downloads/spine/cacti-spine-0.8.7h.tar.gz
Cd/opt/src
Tar xvf cacti-spine-0.8.7h.tar.gz
Cd cacti-spine-0.8.7h
./Configure -- prefix =/opt/spine
Make & make install
Modify the spine configuration file
Cd/opt/spine/etc
Cp spine. conf. dist spine. conf
Vi spine. conf
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass cactiuser
DB_Port 3306
DB_PreG 0
3. Install cacti
Create a user
Useradd cacti
Cd/opt/src
Tar xvf cacti-0.8.7h.tar.gz
Music cacti-0.8.7h/home/www/cacti
Chown-R root: root/home/www/cacti
Modify the configuration file (based on actual information)
Vi home/www/cacti/include/config. php
$ Database_type = "mysql ";
$ Database_default = "cacti ";
$ Database_hostname = "localhost ";
$ Database_username = "cactiuser ";
$ Database_password = "cactiuser ";
$ Database_port = "3306 ";
$ Database_ssl = false;
# Create a database and import data
/Usr/local/mysql/bin/mysql-u root-p
Mysql> create database cacti;
Mysql> grant all privileges on cacti. * tocacti @ localhostidentified by "cactiuser ";
Mysql> flush privileges;
/Usr/local/mysql/bin/mysql-u root-p cacti
Cd/home/www/cacti
Chown-R cacti rra/log/
Http: // ip/cacti
Set by actual path
Default username and password admin
Scheduled execution
Yum install vixie-cron
Crontab-u cacti-e
*/1 *****/usr/local/php1/bin/php/home/www/cacti/poller. php>/dev/null 2> & 1
Note: If the path cannot be found, check whether open_basedir is set in php. ini.
Troubleshooting
No data check process
Check whether any data is returned
Snmpwalk-v 2c-c public 10.0.2.88 if
Whether rrdtool has data
/Opt/rrdtool/bin/rrdtool fetch 13.rrd AVERAGE
Also, check whether the selected template is correct.