using cacti to graph mysql’s metrics - percona · pdf fileusing cacti to graph...

103
Using Cacti To Graph MySQL’s Metrics Kenny Gryp [email protected] Principal Consultant @ Percona Collaborate 2011 1

Upload: ngodung

Post on 18-Mar-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Using Cacti To Graph MySQL’s MetricsKenny [email protected] Consultant @ Percona

Collaborate 2011

1

Page 2: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Percona

•MySQL/LAMP Consulting•MySQL Support•Percona Server (XtraDB)•Percona XtraBackup• InnoDB Recovery Toolkit, tcprstat•(maatkit, innotop, aspersa, mysql-mmm, mysql-cacti-

templates) • ...•http://www.percona.com•http://www.mysqlperformanceblog.com

2

Page 3: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

3

Page 4: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

4

Page 5: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Why Graph?

•Troubleshooting-behavior over time-sudden spikes in graphs after application updates

•Capacity Planning-traffic patterns-predictions

•Not only for Operations, also for Development and Management

5

Page 6: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

6

Page 7: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Cacti?

•open source graphing solution•uses RRDTool•advanced graphs, scriptable•web interface•quite complex to add graphs•adding servers is a manual process

7

Page 8: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

mysql-cacti-templates?

•collection of templates for cacti•graph MySQL metrics•Has a lot of non-MySQL Metrics too: IO stats,

apache, memcache, mongodb, java...

8

Page 9: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

9

Page 10: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

How does Cacti work?

10

Database Servermysqld

sshd

snmpd

/proc/diskstats

Cacti

MySQL(contains cacti configuration)

.rrd Files(contains rrd data)

Apache(serves web

interface)

Poller(cronjob which

fetches data from servers)

Web Serverhttpd

sshd

snmpd

Web Browser

what

stores

fetch

df

Page 11: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

11

Page 12: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Installation

•Cacti•Mysql-cacti-templates•Configuring Servers

12

Page 13: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Installation

•Cacti•Mysql-cacti-templates•Configuring Servers

13

Page 14: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setting up Cacti: Requirements

•httpd•php, php-mysql, php-snmp•mysql-server (server and client utilities)•net-snmp (snmpget)•rrdtool

14

Page 15: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setting up Cacti: Installation

• Install rpm/deb/... package or extract yourself•Configure webserver: php5, cacti scripts•Create cacti mysql user• Import cacti database•Edit configuration•Setup cronjob for poller•Finish installation using your webbrowser

15

Page 16: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: Extract

•Recommended is using apt/yum/... to install cacti• if not:

16

cacti# cd /var/www/html/ # may varycacti# tar xzvf cacti-0.8.7g.tar.gzcacti# ln -s cacti-0.8.7g cacticacti# chown -R cactiuser rra/ log/

Page 17: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: Webserver

•Apache (may be something else)•Enable php•Set DirectoryIndex index.php

17

LoadModule php5_module modules/libphp5.soAddHandler php5-script .phpAddType text/html .phpDirectoryIndex index.php

Page 18: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: MySQL

•Create Cacti MySQL user:

• Import Cacti Schema

•Edit include/config.php

18

cactimysql> GRANT ALL PRIVILEGES ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'password';

cacti# mysql -e ‘CREATE DATABASE cacti;’cacti# mysql cacti < cacti.sql

$database_type = "mysql";$database_default = "cacti";$database_hostname = "localhost";$database_username = "cactiuser";$database_password = "password";

Page 19: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: Poller

•Add cronjob (/etc/cron.d/cacti)

19

*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

Page 20: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: UI

20

Page 21: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: UI

21

Page 22: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: UI

22

Page 23: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: UI

23

Page 24: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: UI

24

Page 25: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: UI

25

Page 26: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Setup: UI

26

Page 27: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Installation

•Cacti•Mysql-cacti-templates•Configuring Servers

27

Page 29: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

install: mysql script

29

cacti# vi /var/www/html/cacti/scripts/\ss_get_mysql_stats.php ...$mysql_user = 'cactiuser';$mysql_pass = 'password';...

Page 30: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

install: generate ssh key

30

cacti# mkdir /etc/cacticacti# ssh-keygen Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): /etc/cacti/id_rsaEnter passphrase (empty for no passphrase): Your identification has been saved in /etc/cacti/id_rsa.Your public key has been saved in /etc/cacti/id_rsa.pub.cacti# chown -R www-data: /etc/cacti/{id_rsa,id_rsa.pub}cacti# chmod -R 0400 /etc/cacti/id_rsa

Page 31: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

install: ssh script

31

cacti# vi /var/www/html/cacti/scripts/ss_get_by_ssh.php ...$ssh_user= 'cacti'; # SSH username$ssh_port= 22; # SSH port$ssh_iden='-i /etc/cacti/id_rsa';# SSH identity...

Page 32: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

install: templates

32

Page 33: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

install: templates

33

Page 34: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

install: templates

34

Page 35: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Installation

•Cacti•Mysql-cacti-templates•Configuring Servers

35

Page 36: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Configure Servers

•configure net-snmpd•add a cacti user in MySQL•configure ssh access

36

Page 37: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Configure Servers: snmpd

• Install snmpd

•Make sure snmpd listens on the network and that a community password is set:

•Verify on the cacti server if snmp is working remotely

37

server# apt-get install snmpd

server# vi /etc/snmp/snmpd.conf:agentAddress udp:161rocommunity publicserver# /etc/init.d/snmpd restart

cacti# snmpget -v2c -c public ubuntu-server-test iso.3.6.1.2.1.1.5.0

iso.3.6.1.2.1.1.5.0=STRING:"ubuntu-server-test"

Page 38: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Configure Servers: mysql user

•Add cacti user

•Verify if login works from cacti servers

38

servermysql> GRANT SUPER, PROCESS ON *.* TO 'cactiuser'@'cactiserver' IDENTIFIED BY "password";

cacti# mysql -h ubuntu-server-test -e "SELECT VERSION()" -u cactiuser -ppassword+-------------------+| VERSION() |+-------------------+| 5.1.49-1ubuntu8.1 |+-------------------+

Page 39: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Configure Servers: ssh access

•Add shell user cacti

•Copy the public key

•Verify

39

server# useradd cactiserver# getent passwd cacticacti:x:1001:1002::/home/cacti:/bin/sh

server# mkdir /home/cacti/.ssh/server# cat > /home/cacti/.ssh/authorized_keys << EOFssh-rsa AAA...r2E7z5 root@ubuntu-server-testEOFserver# chmod 0400 /home/cacti/.ssh/authorized_keys

cacti# ssh -i /etc/cacti/id_rsa cacti@ubuntu-server-test

Page 40: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

40

Page 41: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs

41

Page 42: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs

42

Page 43: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs

43

Page 44: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs

44

•Apply wanted templates on the device- MySQL & GNU/Linux templates

•Click on Create Graphs:

•Select graphs to create and Add!•Might ask some more questions

Page 45: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs

45

Page 46: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs

46

•Assign ucd/net SNMP template to have:-cpu usage/load-memory used/available-network statistics-free disk space

•Different way of creating

Page 47: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs

47

Page 48: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs

48

•What if I have multiple disk devices to monitor?-Go to ‘Create graphs for this host’-Select graph to add in select menu-Create and fill in other device when asked

Page 49: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Adding Graphs: Graph Trees

49

•Tree to browse through graphs•By host/individual graph, mixed

Page 50: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

50

Page 51: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

51

Page 52: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Handlers

52

Page 53: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Handlers

53

Table scans, backup?

Page 54: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Handlers

54

Page 55: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Handlers

55

Take backup here

Page 56: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Connections

56

Page 57: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Connections

57

max_connections not reached yet

Why more incoming connections?

Page 58: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Replication

58

Page 59: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Replication

59

Replication was stopped

Replication never caught up

Page 60: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Replication

60

Page 61: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Replication

61

In 2 hours, almost 6900 seconds replication lag

Page 62: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Temporary Objects

62

Page 63: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Temporary Objects

63

keep an eye on:* temp tables* temp disk tablesif it grows > query optimization

Page 64: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Select Types

64

Page 65: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Select Types

65

Why this sudden peak in rangescans?

Page 66: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Select Types

66

Page 67: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Select Types

67

Query behavior changed?Other explain plan chosen?

Page 68: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Sorts

68

Page 69: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Sorts

69

The peaks should be understood, not necessarily be removed as they might be really fast in terms of rows

Page 70: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Command Counters

70

Page 71: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Binary Logs

71

Page 72: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Binary Logs

72

expire_logs_days

Page 73: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Response Time Distribution

73

+----------------+-------+------------+| time | count | total |+----------------+-------+------------|| 0.000001 | 0 | 0.000000 || 0.000010 | 17 | 0.000094 || 0.000100 | 4301 | 0.236555 || 0.001000 | 1499 | 0.824450 || 0.010000 | 14851 | 81.680502 || 0.100000 | 8066 | 443.635693 || 1.000000 | 0 | 0.000000 || 10.000000 | 0 | 0.000000 || 100.000000 | 1 | 55.937094 || 1000.000000 | 0 | 0.000000 || 10000.000000 | 0 | 0.000000 || 100000.000000 | 0 | 0.000000 || 1000000.000000 | 0 | 0.000000 || TOO LONG QUERY | 0 | 0.000000 |+----------------+-------+------------+

Page 74: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Query Response Time

74

Page 75: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

MySQL Query Response Time

75

Page 76: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB Buffer Pool

76

Page 77: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB Buffer Pool

77

DB Restart

Time to fill buffer

Page 78: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB Checkpoint Age

78

Page 79: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB Checkpoint Age

79

sudden increase in unflushed writes

db restart, no write flushing

Page 80: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB Buffer Pool Activity

80

Page 81: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB I/O

81

Page 82: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB I/O

82

More read requests Increase in

load

Page 83: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB Row Operations

83

Page 84: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

InnoDB Row Operations

84

Good view on capacity of the system

Page 85: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

85

Page 86: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

86

more row reads,coming from disk

Page 87: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

87

this spike in IO readsdid not cause more disk reads

Page 88: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

88

Page 89: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

89looking at amount of statements does not always show load

Page 90: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

CPU Usage

90

Page 91: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Memory

91

Page 92: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Disk Operations

92

Page 93: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Topics

•Why Graph?•What is Cacti and mysql-cacti-templates?•How Cacti works• Installation•Add Graphs•Demo•Graphs!•Extra’s

93

Page 94: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

non-MySQL mysql-cacti-templates

•Apache•JMX•Memcached•Mongodb•Nginx•OpenVZ•Redis•Unix

94

Page 95: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

non-MySQL mysql-cacti-templates

95

Page 96: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

non-MySQL mysql-cacti-templates

96

Page 97: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

non-MySQL mysql-cacti-templates

97

Page 98: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

non-MySQL mysql-cacti-templates

98

Page 99: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Other Graphing solutions

•Munin and munin-mysql•OpenNMS and MySQL-SNMP•Zabbix with appaloosa-zabbix-templates

99

Page 100: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Creating Your Own Graphs

•Creating cacti graphs not trivial/portable•mysql-cacti-templates to the rescue!

http://code.google.com/p/mysql-cacti-templates/wiki/CreatingGraphs

100

Page 101: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Using Cacti To Graph MySQL’s Metrics

•Powerful Tool•Easy to install•Open source!

101

Page 102: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Using Cacti To Graph MySQL’s Metrics

•Cacti: http://www.cacti.net/•RRDtool: http://oss.oetiker.ch/rrdtool/•mysql-cacti-templates:

http://code.google.com/p/mysql-cacti-templates/• IRC: Freenode #percona•Mailinglist:

http://groups.google.com/group/percona-discussion•http://www.percona.com•http://www.mysqlperformanceblog.com

102

Page 103: Using Cacti To Graph MySQL’s Metrics - Percona · PDF fileUsing Cacti To Graph MySQL’s Metrics ... •Verify on the cacti server if snmp is working remotely 37

Percona Live MySQL Conference NYCMay 26, 2011

http://www.percona.com/live/nyc-2011/

103