Configure CACTI to monitor MySQL database status
MySQL itself is not powerful in performance monitoring, which makes many MySQL DBAs sleep at night,
Fortunately, the MySQL database status is monitored through Cacti (note that monitoring is not monitoring ).
With the powerful drawing function of cacti + rrdtool and dedicated mysql templates, You can flexibly and quickly create and monitor multiple MySQL instances.
(I) For RPM installation, the following RPM packages are required:
Httpd
Php
Php-mysql
Php-snmp
Mysql
Mysql-server
Net-snmp *
(Ii) install RRDTool
# Wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.14.tar.gz
# Tar-zxv-f rrdtool-1.4.4.tar.gz
#./Configure -- prefix =/usr/local/rrdtool -- disable-python -- disable-tcl
# Make
# Make install
Possible faults:
Configure: error: Please fix the library issues listed above and try again
(Iii) install CACTI
# Wget http://www.cacti.net/downloads/
# Useradd cacti
# Tar-zxv-f cacti-0.8.7i.tar.gz
# Music cacti-0.8.7i/var/www/cacti
# Chown-R cacti: cacti/var/www/cacti
(Iv) configure the apache module
Edit apache configuration file: vim httpd. conf
① Modify the service name:
ServerAdmin 192.168.1.113: 80
② Modify the site's start directory:
DocumentRoot "/var/www"
③ Modify the directory:
<Directory "/var/www">
④ Add the default homepage File Name:
DirectoryIndex index.html index. php
⑤ Added support for the php type:
AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps
Then: wq save and quit!
Run apachectl-t to check the Configuration File Syntax. Normally, Syntax OK is returned:
Start snmp service: service snmpd start
Start apache service: apachectl start
(V) Configure cacti
① Create a database:
# Mysql-u root-h localhost-P 3306-e "create database cactidb"
② Create a user:
Mysql> grant all on cacti. * TO cacti @ localhost identified by 'cacti ';
Mysql> grant all on cactidb. * to cacti @ localhost;
③ Import data:
$./Mysql-ucacti-pcacti-h localhost-P 3306-D cactidb </var/www/cacti. SQL
④ Edit the cacti configuration file:
# Vim/var/www/cacti/include/config. php
$ Database_type = "mysql ";
$ Database_default = "cactidb ";
$ Database_hostname = "localhost ";
$ Database_username = "cacti ";
$ Database_password = "cacti ";
$ Database_port = "3306 ";
$ Database_ssl = false;
After the installation is complete, you can perform operations in the browser.
Enter http: // 192.168.1.113/cacti/
The following error may be reported: [plain] FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config. php'
Solution:
Ln-s/tmp/mysql. sock/var/lib/mysql. sock
Next, follow the prompts to perform the operation.
Initial User name: admin
Initial password: admin
After logging on to the initial user name and password, CACTI will immediately ask you to change it:
Next, you can log on successfully: