1, monitoring script download and configuration
wget http://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz
Tar zxvf better-cacti-templates-1.1.8.tar.gz
CD better-cacti-templates-1.1.8
CP scripts/ss_get_mysql_stats.php/var/www/html/cacti/scripts/
Only two files are needed to monitor MySQL:
Template file:./templates/cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml
Plugins:./scriptsss_get_mysql_stats.php
To modify the ss_get_mysql_stats.php file:
vim/var/www/html/cacti/scripts/ss_get_mysql_stats.php
The MySQL server is configured so that the cacti machine can access the state information of the MySQL server and must have "process" permission. If you want to monitor the InnoDB state, you must also have "SUPER" permission.
Mysql> Grant Process,super on *.* to ' cactiuser ' @ '% ' identified by ' cactiuser '; Mysql> grant all privileges on cacti.* to cactiuser@ "%" identified by "Cactiuser" mysql> flush;
3, Import Template
Cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml template from Linux down to local computer, login to Web import:
4, add MySQL monitoring
Select Devices in the left menu bar under the Console tab, select a device or create a new device, and add the MySQL status to monitor in associated Graph templates:
In the Create Graphs for this host, select the template you just added and create the image below by clicking Create:
5, finally in the upper left corner of the Graphs tab, to view the device image, you can view the monitoring of the MySQL image: