Visualize Your Data With Grafana
Percona Live 2017
Daniel Lee - Software Engineer at Grafana Labs
Daniel Lee
● Software Engineer at Grafana Labs
● Stockholm, Sweden
● @danlimerick on Twitter
What is Grafana?
Grafana
The Grafana Project
- First release on January, 2014.
- Apache License
- 17800 Stars on GitHub
- > 3000 forks
Grafana Installations - the last 400 days
Agenda
1. Introduction to Grafana
2. Introduction to Monitoring
3. Monitoring MySQL
4. Application Metrics
5. The new MySQL data source for Grafana
Timeseries Definition
A time series is a sequence of values in time order.
Most commonly the sequence is taken at evenly spaced points in time.
Timeseries Are Everywhere
Logs Can Be Timeseries
Battlefield Stats
Aggregations
- Aggregations over time
- Summarize functions
- Sum, max, min, count, avg, percentiles
- Can visualize the data from different angles
Timeseries Value Types
● Gauges
● Counters
● Timers
Timeseries Databases
- Not really relational data
- More efficient at storing timeseries data
- Better at querying timeseries data
Grafana Dashboards
Graph Panel
Graph Panel - Display Options
~40 Published Data Sources
And many more...
Query Editors - Prometheus
Query Editors - Graphite
Query Editors - InfluxDB
Alerting
Ready Made Dashboards
GrafanaCloud
Monitoring
“observe and check the progress or quality of (something) over a period of time;
keep under systematic review.”
or
What’s broken, and why?
Observability
- A culture of being data-driven/data-informed
- Whitebox monitoring
- Application metrics
- Something you have to build into your system
Whitebox Monitoring
1. Know when stuff fails
2. Be able to debug why it failed
3. Future trends
- Detect future problems
- capacity planning
Know when stuff fails
Monitor symptoms. Not causes.
- Throughput (Rate)
- number of errors (Errors)
- Performance (Duration
Based on:
- Googles’ Four Golden Signals
- R.E.D
Monitoring MySQL - Metrics to alert on
Depends on your context.
Some examples:
- Connections
- Query Latency/Run Time
- Query Errors
- Slow Queries
Monitoring MySQL - querying for metrics
- INFORMATION_SCHEMA
- PERFORMANCE_SCHEMA
- Counters:
select
lower(variable_name) as variable_name,
variable_value from global_status
where variable_name = 'slow_queries' or variable_name = 'max_used_connections'
Monitoring MySQL
1. Collect data
2. Write to a Timeseries database
3. Visualize in Grafana
4. Add alert rules
Collector/Timeseries DB Combinations
1. CollectD + Graphite
2. Telegraf + InfluxDB
3. Node Exporter + Prometheus
4. Lots of other combinations
Where to find out more
Prometheus
- mysqld_exporter
- Roman Vynars’ presentations at PerconaLive and Promcon
InfluxDB
- Telegraf MySQL Input plugin
CollectD
- MySQL plugin
- DBI plugin
An Example: Monitoring MySQL for GrafanaCloud
Alert Query for Connections
Alert Condition for Connections
Triggered Alert
Trends - Last 30 Days
Application Metrics
- Measure the user experience
- Communicate with Graphs and Metrics
The MySQL Data Source
Demo
Demo Fail Backup - Create Table
Demo Fail Backup - Query
Demo Fail Backup - Query Zoomed In
Demo Fail Backup - Template Variable
Demo Fail Backup - Graph
Demo Fail Backup - Timeshifted 1 Week
Recommended Talks
- GrafanaCon 2016: Brian Brazil, Monitoring What Matters
- PromCon 2016: Roman Vynar, Graphing MySQL Performance with
Prometheus and Grafana
- Monitorama 2016: Torkel Ödegaard - Grafana Masterclass
- Grafana Screencasts by Torkel Ödegaard on docs.grafana.org
But wait there’s more
Grafana 5.0 coming soon:
- Postgres Data Source
- Dashboard Folders
- Dashboard permissions
- Elasticsearch Alerting
- Cloudwatch Alerting
- New Dashboard layout engine
Dashboard Folders
New Dashboard Layout Engine
Q&A
- Get Grafana - grafana.com
- GrafanaCloud: https://grafana.com/cloud/grafana
- Play Site: http://play.grafana.org
- github.com/grafana/grafana
- @grafana
- @danlimerick