CACTI: Use templates to monitor MySQL on local or other servers

Source: Internet
Author: User
Tags memory usage mysql query semaphore snmp sorts percona


MySQL templates, which are used online in this address http://mysql-cacti-templates.googlecode.com has not been accessed


Google found this URL:

Introduction Cheat: http://www.percona.com/doc/percona-monitoring-plugins/1.0/cacti/mysql-templates.html

Download page: http://www.percona.com/downloads/percona-monitoring-plugins/


In order to facilitate everyone to download, upload to csdn available for download: http://download.csdn.net/detail/kk185800961/8651279


Files currently downloaded: percona-cacti-templates-1.1.4-1.noarch.rpm




Local server monitors local MySQL:


Go to the directory where cacti is located

Cd/var/www/html

Move the compressed file to the current directory (where it is OK):

MV percona-cacti-templates-1.1.4-1.noarch.rpm.

Unzip the file:

Rpm2cpio percona-cacti-templates-1.1.4-1.noarch.rpm | Cpio-div

The following directories and files will be produced under the current directory:

./usr/share/cacti/resource/percona./usr/share/cacti/resource/percona/bin./usr/share/cacti/resource/percona/bin /pmp-cacti-extract-template./usr/share/cacti/resource/percona/bin/pmp-cacti-graph-defs./usr/share/cacti/ Resource/percona/bin/pmp-cacti-make-hashes./usr/share/cacti/resource/percona/bin/pmp-cacti-template./usr/share /cacti/resource/percona/definitions./usr/share/cacti/resource/percona/definitions/apache.def./usr/share/cacti/ Resource/percona/definitions/galera.def./usr/share/cacti/resource/percona/definitions/gnu_linux.def./usr/share /cacti/resource/percona/definitions/jmx.def./usr/share/cacti/resource/percona/definitions/memcached.def./usr/ share/cacti/resource/percona/definitions/mongodb.def./usr/share/cacti/resource/percona/definitions/mysql.def./ usr/share/cacti/resource/percona/definitions/nginx.def./usr/share/cacti/resource/percona/definitions/ Openvz.def./usr/share/cacti/resource/percona/definitions/rds.def./usr/share/cacti/resource/percona/definitions /redis.def./usr/share/cacti/resource/percona/misc./usr/share/cacti/resource/percona/misc/jmx-monitor.xml./usr/share/cacti/resource/ Percona/templates./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_apache_server_ht_ 0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_galera_server_ht_ 0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_gnu_linux_server_ Ht_0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_jmx_server_ht_ 0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_memcached_server_ Ht_0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_mongodb_server _ht_0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_mysql_server_ Ht_0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_nginx_server_ ht_0.8.6i-sver1.1.4. xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_openvz_server_ht_ 0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_rds_server_ht_ 0.8.6i-sver1.1.4.xml./usr/share/cacti/resource/percona/templates/cacti_host_template_percona_redis_server_ht_ 0.8.6i-sver1.1.4.xml./usr/share/cacti/scripts/ss_get_by_ssh.php./usr/share/cacti/scripts/ss_get_mysql_ stats.php./usr/share/cacti/scripts/ss_get_rds_stats.py


Now as long as MySQL's two files:

Ss_get_mysql_stats.phpcacti_host_template_percona_mysql_server_ht_0.8.6i-sver1.1.4.xml

Copy the ss_get_mysql_stats.php to the cacti directory:

CP./usr/share/cacti/scripts/ss_get_mysql_stats.php/var/www/html/cacti/scripts/

Edit the file to verify that the user name and password are correct:

vi/var/www/html/cacti/scripts/ss_get_mysql_stats.php
$mysql _user = ' cacti '; $mysql _pass = ' cacti ';


Import Template: Open cactiy page-->console-->import templates--> Browse add



Import Results:

Import Resultscacti have imported the following items:cdef[success] Percona Turn into Bits cdef [new][success] Percona Nega Te Cdef [new]gprint preset[success] Percona MySQL Server Checksum 523e4d8178a000df8df3a9825c4e7e1e [new][success]  Percona MySQL Server Version t1.1.4:s1.1.4 [new][success] Percona Normal [new]data Input method[success] Percona Get MySQL Stats/myisam Indexes im [new][success] Percona get MySQL stats/myisam Key Cache IM [new][success] Percona Get MySQL Stats /innodb Buffer Pool IM [new][success] Percona get MySQL stats/innodb I/o IM [new][success] Percona Get MySQL Stats/innodb Insert buffer im [new][success] Percona get MySQL stats/innodb Insert buffer Usage IM [new][success] Percona Get MySQL Sta Ts/innodb semaphores im [new][success] Percona get MySQL stats/innodb Row Operations IM [new][success] Percona Get MySQL S Tats/mysql Table Locks im [new][success] Percona get mysql stats/mysql Connections im [new][success] Percona Get MySQL Sta Ts/mysql Replication IM [new][suCcess] Percona get mysql stats/mysql query cache im [new][success] Percona Get mysql stats/mysql Query cache Memory im [NE  W][success] Percona get mysql stats/mysql Command Counters im [new][success] Percona get mysql stats/mysql Select Types im [New] [Success] Percona get MySQL stats/mysql sorts im [new][success] Percona get mysql stats/mysql temporary Objects im [new][success] Pe Rcona get MySQL stats/mysql Network traffic im [new][success] Percona Get mysql stats/innodb Buffer Pool Activity IM [New] [Success] Percona get MySQL stats/innodb I/o Pending im [new][success] Percona Get mysql stats/innodb Log IM [new][success] Percona Get MySQL stats/mysql binary/relay Logs im [new][success] Percona Get mysql stats/innodb transactions IM [new][success] Pe Rcona get MySQL stats/innodb transactions active/locked IM [new][success] Percona get MySQL stats/mysql Files and Tables I M [new][success] Percona get MySQL stats/mysql Threads IM [new][success] Percona Get mysql stats/innodb Memory allocation IM [new][success] Percona get MySQL stats/innodb Adaptive Hash Index IM [new][success] Percona get MySQL stats/innodb in ternal Hash Memory Usage im [new][success] Percona get MySQL stats/innodb Tables in use IM [new][success] Percona Get mysq L stats/innodb Current Lock Waits im [new][success] Percona Get MySQL STATS/INNODB Lock structures im [new][success] Perco Na get mysql stats/innodb Checkpoint age im [new][success] Percona Get mysql stats/innodb Row Lock time im [new][success] Percona get MySQL stats/innodb Row Lock Waits im [new][success] Percona Get mysql stats/innodb Semaphore Waits IM [new][su Ccess] Percona get MySQL stats/innodb Semaphore Wait time im [new][success] Percona get MySQL stats/mysql processlist IM [ New][success] Percona get MySQL stats/mysql Transaction Handler IM [new][success] Percona get MySQL stats/mysql handlers I M [new][success] Percona get MySQL stats/mysql Query time histogram (Count) IM [new][success] Percona get MySQL stats/mysq L Query Response Time (MIcroseconds) im [new][success] Percona Get MySQL stats/innodb Buffer Pool efficiency IM [New]data template[success] Percon  A MyISAM Indexes DT [new][success] Percona MyISAM Key Cache DT [new][success] Percona InnoDB Buffer Pool DT [new][success]  Percona InnoDB I/O DT [new][success] Percona InnoDB Insert buffer dt [new][success] Percona InnoDB Insert Buffer Usage DT [New] [Success] Percona InnoDB semaphores DT [new][success] Percona InnoDB Row Operations DT [new][success] Percona MySQL Table Locks DT [ New][success] Percona mysql Connections dt [new][success] Percona mysql Replication DT [new][success] Percona MySQL Query Cache DT [new][success] Percona mysql Query Cache Memory dt [new][success] Percona mysql Command Counters DT [new][success ] Percona mysql Select Types dt [new][success] Percona mysql sorts dt [new][success] Percona mysql temporary Objects DT [n  Ew][success] Percona MySQL Network traffic dt [new][success] Percona InnoDB Buffer Pool Activity DT [new][success] Percona InnoDBI/o Pending dt [new][success] Percona InnoDB Log DT [new][success] Percona MySQL binary/relay Logs DT [new][success] Perco Na InnoDB transactions dt [new][success] Percona InnoDB transactions active/locked DT [new][success] Percona MySQL Files A nd Tables DT [new][success] Percona MySQL Threads DT [new][success] Percona InnoDB Memory Allocation DT [new][success] Per Cona InnoDB Adaptive hash Index dt [new][success] Percona InnoDB Internal Hash Memory Usage DT [new][success] Percona Inno DB Tables in use DT [new][success] Percona InnoDB current Lock Waits DT [new][success] Percona InnoDB Lock Structures DT [ New][success] Percona InnoDB Checkpoint age dt [new][success] Percona InnoDB Row Lock time DT [new][success] Percona Innod B Row Lock Waits DT [new][success] Percona InnoDB Semaphore Waits DT [new][success] Percona InnoDB Semaphore Wait Time DT [New] [Success] Percona mysql processlist dt [new][success] Percona mysql Transaction Handler dt [new][success] Percona mysql handlers DT [New] [sucCess] Percona MySQL query time histogram (Count) DT [new][success] Percona MySQL query Response time (microseconds) DT [NE  W][success] Percona InnoDB Buffer Pool efficiency DT [new]graph template[success] Percona MyISAM Indexes GT [new][success] Percona MyISAM Key Cache gt [new][success] Percona InnoDB Buffer Pool gt [new][success] Percona InnoDB I/O gt [New][succe SS] Percona InnoDB Insert buffer GT [new][success] Percona InnoDB Insert buffer Usage GT [new][success] Percona InnoDB Sem Aphores GT [New][success] Percona InnoDB Row Operations gt [new][success] Percona MySQL Table Locks GT [new][success] Perc Ona mysql Connections gt [new][success] Percona mysql Replication gt [new][success] Percona mysql Query Cache gt [New][suc Cess] Percona mysql Query Cache Memory gt [new][success] Percona mysql Command Counters GT [new][success] Percona MySQL Se Lect Types GT [new][success] Percona mysql sorts GT [new][success] Percona mysql temporary Objects gt [New][success] Perco Na MySQL Network traffic GT [New][success] Percona InnoDB Buffer Pool Activity gt [new][success] Percona InnoDB I/o Pending GT [new][success] Perc Ona InnoDB Log gt [new][success] Percona MySQL binary/relay Logs gt [New][success] Percona InnoDB transactions GT [New][su Ccess] Percona InnoDB transactions active/locked GT [New][success] Percona MySQL Files and Tables gt [New][success] Percon  A MySQL Threads gt [new][success] Percona InnoDB Memory Allocation GT [new][success] Percona InnoDB Adaptive Hash Index GT [New] [Success] Percona InnoDB Internal Hash Memory Usage gt [new][success] Percona InnoDB Tables in use GT [New][success] Percona InnoDB Current Lock Waits GT [new][success] Percona InnoDB Lock Structures GT [new][success] Percona InnoDB Checkpoint age GT [NE W][success] Percona InnoDB row lock Time GT [new][success] Percona InnoDB Row Lock Waits GT [new][success] Percona InnoDB Semaphore Waits GT [new][success] Percona InnoDB Semaphore Wait time GT [new][success] Percona MySQL processlist GT [new][ Success Percona MySQL Transaction Handler gt [new][success] Percona mysql handlers GT [new][success] Percona MySQL Query time his Togram (Count) GT [new][success] Percona MySQL Query Response time (microseconds) GT [new][success] Percona InnoDB Buffer Pool efficiency GT [new]host template[success] Percona MySQL Server HT [New]


Open Devices--> Select Host (not created)--drop-down to bottom

Select the appropriate image template to add to the host:

The current test adds 3:

Percona InnoDB Log GT
Percona MySQL Connections GT
Percona MySQL Threads GT



Pull up to the top of the page, click on "Create image for Host" Graphs, select the 3 image template that you just created.



Create a directory tree and add images to the tree:

Click on "Image tree (graph Trees)" and select "Default Tree"--add subtree (mysql_local)


Click "Add" next to the tree mysql_local, and the subtree type is "graph" and the 3 monitor images of MySQL are displayed in the directory structure:



Check back in a few minutes. The image appears!






Monitor MySQL in CentOS across servers:


Cacti Server: 192.168.1.151

Monitoring client: 192.168.1.152


Ping each other and confirm that the network is unblocked.


To install SNMP in Client 152:

Yum-y Install NET-SNMP net-snmp-utils


#更改配置文件以下信息: Line 41st, line 62nd, line 85th

Vi/etc/snmp/snmpd.conf
#com2sec notconfiguser  default       publiccom2sec notconfiguser  192.168.1.151       public#access  Notconfiggroup ""      any       noauth    exact  systemview none noneaccess  notconfiggroup ""       Noauth    exact all  none none# will #view all included. 1 80 The previous # comment removes the view all    included  . 1 80


Finally, start or restart the client SNMP service:

Service SNMPD Restart


In client 152, the MySQL add cacti user allows 151 access:

Grant Process,super on * * to ' cacti ' @ ' 192.168.1.151 ' identified by ' cacti '; flush privileges;


On server side 151, Test 152 of SNMP is enabled for success:

Snmpwalk-c public-v 2c 192.168.1.152


The main firewall problem, add the client SNMP service also to the self-boot: ntsysv



Click: Device (Devices)-->add (upper right corner)



Other added steps and methods are the same as the native use.


No image is, note whether there are permissions in the cacti directory:

Ll/var/www/html/cacti/rra

Soon the image data distance appears:





In client 152, the MySQL add cacti user allows 151 access:

Grant Process,super on * * to ' cacti ' @ ' 192.168.1.151 ' identified by ' cacti '; flush privileges;

CACTI: Use templates to monitor MySQL on local or other servers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.