Can Munin be configured to display hourly graphs?
By default, Munin (I’m using 1.4.5) shows graphs for the day, week, month, and year.
Can I configure it to additionally display an hourly graph?
Solution 1:
I assume you actually want to sample data faster than the default five minutes, because an hourly graph wouldn't show you any more detail than the current daily graph otherwise.
There's an easy answer to this and a hard one.
The Easy Way
Just run munin-update more often and don't upgrade past Munin 1.5.
On a lot of Linux systems, this just means editing /etc/cron.d/munin
and changing the first */5
to */1
(which is the same as just *
but makes it a little more obvious that you're doing it deliberately).
This is kind of a hack. Munin will still create the graphs under the assumption that it's getting data every five minutes instead of every minute, so its rate calculations might be off and some of the labels will be wrong, but you'll be getting data every minute. Also, this probably won't work in recent versions of Munin (at least past version 2.0 and possibly past version 1.5) because they have a default value of 300 for the update_rate
attribute, which is discussed more below.
The Hard Way
First, you have to upgrade to Munin 2.0. Not everything below is supported in earlier versions.
Next, you have to set the update_rate
attribute on any graphs that you want to have updated more often than every five minutes. That attribute is the number of seconds that should elapse between updates and it defaults to 300 seconds.
Next you'll need to define custom graph periods with the graph_data_size
attribute, which is documented at per plugin custom rrd sizing , but that page is a little confusing, so let me see if I can clarify things a little.
The graph_data_size
attribute has three settings:
-
graph_data_size normal
- this is the default, which generates daily, weekly, monthly, and yearly graphs. -
graph_data_size huge
- this stores data at five-minute intervals (the normal daily rate) for an entire year. -
graph_data_size custom <custom-definition>
- this allows you to specify your own data intervals and retention times.
The custom definition above is of the form full_rra_nb, multiple_1 multiple_rra_nb_1, multiple_2 multiple_rra_nb_2, ... multiple_N multiple_rra_nb_N
, with the following meanings:
- full_rra_nb is the number of data points to retain for the first graph. Each of these points represents a single measurement (more or less; Munin tries to account for delays in getting the measurements with a small amount of data fudging).
- multiple_N is the number of measured data points that are averaged to get a single data point for the Nth graph.
- multiple_rra_nb_N is the number of data points to retain for the Nth graph.
This is all affected by the update_rate
attribute setting, because it controls how much time each single measurement spans.
So, for a concrete example, the default settings are as follows:
- Data points are obtained at a rate of one measurement every five minutes.
- The daily graph has one point for each measured data point, and it keeps 576 of those points (or 48 hours' worth).
- The weekly graph has one point for every six measurements (each point represents 30 minutes), and it keeps 432 of them (or 9 days' worth).
- The monthly graph has one point for every 24 measurements (each point represents two hours), and it keeps 540 of them (or 45 days' worth).
- The yearly graph has one point for every 288 measurements (each point represents one day), and it keeps 450 of them (450 days' worth).
Thus, these two settings are equivalent:
graph_data_size normal
and
update_rate 300
graph_data_size custom 576, 6 432, 24 540, 288 450
For one-minute sampling, you'll have to decide what sorts of intervals you're interested in. To simply add an hourly graph that records data for eight hours, you could use the following:
update_rate 60
graph_data_size custom 480, 5 576, 30 432, 120 540, 1440 450
Note that in the default munin configuration each interval is an integer multiple of the preceding interval (30 = 5 * 6, 120 = 30 * 4, and 1440 = 120 * 12). I don't know how important that rule is, but I'd recommend keeping it in your configuration, just in case.
Also note that setting update_rate
and graph_data_size
is done on a per-graph basis. I don't know of any way to specify default values that cross many graphs, so if you want to do this for all of your graphs, you'll have to do a lot of typing.
Also, you should make sure all of these settings are in place before your first munin-update
run; they affect the way that the RRD files are created and I don't know how munin will react if the files are created with different settings before updates are run with these. In the worst case you can just delete the RRD files and let munin recreate them.
Finally, once all the settings are in place, you can change the cron update frequency in the same manner as "The Easy Way", above.