can refer to
http://www.cacti.net/
Http://blog.chinaunix.net/uid-24727220-id-3025015.html
http://blog.fity.cn/post/369/
Cacti problem Summary There's always something you met.
1, Cacti Introduction
1), cacti is a PHP language implementation of a software, its main function is to use the SNMP service to obtain data, and then use RRDtool to store and update the data, when the user needs to view the data with the RRDtool to generate a chart presented to the user. Therefore, SNMP and RRDtool are the key to cacti. SNMP is related to the collection of data, RRDtool is related to data storage and chart generation.
2), MySQL with PHP program to store some variable data and call the variable data, such as: Host name, host IP, SNMP community name, port number, template information and other variables.
3), SNMP caught data is not stored in MySQL, but exists in the RRDtool generated RRD file (under the Cacti root directory Rra folder). RRDtool Update and storage of data is the processing of the RRD file, the RRD file is a fixed size file (Round Robin Archive), it can store the number of data is defined at the time of creation.
2. Package Preparation
Cacti-0.8.8b.tar.gz
Httpd-2.2.23.tar.gz
Php-5.4.10.tar.gz
Cmake-2.8.11.2.tar.gz
Mysql-5.5.28.tar.gz
Rrdtool-1.4.8.tar.gz
Net-snmp-5.7.2.1.tar.gz
Python-2.7.6.tgz
Libxml2-2.9.1.tar.gz
Zlib-1.2.8.tar.gz
Jpegsrc.v9a.tar.gz
Libpng-1.6.12.tar.gz
Freetype-2.5.3.tar.gz
Libart_lgpl-2.3.21.tar.gz
Gettext-0.19.2.tar.xz
Libgd-2.1.0.tar.gz
Curl-7.37.1.tar.gz
3. Apache Installation Configuration
# tar ZXVF httpd-2.2.23.tar.gz
# CD httpd-2.2.23
#./configure--prefix=/usr/local/apache2--enable-so
# Make && make install
# CP/USR/LOCAL/APACHE2/BIN/APACHECTL/ETC/INIT.D/HTTPD
4. mysql installation configuration
# tar ZXVF cmake-2.8.11.2.tar.gz
# CD cmake-2.8.11.2
#./configure
# Make && make install
# Groupadd MySQL
# useradd MySQL
# tar ZXVF mysql-5.5.28.tar.gz
# CD mysql-5.5.28
# CMake. -dcmake_install_prefix=/usr/local/mysql/-dmysql_datadir=/usr/local/mysql/data-dwith_innobase_storage_engine=1- Dmysql_tcp_port=3306-dextra_charsets=all-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dmysql_unix_ Addr=/usr/local/mysql/data/mysql.sock-dmysql_user=mysql-dwith_debug=0
# Make && make install
# VIM/ROOT/.BASHRC
Path=/usr/local/mysql/bin:${path}
Export PATH
# SOURCE/ROOT/.BASHRC
# CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
# CP Support-files/mysql.server/etc/init.d/mysqld
# chmod 755/etc/init.d/mysqld
# chmod 755/usr/local/src/mysql-5.5.28/scripts/mysql_install_db
#./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
# Chown-r Mysql.mysql/usr/local/mysql/data
# service Mysqld Start
# mysqladmin-uroot Password 123456
# mysqladmin--user=root-p Create cacti
# mysql-uroot-p Cacti<cacti.sql
Mysql>grant all on cacti.* to [e-mail protected] identified by ' Cactipassword ';
Mysql>flush privileges;
5, GD installation configuration
1), install LIBXML2
# tar zxvf python-2.7.6.tgz #貌似只能是这个版本 or error when compiling LIBXML2
# CD Python-2.7.6
#./configure--prefix=/usr/local/python
# Make && make install
# tar ZXVF libxml2-2.9.1.tar.gz
# CD libxml2-2.9.1
#./configure--PREFIX=/USR/LOCAL/LIBXML2
# Make && make install
2), install Zlib
# tar ZXVF zlib-1.2.8.tar.gz
# CD zlib-1.2.8
#./configure--PREFIX=/USR/LOCAL/ZLIB2
# Make && make install
# yum Install-y zlib-devel
3), install JPEGSRC
# tar ZXVF jpegsrc.v9a.tar.gz
# CD JPEG-9A
#./configure--PREFIX=/USR/LOCAL/JPEGSRC9
# Make && make install
4), install libpng
# tar ZXVF libpng-1.6.12.tar.gz
# CD libpng-1.6.12
#./configure--prefix=/usr/local/libpng2
# Make && make install
5), install FreeType
# tar ZXVF freetype-2.5.3.tar.gz
# CD freetype-2.5.3
#./configure--prefix=/usr/local/freetype2
# Make && make install
6), install LIBART_LGPL
# tar ZXVF libart_lgpl-2.3.21.tar.gz
# CD libart_lgpl-2.3.21
#./configure--prefix=/usr/local/libart
# Make && make install
7), install GetText
# xz-d GETTEXT-0.19.2.TAR.XZ
# tar XVF Gettext-0.19.2.tar
# CD gettext-0.19.2
#./configure--prefix=/usr/local/gettext
# Make && make install
8), install GD
# tar ZXVF libgd-2.1.0.tar.gz
# CD libgd-2.1.0
9), install Curl
# tar ZXVF curl-7.37.1.tar.gz
# CD curl-7.37.1
#./configure--prefix=/usr/local/curl
# Make && make install
6, PHP installation configuration
# yum Install-y libxml2-devel Freetype-devel
# tar ZXVF php-5.4.10.tar.gz
# CD php-5.4.10
#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-jpeg-dir=/usr/local/jpeg9/-- with-png-dir=/usr/local/libpng2/--WITH-GD--with-freetype-dir=/usr/local/freetype2/--with-zlib-dir=/usr/local/ zlib2/--with-mysql=/usr/local/mysql--with-curl=/usr/local/curl--with-gettext=/usr/local/gettext-- Enable-sockets
# Make && make install
# CP Php.ini-development/usr/local/php/lib/php.ini
# ln-s/usr/local/php/bin/php/usr/bin
# vim/usr/local/apache2/conf/httpd.conf
Added after #addtype application/x-tar.tgz: AddType application/x-httpd-php. php
Added after #loadmodule foo_module modules/mod_foo.so: LoadModule php5_module modules/libphp5.so
Append index.php to directoryindexindex.html back
7. RRDtool Installation Configuration
# yum install-y freetype-devel libart_lgpl-devel gd-devel Cairo cairo-devel Pango Pango-devel
# tar ZXVF rrdtool-1.4.8.tar.gz
# CD rrdtool-1.4.8
#./configure--prefix=/usr/local/rrdtool
# Make && make install
# ln-s/usr/local/rrdtool/bin/rrdtool/usr/bin
8. NET-SNMP Installation Configuration
# tar ZXVF net-snmp-5.7.2.1.tar.gz
# CD net-snmp-5.7.2.1
#./configure--PREFIX=/USR/LOCAL/NET-SNMP
# Make && make install
# ln–s/usr/local/net-snmp/bin/*/usr/local/bin/
# cp/usr/local/src/net-snmp-5.7.2.1/example.conf/usr/local/net-snmp/share/snmp/snmpd.conf
# vim/usr/local/net-snmp/share/snmp/snmpd.conf
Add the following content
View all included. 1
View SystemView included. 1.3.6.1.2.1.2
#/USR/LOCAL/NET-SNMP/SBIN/SNMPD
# lsof-i:161
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
SNMPD 41107 root 8u IPv4 616363 0t0 UDP localhost:snmp
# snmpwalk-v 1-c public localhost system
# vim/etc/rc.d/rc.local
Append the following, boot from boot
/usr/local/net-snmp/sbin/snmpd
# content about snmpd.conf can also refer to the following configuration
Com2sec notconfiguser Default Test
Group Notconfiggroup v1 Notconfiguser
Group Notconfiggroup v2c Notconfiguser
View all included. 1
View SystemView included. 1.3.6.1.2.1.1
View SystemView included. 1.3.6.1.2.1.2
View SystemView included. 1.3.6.1.2.1.25.1.1
Access Notconfiggroup "" Any noauth exact none none
Com2sec local localhost test
Com2sec mynetwork 10.0.2.0/24 Test
View MIB2 included. Iso.org.dod.internet.mgmt.mib-2 FC
9. Cacti Installation Configuration
# tar ZXVF cacti-0.8.8b.tar.gz
# MV Cacti-0.8.8b/usr/local/cacti
# vim/usr/local/apache2/conf/httpd.conf
DocumentRoot "/usr/local/apache2/htdocs" = DocumentRoot "/usr/local/cacti"
<directory "/usr/local/apache2/htdocs" > = <directory "/usr/local/cacti" >
# vim/usr/local/cacti/include/config.php
$database _type = "MySQL";
$database _default = "cacti";
$database _hostname = "localhost";
$database _username = "Cactiuser";
$database _password = "Cactipassword";
$database _port = "3306";
$database _ssl = false;
/* load up old style plugins here */#enable Plugins
$plugins = Array ();
$plugins [] = ' thold ';
# Useradd Cactiuser
# Chown-r Cactiuser.cactiuser./rra./log
# Service httpd Restart
# RRDtool Fetch LOCALHOST_USERS_6.RRD average| MAX#查看rrd文件是否有数据
10. Installed SNMP Service by monitoring machine
# yum Install-y net-snmp*
# vim/etc/snmp/snmpd.conf
View all included. 1
View SystemView included. 1.3.6.1.2.1.2
# service SNMPD Start
# lsof-i:161
11. Summary of issues
Question 1:
Warning:strtotime (): It is not safe for rely on the system ' s timezone settings. You is *required* to use the Date.timezone setting or the Date_default_timezone_set () function. In case you used any of those methods and you is still getting this warning, your most likely misspelled the timezone Iden Tifier. We selected the timezone ' UTC ' for now, but please set Date.timezone to select your timezone. In/usr/local/apache2/htdocs/cacti/include/global_constants.php on line 165
Workaround:
# Vim/usr/local/php/lib/php.ini
Modify
Date.timezone = PRC
and uncomment
Question 2:
PHP Strict standards:only variables should be passed by reference in/usr/local/nginx/html/cacti/lib/ping.php on line 38 2
Workaround:
Socket_select ($r = Array ($this->socket), $w = null, $f = NULL, $to _sec, $to _usec) {
= = amended to
$r = Array ($this->socket);
$w = NULL;
$f = NULL;
Switch (Socket_select ($r, $w, $f, $to _sec, $to _usec)) {
Question 3:
Warning:cron is out of sync with the Poller interval! The Poller Interval is ' "seconds, with a maximum of a '" second Cron, but 2135 seconds has passed since the last P oll!
Workaround:
*/1 * * * */usr/bin/php/usr/local/apache2/htdocs/cacti/poller.php >/dev/null 2>& 1
Cacti and Nagios Some summary of "six"