Compare Current and Past Time Series Graphs in Percona Monitoring and Management (PMM)Jaime Sicam
In this short blog post, I will show you how you can compare current and past time series in Percona Monitoring and Management (PMM).
Recently, a support customer shared a graph with us that compared query throughput between today and yesterday as a confirmation that optimizing their server variables improved performance.
Do you want to compare workload between today and yesterday? This week and last week? Or this month and last month? You can do this by simply duplicating an existing data source of a graph, but add a time offset so it will render past data. You can specify past offsets in (s)econds, (m)inutes, (h)ours, (d)ays, (w)eeks and even (y)ears.
Say you want to graph query throughput from a certain time period and one day before that. To do this, select the “MySQL Overview” dashboard, and then click the header of “MySQL Questions” panel. The panel menu should appear:
Click the Edit option to edit this graph:
On the “Metrics” tab, click the Add Query button and copy the options as listed in the first data source, but change the “Legend format” as “Questions(yesterday)”:
￼Now, you’ll need to add the offset modifier right after the selector. So between, “[$interval]” and “)” and also “[5m]” and “)”, add ” offset 24h” to add offsets. For more information on selectors, you can review this link:
So, as you can see in the graph above, the query throughput is around 6.13k qps compared to yesterday’s performance of 4.42k qps (on average).
To save the changes, click the floppy disk icon located at the top of PMM, and the “Save Changes” dialog will appear. Click the Save button to save the changes.
There you have it. By duplicating data source and adding offsets to it, you can easily compare a selected time series and its past.
Do note that in this example, we’ve modified the system dashboard and so all changes made to this are overwritten when the PMM server is upgraded. To keep all of your changes, you can create your own custom dashboard and just copy the panel from the system dashboard. You can have a look at this article on the proper way of importing graphs/panels from the system dashboard.
Another thing to note is that as of this writing, the “Trends Dashboard” has this feature built-in on comparing the time series against the past day and week for CPU usage, I/O Read/Write Activity, Queries, and InnoDB Rows Read/Changed. If you need to customize this even further, you have this article to see it through.