https://www.cacti.net
[root@monitor ~]# yum install -y epel-release[root@monitor ~]# rpm -ivh https://mirror.webtatic.com/yum/el6/latest.rpm[root@monitor ~]# yum install -y httpd php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 \php56w-devel.x86_64 php56w-mysqlnd.x86_64 php56w-process.x86_64 php56w-snmp.x86_64[root@monitor ~]# php -vPHP 5.6.40 (cli) (built: Jan 12 2019 09:19:57) Copyright (c) 1997-2016 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies[root@monitor ~]# yum install -y net-snmp net-snmp-utils net-snmp-devel \libjpeg libjpeg-devel libpng libpng-devel help2man rrdtool[root@monitor ~]# rpm -ivh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm[root@monitor ~]# yum install -y mysql-community-server [root@monitor ~]# vi /etc/my.cnf[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockcharacter-set-server = utf8innodb_buffer_pool_size = 2Ginnodb_buffer_pool_instances = 2innodb_log_file_size = 256Minnodb_log_files_in_group = 3innodb_log_buffer_size = 16Minnodb_undo_logs= 128innodb_undo_tablespaces = 3innodb_data_file_path = ibdata1:1024M:autoextend[root@monitor ~]# service mysqld start[root@monitor ~]# service mysqld statusmysqld (pid 24712) is running...[root@monitor ~]# /usr/bin/mysql_secure_installation[root@monitor ~]# vim /etc/httpd/conf/httpd.confServerName 192.168.1.201:80[root@monitor ~]# vim /etc/php.inidate.timezone = Asia/Shanghai[root@monitor ~]# vim /etc/httpd/conf.d/cacti.confAlias /cacti /var/www/html/cacti# httpd 2.4 Require host localhost # httpd 2.2 Order deny,allow Deny from all Allow from all [root@monitor ~]# /etc/init.d/httpd startStarting httpd: [ OK ][root@monitor ~]# mysql -uroot -pabcd.1234mysql> create database cacti default character set utf8;Query OK, 1 row affected (0.08 sec)mysql> grant all on cacti.* to 'cacti'@'localhost' identified by 'cacti';Query OK, 0 rows affected (0.06 sec)mysql> grant select on mysql.time_zone_name to 'cacti'@'localhost';Query OK, 0 rows affected (0.00 sec)[root@monitor ~]# tar zxvf cacti-1.1.38.tar.gz[root@monitor ~]# mkdir /var/www/html/cacti[root@monitor ~]# cp -R cacti-1.1.38/* /var/www/html/cacti/[root@monitor ~]# chmod -R 7755 /var/www/html/cacti/rra/[root@monitor ~]# chmod -R 777 /var/www/html/cacti/log/[root@monitor ~]# chown -R apache:apache /var/www/html/cacti/[root@monitor ~]# mysql -uroot -p cacti < cacti-1.1.38/cacti.sql [root@monitor ~]# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql[root@monitor ~]# vi /var/www/html/cacti/include/config.php$database_type = 'mysql';$database_default = 'cacti';$database_hostname = 'localhost';$database_username = 'cacti';$database_password = 'cacti';$database_port = '3306';$database_ssl = false;[root@monitor ~]# tar zxvf cacti-spine-1.1.38.tar.gz[root@monitor ~]# cd cacti-spine-1.1.38[root@monitor cacti-spine-1.1.38]# ./configure[root@monitor cacti-spine-1.1.38]# make[root@monitor cacti-spine-1.1.38]# make install[root@monitor ~]# cd /usr/local/spine/etc[root@monitor etc]# mv spine.conf.dist spine.conf[root@monitor etc]# vim spine.conf DB_Host localhostDB_Database cactiDB_User cactiDB_Pass cactiDB_Port 3306
http://192.168.1.201/cacti
初始密码 admin/admin
修改密码
大功告成
[root@monitor ~]# crontab -e*/5 * * * * /usr/bin/php /usr/share/cacti/poller.php导入模板template:https://docs.cacti.net/templates[root@monitor ~]# cd /var/www/html/cacti/cli[root@monitor cli]# php import_package.php --filename=/root/percona_mysql_server_ht.xml.gzRead 1149904 bytes of Package dataImport ResultsCacti has imported the following items for the Package:Package Files/var/www/html/cacti/scripts/ss_get_mysql_stats.php [not writable]CDEF[success] Percona Negate CDEF [new]GPRINT Preset[success] Percona Normal [new]Data Input Method[success] Percona Get MySQL Stats/MyISAM Indexes IM [new]略......Data Template[success] Percona MyISAM Indexes DT [new]略......Graph Template[success] Percona MyISAM Indexes GT [new]略......Device Template[success] Percona MySQL Server HT [new]