Reputation: 3454
I'm trying to trace the status of a line, I have two values, the signal strength 0-5 and the connection status (connected = 3, disconnected = 1), the values are read every minute and I want to keep track of a year.
Currently when there is a change in one of the two values the change in the graph is not clear, I see that a half step is almost always added, instead I would like the graph to exactly reflect the state of the values, if the power goes from 4 to 5 I would like to see it in the graph with a vertical step, without added half steps.
I did several tests following the documentation and tutorials but obviously I am missing something.
Database creation
rrdtool create db.rrd \
--step 60 \
DS:rssi:GAUGE:120:0:5 \
DS:wan_state:GAUGE:120:0:10 \
RRA:MIN:0.5:1:525960
Update
# $TS is the timestamp, 4 the signal power, 3 the wan connected
rrdtool update db.rrd -t rssi:wan_state $TS:4:3
Graphs
rrdtool_graph() {
secs=$1
span=$2
rrdtool graph graph-${span}.png \
--start=now-${secs}s --end=now \
"DEF:rssi=db.rrd:rssi:AVERAGE" \
"DEF:wan_state=db.rrd:wan_state:AVERAGE" \
"AREA:wan_state#0000FF:Internet" \
"LINE1:rssi#00FF00:Signal" \
>/dev/null
}
rrdtool_graph 3600 hour
rrdtool_graph 86400 day
rrdtool_graph 604800 week
rrdtool_graph 2629800 month
rrdtool_graph 31557600 year
Upvotes: 1
Views: 577
Reputation: 4027
You are being affected by Data Normalisation. The sample data you are storing are being adjusted by RRDTool in order to fit them into the precise time bands of the RRD. In addition, when you look at graphs over longer time periods, the samples will be averaged and rolled-up to match the pixels on your graph.
If you want to avoid this, you have a few options.
You also have the problem that your RRD is defined with a single RRA of type 'min' but you use Average in your graph calls. You should probably change this to an Average RRA, and add more RRAs for the lower-granularity graphs (else it will take a long time to build your yearly graph on the fly!)
Finally, you might like to do some clever calculations on your wan_state DS and display it instead as a coloured background, maybe green for up and red for down, instead of a number.
Upvotes: 2