In this presentation I’ll be discussing the following beginner points to understanding and creating monitoring.
* Why Monitor?
* What’s the minimum to Monitor?
* How to monitor?
* Monitoring Software Options.
* How to use the most basic of monitoring to help
* The basics of graphing results
* The rule of Everything
* The important on Application metrics and timings
For a very little investment in time, simple monitoring can be in place, and I can guarantee it will be of benefit to any system.
The basis of monitoring are metrics that combined with application measurements can provide trending insights, bottleneck understanding and provide valuable feedback about your growing site.
The 7 Things I Know About Cyber Security After 25 Years | April 2024
MySQL Monitoring 101
1. MySQL Monitoring 101
MySQL Monitoring 101
Simple stuff to save your bacon
Ronald Bradford
Principal - 42SQL
MySQL Users Conference
Santa Clara - April 2009
http://ronaldbradford.com
Version 1.1 22.Apr.2009
2. MySQL Monitoring 101
What is Your Situation?
How do you know your website is down?
http://ronaldbradford.com
3. MySQL Monitoring 101
Is this you?
How do you know your website is down?
❖ The users will let me know
❖ That's somebody else's problem
❖ Our site is never down
❖ Email/SMS/Pager
http://ronaldbradford.com
4. MySQL Monitoring 101
Is this you?
You have a performance problem now?
❖ How long has it been happening?
❖ Is it a new problem or a re-occurring problem?
❖ Has it gradually become worse over time?
http://ronaldbradford.com
5. MySQL Monitoring 101
Is this you?
When did you last recover from a backup?
❖ We need to think about doing backups
❖ We use MySQL replication
❖ That's somebody else's problem
❖ We verify our backups worked (not recovery)
http://ronaldbradford.com
7. MySQL Monitoring 101
Four Goals to take away
Monitoring a MySQL Server(s)
❖ Know what to monitor
❖ Know how you can monitor
❖ Learn practices to diagnose problems
❖ Have a foundation of historical information
http://ronaldbradford.com
17. MySQL Monitoring 101
Customer Examples
❖ Single CPU Kernel on 4 Processor Server
$ uptime
10:32:22 up 196 days, 11:46, 2 users, load average: 3.86, 4.08, 4.26
$ uname -a
Linux db1 2.4.20-6 #1 Thu Feb 27 10:06:59 EST 2003 i686 i686 i386 GNU/Linux
[root@db1 mysql]# cat /proc/cpuinfo
processor :0
vendor_id : GenuineIntel
cpu family :6
model : 10
model name : Pentium III (Cascades)
stepping :1
cpu MHz : 701.636
cache size : 2048 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level :2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx
fxsr sse
bogomips : 1399.19
http://ronaldbradford.com
18. MySQL Monitoring 101
Customer Examples
❖ Single CPU Kernel - Disabled from boot loader
$ more /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda3
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
root (hd0,0)
kernel /vmlinuz-2.4.20-6 ro root=LABEL=/
initrd /initrd-2.4.20-6.img
[root@db1 mysql]# ls /boot/vmlinu
vmlinux-2.4.20-6 vmlinux-2.4.20-6smp vmlinuz vmlinuz-2.4.20-6 vmlinuz-2.4.20-6smp
http://ronaldbradford.com
19. MySQL Monitoring 101
Customer Examples
❖ Excessive Network Load (20GB uncompressed backup)
$ ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: d
Wake-on: d
Link detected: yes
http://ronaldbradford.com
20. MySQL Monitoring 101
Customer Examples
❖ Degraded RAID
❖ Who checks RAID status?
❖ How is it checked?
http://ronaldbradford.com
21. MySQL Monitoring 101
Additional Resources
• Identify Bottlenecks
• CPU
• Memory
http://ronaldbradford.com/blog/identifying-resource-bottlenecks-cpu-2009-03-31/
http://ronaldbradford.com/blog/identifying-resource-bottlenecks-memory-2009-04-02/
• Check back for additional articles
http://ronaldbradford.com
23. MySQL Monitoring 101
Know Your Running Software
❖ Operating System
❖ Database
❖ Other
http://ronaldbradford.com
24. MySQL Monitoring 101
Operating System Specifics
❖ Kernel Version
❖ 32/64 bit Kernel
❖ 32bit software running on 64bit kernel
❖ Review all running software
❖ Should it be running?
http://ronaldbradford.com
29. MySQL Monitoring 101
MySQL System Variables 3
❖ Based on my.cnf configuration
❖ Customizable in running server
❖ SHOW GLOBAL VARIABLES
http://dev.mysql.com/doc/refman/5.1/en/show-variables.html
http://ronaldbradford.com
30. MySQL Monitoring 101
MySQL Status Variables 4
❖ Provide valuable clues to the state of your
servers
❖ GLOBAL and SESSION scope
❖ SHOW [GLOBAL|SESSION] STATUS
http://dev.mysql.com/doc/refman/5.1/en/show-status.html
http://ronaldbradford.com
31. MySQL Monitoring 101
MySQL Connections 5
❖ SHOW FULL PROCESSLIST
http://dev.mysql.com/doc/refman/5.1/en/show-status.html
http://ronaldbradford.com
32. MySQL Monitoring 101
MySQL Storage Engines 6
❖ SHOW ENGINE INNODB STATUS
❖ Well incorporated in 5.1 Status Variables
http://dev.mysql.com/doc/refman/5.1/en/show-status.html
http://ronaldbradford.com
33. MySQL Monitoring 101
Your MySQL Data 7
❖ Know your data
❖ Disk footprint
❖ Growth
http://ronaldbradford.com
34. MySQL Monitoring 101
Instance Summary
select table_schema,
sum(data_length+index_length)/1024/1024 as total_mb,
sum(data_length)/1024/1024 as data_mb,
sum(index_length)/1024/1024 as index_mb,
count(*) as tables
from information_schema.tables
group by table_schema
order by 2 desc;
http://ronaldbradford.com
36. MySQL Monitoring 101
Schema Summary
select table_name,engine,row_format, table_rows, avg_row_length,
(data_length+index_length)/1024/1024 as total_mb,
(data_length)/1024/1024 as data_mb,
(index_length)/1024/1024 as index_mb
from information_schema.tables
where table_schema= DATABASE()
order by 6 desc;
http://ronaldbradford.com
38. MySQL Monitoring 101
Schema Attributes
select table_schema,engine,table_collation,
count(*) as tables
from information_schema.tables
where table_schema=DATABASE()
group by table_schema,engine,table_collation;
select table_schema,table_name,column_name,data_type
from information_schema.columns
where table_schema= DATABASE()
and ( data_type LIKE '%TEXT' OR data_type like '%BLOB');
http://ronaldbradford.com
42. MySQL Monitoring 101
MySQL Monitoring
❖ hourly.sh
❖ OS
❖ vmstat
❖ ps
❖ uptime
❖ MySQL
❖ Variables
❖ Status
❖ Process List
❖ Innodb Engine Status
❖ Table Status
http://ronaldbradford.com
43. MySQL Monitoring 101
MySQL Analysis
❖ statpack - Human Readable STATUS
❖ Database Activity
❖ Statement Activity
❖ Prepared Statements
❖ Admin Commands
❖ Thread Cache
❖ Table Cache
❖ MyISAM Key Cache
❖ ....
http://www.markleith.co.uk/?p=21
http://ronaldbradford.com
44. MySQL Monitoring 101
statpack - Read/Write Ratio
===================================================================================================
Uptime: 17 days 17 hours 22 mins Snapshot Period 1: 59 minute interval
===================================================================================================
Variable Delta/Percentage Per Second Total
===================================================================================================
Statement Activity
===================================================================================================
SELECT: 13,503,876 3,798.56 4,298,170,239 (94.25%)
INSERT: 91,101 25.63 25,327,062 (0.56%)
UPDATE: 782,004 219.97 220,640,296 (4.84%)
DELETE: 9,674 2.72 2,485,643 (0.05%)
REPLACE: 0 0.00 4,980 (0.00%)
INSERT ... SELECT: 0 0.00 0 (0.00%)
REPLACE ... SELECT: 0 0.00 0 (0.00%)
Multi UPDATE: 0 0.00 0 (0.00%)
Multi DELETE: 0 0.00 0 (0.00%)
COMMIT: 46,422 13.06 13,700,478 (0.30%)
ROLLBACK: 0 0.00 13 (0.00%)
http://ronaldbradford.com
51. MySQL Monitoring 101
MySQL Enterprise Monitor
❖ Commercial Product - $$$
❖ Developed by Sun/MySQL
http://www.mysql.com/products/enterprise/monitor.html
http://ronaldbradford.com
52. MySQL Monitoring 101
Nagios
❖ Network and Application Monitoring
❖ Open Source
http://www.nagios.org/
http://ronaldbradford.com
53. MySQL Monitoring 101
Cacti
❖ Generic Network Graphing
❖ Uses RRDtool
❖ MySQL specific templates
http://www.cacti.net/
http://code.google.com/p/mysql-cacti-templates/
http://ronaldbradford.com
56. MySQL Monitoring 101
What's missing
❖ Some Standards
❖ Active Community
❖ Integration for monitoring all stack products
❖ Application specific metrics
❖ e.g. Number of new customers per hour
❖ e.g. Total Sales for day
http://ronaldbradford.com
57. MySQL Monitoring 101
Professional Help is Available
❖ Two decades IT expertise
❖ 10 years in MySQL
❖ System/Data Architecture
❖ Database Performance and Tuning
❖ High Availability and Scalability
❖ Education and Training
http://ronaldbradford.com
http://ronaldbradford.com