插件一(可用): 一,脚本下载以及设置 wget http://mysql-cacti-templates.googlecode.com/files/mysql-cacti-templates-1.1.2.tar.gz tar -xzvf mysql-cacti-templates-1.1.2.tar.gz cd mysql-cacti-templates-1.1.2 cp ss_get_mysql_stats.php /xok.la/cacti/scripts 可以看到里面有多个监控项目,报告监控apache和nginx.我这只测试mysql,mysql相关的就2个文件: 模板文件:cacti_host_template_x_db_server_ht_0.8.6i.xml 插件:ss_get_mysql_stats.php 修改ss_get_mysql_stats.php 文件 第30行 $mysql_user = ‘cacti’; $mysql_pass = ‘cacti’; $cache_dir = “/xok.la/cacti/cache/”; 设置准备监控的数据库的账户相关信息 mkdir /xok.la/cacti/cache/ chown -R vhost.vhost /xok.la/cacti/cache/ chmod 777 -R /xok.la/cacti/cache/ 默认在获取的数据/tmp/下,会有cacti不能读取的情况。所以放在cacti目录来。 二,创建监控Mysql需要的账户以及权限 配置MySQL服务器,让cacti所在机器能够访问MySQL服务器的状态信息,必须拥有"process"权限。如果要监控InnoDB状态,还必须有"SUPER"权限。 mysql> grant process,super on *.* to ‘cacti’@’%’ identified by ‘cacti’; mysql> grant all privileges on cacti.* to cacti@"%" identified by “cacti”; 三,模板导入 在cacti管理界面(Import Templates)导入cacti_host_template_x_db_server_ht_0.8.6i.xml。 四,添加设备 创建Graph。在Console选项卡下的左侧菜单栏中选择Devices,为要监控的主机新建一个Devices或选择已有Devices。在Associated Graph Templates中添加想要监控MySQL状态的Graph Templates(如X MySQL Connections GT模板)。并点击最上面的Create Graphs for this Host链接,在Graph Templates的选择框中选择X MySQL Connections GT,然后点击Create按钮,出现以下WEB页。 监控的对象有: X InnoDB Buffer Pool Activity GT X InnoDB Buffer Pool GT X InnoDB I/O GT X InnoDB I/O Pending GT X InnoDB Insert Buffer GT X InnoDB Log GT X InnoDB Row Operations GT X InnoDB Semaphores GT X InnoDB Transactions GT X MyISAM Indexes GT X MySQL Binary/Relay Logs GT X MySQL Command Counters GT X MySQL Connections GT X MySQL Files and Tables GT X MySQL Handlers GT X MySQL Network Traffic GT X MySQL Processlist GT X MySQL Query Cache GT X MySQL Query Cache Memory GT X MySQL Replication GT X MySQL Select Types GT X MySQL Sorts GT X MySQL Table Locks GT X MySQL Temporary Objects GT X MySQL Threads GT X MySQL Transaction Handler GT 插件二(可用): 一,脚本下载 wget http://www.faemalia.net/mysqlUtils/teMySQLcacti-20060810.tar.gz tar -xzvf teMySQLcacti-20060810.tar.gz cd teMySQLcacti cp mysql_stats.php /xok.la/cacti/scripts/ cp dumpMemcachedStats.php /xok.la/cacti/scripts/ 二,模板导入 在cacti管理界面(Import Templates)导入cacti_host_template_temysql_host-step300-heartbeat600.xml 与cacti_host_template_memcached_host-step300-heartbeat600.xml模板文件。 三,创建监控Mysql需要的账户以及权限 配置MySQL服务器,让cacti所在机器能够访问MySQL服务器的状态信息,必须拥有"process"权限。如果要监控InnoDB状态,还必须有"SUPER"权限。 mysql> grant process,super on *.* to ‘cacti’@’%’ identified by ‘cacti’; mysql> grant all privileges on cacti.* to cacti@"%" identified by “cacti”; 四,添加设备 创建Graph。在Console选项卡下的左侧菜单栏中选择Devices,为要监控的主机新建一个Devices或选择已有Devices。在Associated Graph Templates中添加想要监控MySQL状态的Graph Templates(如teMySQL - Index Usage模板,此套模板是以teMySQL开头的一系列模板)。并点击最上面的Create Graphs for this Host链接,在Graph Templates的选择框中选择teMySQL - Locking and Slow,然后点击Create按钮,出现以下WEB页。 监控的对象有: teMySQL - CPU Usage teMySQL - Index Usage teMySQL - InnoDB Buffers Pages/Mem teMySQL - InnoDB File I/O teMySQL - InnoDB InsBuffer teMySQL - InnoDB Locks teMySQL - InnoDB Row teMySQL - Load Average teMySQL - Locking and Slow teMySQL - Network Usage teMySQL - Old Command Stats teMySQL - Old Handler Stats teMySQL - Query Cache teMySQL - Replication teMySQL - Select Handler teMySQL - Select Queries teMySQL - Sorts teMySQL - Temporary Objects teMySQL - Threads/Abends teMySQL - Volatile Handler teMySQL - Volatile Queries