mikaku / Monitorix

Monitorix is a free, open source, lightweight system monitoring tool.
https://www.monitorix.org
GNU General Public License v2.0
1.12k stars 167 forks source link

Option to place net graph on the log scale #18

Closed graysky2 closed 11 years ago

graysky2 commented 11 years ago

Jodri - How can I modify monitorix to allow plots of the network graph to be on the log scale? Sometimes, my network graph gets this enormous spike it in as you can see below. Plotting on the log scale would help to even this out.

net01z 1day

mikaku commented 11 years ago

Those peaks are generated because the network internet bytes counter was reset to zero unexpectedly or even to quick. There are different causes: your (virtual) machine was rebooted too quickly, you changed the order of the interface names in the Monitorix configuration file, or the internal kernel counter was reset to zero because the driver was reinstalled, etc.

This could be fixed in the future if those values are changed from COUNTER to GAUGE in the internal structure of the .rrd file.

Answering your question, you can add the RRDtool option --logarithmic in any graph below the line RRDs::graph("$PNG_DIR" . "$PNG1",. Keep in mind that you need to remove the line --lower-limit=0 when you insert the logarithmic option.

For example, in the net.pm graph in line 412 (https://github.com/mikaku/Monitorix/blob/master/lib/net.pm#L412):

RRDs::graph("$PNG_DIR" . "$PNG1",
    "--title=$nl[$n] $nd ($tf->{nwhen}$tf->{twhen})",
    "--start=-$tf->{nwhen}$tf->{twhen}",
    "--imgformat=PNG",
    "--vertical-label=$vlabel",
    "--width=$width",
    "--height=$height",
    @riglim,
    "--lower-limit=0",             <--  remove that line
    "--logarithmic",               <--  add that line
     @{$cgi->{version12}},
     @{$colors->{graph_colors}},
[...]
);
graysky2 commented 11 years ago

How can I make that COUNTER --> GAUGE adjustment to the rrd database you mentioned? I believe that will delete the old database, but maybe that could be the default for new ones? I do tend to get these spikes pretty regularly; here is a week view: net01 1week

Thanks for the info... after switching to a log scale, the plots are not very pretty.

Log: log

Normal: normal

mikaku commented 11 years ago

How can I make that COUNTER --> GAUGE adjustment to the rrd database you mentioned?

You can do it using from the command line with the rrdtool tune command, but you must also change the way how Monitorix saves the data in the .rrd databases. Otherwise you couldn't see real data.

I believe that will delete the old database, but maybe that could be the default for new ones?

No, changing the ds-name won't delete your database.

I do tend to get these spikes pretty regularly.

You shouldn't get those spikes so regularly unless there is something wrong there. In the future I could change those values from COUNTER to GAUGE but this won't be a priority feature right now, since the COUNTER type is fine for this kind of values.