Change unit in RRD tool

I installed collectd and rrdtool as per https://wiki.openwrt.org/doc/howto/luci_app_statistics

It looks good, only the default unit for network performance is in bytesa per this screenshot:

Is it possible to change it to kilobytes or even megabytes? This would make it much easier to read.

1 Like

And on a related note, is it possible to track network usage per each client assigned a IP address via DHCP? Do I need to use a different tool for that?

You need a different tool. Possibly darkstat could suit you.

How would it make it easier? The axis autoscales in any case (I see 4.0 M there in my own system), and mainly you would see the difference in the axis tickmark label's unit. Now with B/s you see "400 k". With kB/s units and the same traffic, you would see exactly the same graph, but the text label would be "400".

It is a bit question about your own thinking of how you have used to think about your bandwidth (possibly megabits) and how that translates here.

Collectd monitors the bandwidth in bytes (straight from Linux data), so you would need to change the source code and re-compile the package.

rrdtool creates the graph from collectd data and autoscales the axis.
In principle you can tweak many things, but you can't change the basic unit.
https://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html
https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html

https://github.com/openwrt/luci/blob/master/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/interface.lua

Yes, rrdtool lets you specify units, including doing math on the data as it
arrives to convert it to your desired units, go through the rrdtool docs for
examples of how to do this.

you may have to make changes in collectd if that's what's putting the data into
the rrd databse

remember, rrd doesn't care what it's tracking, labels and units are arbitrary.
The only requirement is that you must define every value you are going to track
at database creation time (which is why it's a bad tool for per-IP tracking as
you won't know what IPs to graph at database creation time)

David Lang

I see. Thanks all for the information, but I guess it is not such an issue that I would want to tweak anything beyond changing some config file (I thought maybe the functionality just wasn't exposed via a gui).

I am trying darkstat, but I am not sure how to properly configure it, so I put my questions here: Configuring darkstat (package)