CACTI :使用模板监控本地或其他服务器上的mysql
mysql 的模板,网上都在使用的这个地址http://mysql-cacti-templates.googlecode.com 已经访问不到了
Google找到这个网址:
介绍篇:
http://www.percona.com/doc/percona-monitoring-plugins/1.0/cacti/mysql-templates.html
下载页:http://www.percona.com/downloads/percona-monitoring-plugins/
为了方便大家下载,上传到csdn可供下载: http://download.iyunv.com/detail/kk185800961/8651279
当前下载的文件:percona-cacti-templates-1.1.4-1.noarch.rpm
本地服务器监控本地mysql:
进入到cacti所在目录
cd /var/www/html
将压缩文件移到当前目录(放那都行):
mv percona-cacti-templates-1.1.4-1.noarch.rpm .
解压文件:
rpm2cpio percona-cacti-templates-1.1.4-1.noarch.rpm | cpio -div
在当前目录下将生产以下目录及文件:
./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
现在只要mysql的两个文件:
ss_get_mysql_stats.php
cacti_host_template_percona_mysql_server_ht_0.8.6i-sver1.1.4.xml
拷贝ss_get_mysql_stats.php到cacti目录中:
cp ./usr/share/cacti/scripts/ss_get_mysql_stats.php /var/www/html/cacti/scripts/
编辑文件,确认用户名和密码正确:
vi /var/www/html/cacti/scripts/ss_get_mysql_stats.php$mysql_user = 'cacti';
$mysql_pass = 'cacti';
导入模板:打开cactiy页面——>Console——>Import Templates——>浏览添加
导入结果:
Import Results
Cacti has imported the following items:
CDEF
Percona Turn Into Bits CDEF
Percona Negate CDEF
GPRINT Preset
Percona MySQL Server Checksum 523e4d8178a000df8df3a9825c4e7e1e
Percona MySQL Server Version t1.1.4:s1.1.4
Percona Normal
Data Input Method
Percona Get MySQL Stats/MyISAM Indexes IM
Percona Get MySQL Stats/MyISAM Key Cache IM
Percona Get MySQL Stats/InnoDB Buffer Pool IM
Percona Get MySQL Stats/InnoDB I/O IM
Percona Get MySQL Stats/InnoDB Insert Buffer IM
Percona Get MySQL Stats/InnoDB Insert Buffer Usage IM
Percona Get MySQL Stats/InnoDB Semaphores IM
Percona Get MySQL Stats/InnoDB Row Operations IM
Percona Get MySQL Stats/MySQL Table Locks IM
Percona Get MySQL Stats/MySQL Connections IM
Percona Get MySQL Stats/MySQL Replication IM
Percona Get MySQL Stats/MySQL Query Cache IM
Percona Get MySQL Stats/MySQL Query Cache Memory IM
Percona Get MySQL Stats/MySQL Command Counters IM
Percona Get MySQL Stats/MySQL Select Types IM
Percona Get MySQL Stats/MySQL Sorts IM
Percona Get MySQL Stats/MySQL Temporary Objects IM
Percona Get MySQL Stats/MySQL Network Traffic IM
Percona Get MySQL Stats/InnoDB Buffer Pool Activity IM
Percona Get MySQL Stats/InnoDB I/O Pending IM
Percona Get MySQL Stats/InnoDB Log IM
Percona Get MySQL Stats/MySQL Binary/Relay Logs IM
Percona Get MySQL Stats/InnoDB Transactions IM
Percona Get MySQL Stats/InnoDB Transactions Active/Locked IM
Percona Get MySQL Stats/MySQL Files and Tables IM
Percona Get MySQL Stats/MySQL Threads IM
Percona Get MySQL Stats/InnoDB Memory Allocation IM
Percona Get MySQL Stats/InnoDB Adaptive Hash Index IM
Percona Get MySQL Stats/InnoDB Internal Hash Memory Usage IM
Percona Get MySQL Stats/InnoDB Tables In Use IM
Percona Get MySQL Stats/InnoDB Current Lock Waits IM
Percona Get MySQL Stats/InnoDB Lock Structures IM
Percona Get MySQL Stats/InnoDB Checkpoint Age IM
Percona Get MySQL Stats/InnoDB Row Lock Time IM
Percona Get MySQL Stats/InnoDB Row Lock Waits IM
Percona Get MySQL Stats/InnoDB Semaphore Waits IM
Percona Get MySQL Stats/InnoDB Semaphore Wait Time IM
Percona Get MySQL Stats/MySQL Processlist IM
Percona Get MySQL Stats/MySQL Transaction Handler IM
Percona Get MySQL Stats/MySQL Handlers IM
Percona Get MySQL Stats/MySQL Query Time Histogram (Count) IM
Percona Get MySQL Stats/MySQL Query Response Time (Microseconds) IM
Percona Get MySQL Stats/InnoDB Buffer Pool Efficiency IM
Data Template
Percona MyISAM Indexes DT
Percona MyISAM Key Cache DT
Percona InnoDB Buffer Pool DT
Percona InnoDB I/O DT
Percona InnoDB Insert Buffer DT
Percona InnoDB Insert Buffer Usage DT
Percona InnoDB Semaphores DT
Percona InnoDB Row Operations DT
Percona MySQL Table Locks DT
Percona MySQL Connections DT
Percona MySQL Replication DT
Percona MySQL Query Cache DT
Percona MySQL Query Cache Memory DT
Percona MySQL Command Counters DT
Percona MySQL Select Types DT
Percona MySQL Sorts DT
Percona MySQL Temporary Objects DT
Percona MySQL Network Traffic DT
Percona InnoDB Buffer Pool Activity DT
Percona InnoDB I/O Pending DT
Percona InnoDB Log DT
Percona MySQL Binary/Relay Logs DT
Percona InnoDB Transactions DT
Percona InnoDB Transactions Active/Locked DT
Percona MySQL Files and Tables DT
Percona MySQL Threads DT
Percona InnoDB Memory Allocation DT
Percona InnoDB Adaptive Hash Index DT
Percona InnoDB Internal Hash Memory Usage DT
Percona InnoDB Tables In Use DT
Percona InnoDB Current Lock Waits DT
Percona InnoDB Lock Structures DT
Percona InnoDB Checkpoint Age DT
Percona InnoDB Row Lock Time DT
Percona InnoDB Row Lock Waits DT
Percona InnoDB Semaphore Waits DT
Percona InnoDB Semaphore Wait Time DT
Percona MySQL Processlist DT
Percona MySQL Transaction Handler DT
Percona MySQL Handlers DT
Percona MySQL Query Time Histogram (Count) DT
Percona MySQL Query Response Time (Microseconds) DT
Percona InnoDB Buffer Pool Efficiency DT
Graph Template
Percona MyISAM Indexes GT
Percona MyISAM Key Cache GT
Percona InnoDB Buffer Pool GT
Percona InnoDB I/O GT
Percona InnoDB Insert Buffer GT
Percona InnoDB Insert Buffer Usage GT
Percona InnoDB Semaphores GT
Percona InnoDB Row Operations GT
Percona MySQL Table Locks GT
Percona MySQL Connections GT
Percona MySQL Replication GT
Percona MySQL Query Cache GT
Percona MySQL Query Cache Memory GT
Percona MySQL Command Counters GT
Percona MySQL Select Types GT
Percona MySQL Sorts GT
Percona MySQL Temporary Objects GT
Percona MySQL Network Traffic GT
Percona InnoDB Buffer Pool Activity GT
Percona InnoDB I/O Pending GT
Percona InnoDB Log GT
Percona MySQL Binary/Relay Logs GT
Percona InnoDB Transactions GT
Percona InnoDB Transactions Active/Locked GT
Percona MySQL Files and Tables GT
Percona MySQL Threads GT
Percona InnoDB Memory Allocation GT
Percona InnoDB Adaptive Hash Index GT
Percona InnoDB Internal Hash Memory Usage GT
Percona InnoDB Tables In Use GT
Percona InnoDB Current Lock Waits GT
Percona InnoDB Lock Structures GT
Percona InnoDB Checkpoint Age GT
Percona InnoDB Row Lock Time GT
Percona InnoDB Row Lock Waits GT
Percona InnoDB Semaphore Waits GT
Percona InnoDB Semaphore Wait Time GT
Percona MySQL Processlist GT
Percona MySQL Transaction Handler GT
Percona MySQL Handlers GT
Percona MySQL Query Time Histogram (Count) GT
Percona MySQL Query Response Time (Microseconds) GT
Percona InnoDB Buffer Pool Efficiency GT
Host Template
Percona MySQL Server HT
打开Devices——>选择主机(没有则创建)——>下拉到底部
选择相应的图像模板添加到主机:
当前测试添加了3个:
Percona InnoDB Log GT
Percona MySQL Connections GT
Percona MySQL Threads GT
上拉到页面顶部,点击“为主机创建图像(Create Graphs for this Host)”,选择刚才的3个图像模板,创建。
创建目录树并添加图像到树中:
点击 “图像树(Graph Trees)”——>选择 “默认树(Default Tree)”——>添加子树(Mysql_local)
点击树Mysql_local旁边的“添加(Add)”,子树类型为“图像(Graph)”,将mysql的3个监控图像放在该目录结构中显示:
几分钟后查看。图像出现!
跨服务器监控centos中的mysql :
cacti监控服务器:192.168.1.151
被监控的客户端:192.168.1.152
互相ping一下,确认网络畅通。
在客户端152中安装snmp:
yum -y install net-snmp net-snmp-utils
#更改配置文件以下信息:第41行,第62行,第85行
vi /etc/snmp/snmpd.conf#com2sec notConfigUserdefault public
com2sec notConfigUser192.168.1.151 public
#accessnotConfigGroup "" any noauth exactsystemview none none
accessnotConfigGroup "" any noauth exactall none none
#将 #view all included .1 80 前面的 # 注释去掉
view all included.1 80
最后启动或重启客户端snmp服务:
service snmpd restart
在客户端152的mysql添加cacti用户允许151访问:
grant process,super on *.* to 'cacti'@'192.168.1.151' identified by 'cacti';
flush privileges;
在服务端151执行,测试152的snmp是否启用成功:
snmpwalk -c public -v 2c 192.168.1.152
主要防火墙问题,把客户端snmp服务也添加到自启动中:ntsysv
点击:设备(Devices)——>add(右上角)
其他添加的步骤和方法,和本机使用的一样。
没有图像是,注意cacti目录下是否有权限:
ll /var/www/html/cacti/rra
很快图像数据距出现了:
页:
[1]