Cacti is an excellent open source monitoring software, using PHP implementation, the main feature is to use the SNMP service to obtain data, and then use RRDtool to store and update the data, when the user view the data, RRDtool generate a chart to be presented to the user. After CentOS7, the default database is MARIADB, which is a branch of MySQL that stores variables and makes calls. The MARIADB database does not store the data captured by SNMP, and the data that is captured by SNMP exists in the RRDtool generated RRD file, which is located in the RRA directory in the cacti directory.
First, the installation of related software
Most can be installed with Yum:
Yum Install httpd*----Installing Web server Apache related services
Yum Install php*----PHP-related services
Yum Install mariadb*----Installing MARIADB database related services
Yum Install net-snmp*----Installing SNMP-related services
Yum install RRDtool rrdtool-devel rrdtool-php rrdtool-perl----Installing RRDtool to generate images
Yum install GD gd-devel PHP-GD---rrdtool graphics library required for drawing images
Second, configure SNMP
Vi/etc/snmp/snmpd.conf
① change the default of 41 rows (each with a different, self-lookup) to 127.0.0.1
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/9C/wKiom1W56xvD4ENwAAA7N9tl2CU501.jpg "title=" QQ picture 20150730171329.png "alt=" Wkiom1w56xvd4enwaaa7n9tl2cu501.jpg "/>
② Change the SystemView of 62 rows (each with a different, self-locating) to all
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/99/wKioL1W57oyjLE0cAAB_TVIhUbI014.jpg "title=" QQ picture 20150730171933.png "alt=" Wkiol1w57oyjle0caab_tvihubi014.jpg "/>
③ 85 lines (each with a different, please find yourself) under the # comment out
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/99/wKioL1W572jwmi8kAABOZtxBFSw915.jpg "title=" QQ picture 20150730172231.png "alt=" Wkiol1w572jwmi8kaaboztxbfsw915.jpg "/>
④ Starting SNMP
Systemctl Start Snmpd.service
Third, MARIADB database configuration
① Enabling the MARIADB database
Systemctl Start Mariadb.service
② set the password for the root user (take Wang as an example), and modify the login permissions, the default password is empty
#mysql –u root–p Enter password after return (empty)
MariaDB [(none)]> use MySQL;
MariaDB [mysql]> Update user set Password=password (' Wang ') where user= ' root ';
MariaDB [mysql]>grant all privileges on * * to [e-mail protected] identified by ' Wang ' with GRANT option;
MariaDB [Mysql]>flush privileges;
③ adding cacti users and cacti databases and setting permissions for them
MariaDB [mysql]>create database cacti default character set UTF8; # #数据库字符集设置utf8, otherwise garbled
MariaDB [mysql]>grant all privileges-cacti.* to [e-mail protected] identified by ' cacti ' with GRANT option;
MariaDB [Mysql]>flush privileges;
Iv. Configuration of cacti
① Download cacti
wget http://www.cacti.net/downloads/cacti-0.8.8f.tar.gz # #下载cacti
TAR-ZXVF cacti-0.8.8f.tar.gz # #解压cacti
MV Cacti-0.8.8f/var/www/html/cacti # #移动至/var/www/html/cacti
② to import cacti table content into the created database
Cd/var/www/html/cacti
Mysql-ucacti-pcacti Cacti </var/www/html/cacti/cacti.sql
③ edit two. php files separately
vi/var/www/html/cacti/include/config.php
vi/var/www/html/cacti/include/global.php
The content of the modification is the same as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/9A/wKioL1W6Bj3gXkBiAACYRx7AEOA810.jpg "title=" QQ picture 20150730190142.png "alt=" Wkiol1w6bj3gxkbiaacyrx7aeoa810.jpg "/>
④ Modify file properties:
Useradd–r–m cacti
Chown–r cacti/var/www/html/cacti/rra/
Chown–r cacti/var/www/html/cacti/log/
⑤ set up a scheduling task:
#crontab –e "Enter the following"
*/5 * * * * php/var/www/html/cacti/poller.php >/dev/null 2>&1
⑥ Enabling the HTTP service
Systemctl Start Httpd.service
⑦ Browser input http://localhost/cacti or 127.0.0.1/CACTI Access cacti Administration page
As appears:
Forbidden
You don't have permission to access/cacti on this server.
This is because SELinux has been turned on to cause permissions issues
1). View the SELinux status:
#/usr/sbin/sestatus-v # #如果SELinux The status parameter is enabled is turned on
SELinux status:enabled
# getenforce # #该命令也可检查
2). Turn off SELinux:
A, temporary shutdown (do not restart the machine):
# Setenforce 0 # #设置SELinux become permissive mode (off SELinux)
# setenforce 1 # #设置SELinux become enforcing mode (SELinux)
b, modify the configuration file to restart the machine:
# Vi/etc/selinux/config
Change Selinux=enforcing to Selinux=disabled
Restart the machine
Enter Http://localhost/cacti again, enter the Web installation, after the installation is complete, such as no image display, is RRDtool not installed for the sake of the complete, such as can not be out of the picture, may be a clock problem, as follows: 650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/70/9E/wKiom1W6CaLD-stzAAKXiL3MJ1A457.jpg "title=" qq picture 20150730162421.png "alt=" Wkiom1w6cald-stzaakxil3mj1a457.jpg "/>
This article is from the Notepad blog, so be sure to keep this source http://wangzhijian.blog.51cto.com/6427016/1680278
CENTOS7 installation Cacti