Discussion:
[rrd-users] Graph NaN Values
(too old to reply)
Manzke, Udo
2015-11-23 13:17:24 UTC
Permalink
Hi,

i store response time in a rrd. Sometimes there are NaN because of a timeout. Graphing the responsetime producing a break of the line. Instead of the break there should be displayed the timeout value. I tried to solve this with the following configuration:

rrdtool graph /tmp/icmp.png \
--title="ICMP Response Time" \
--vertical-label="Seconds" \
DEF:rtMills=/icmp.rrd:icmp:AVERAGE \
DEF:minRtMills=/icmp.rrd:icmp:MIN \
DEF:maxRtMills=/icmp.rrd:icmp:MAX \
CDEF:rt=rtMills,1000,/ \
CDEF:minRt=minRtMills,1000,/ \
CDEF:maxRt=maxRtMills,1000,/ \
CDEF:unknownpos=rt,UN,INF,UNKN,IF,/ \
CDEF:unknownneg=rt,UN,NEGINF,UNKN,IF,/ \
AREA:unknownpos#0000ff \
AREA:unknownneg#0000ff \
LINE1:rt#0000ff:"Response Time" \
GPRINT:rt:AVERAGE:" Avg \\: %8.2lf %s" \
GPRINT:rt:MIN:"Min \\: %8.2lf %s" \
GPRINT:rt:MAX:"Max \\: %8.2lf %s\\n"

Result is an Error: "RPN Stack Underflow". Do anyone know what's wrong?

Sincerely,
Udo
Simon Hobson
2015-11-23 16:13:14 UTC
Permalink
Result is an Error: “RPN Stack Underflow”. Do anyone know what’s wrong?
DEF:rtMills=/icmp.rrd:icmp:AVERAGE \
CDEF:rt=rtMills,1000,/ \
CDEF:unknownpos=rt,UN,INF,UNKN,IF,/ \

OK, lets break that down.

rt -> puts rt on the stack

UN -> take rt off the stack and leaves true or false depending on whether it's unknown or not

INF, UNKN -> puts INF and UNKN values on the stack. Stack now holds [true|false],INF,UNKN

IF -> takes 3 items off the stack, sees the true or false left by the UN operator, and selects either INF or UNKN which it puts on the stack. Stack now holds [INF|UNKN] - if rt was unknown then the stack holds INF, else it holds UNKN. I assume you actually wanted rt here so your line needs to have "INF,rt,IF"

/ -> takes two items off the stack. Oh dear, there was only one item there -> stack underflow. So either remove the "/" or add something to divide by. Perhaps you intended to combine the two lines, in which case you'd have had "rtMills,UN,INF,rtMills,IF,1000,/" or "rtMills,UN,INF,rtMills,1000,/,IF" - the two are equivalent as long as INF divided by 1000 is still INF (which I'd expect it to be).


I don't think INF is likely to be what you want, (according to the docs) it draws a line along the top of the graph which (depending on the data) may or may not be readily distinguishable from steady data - it wouldn't be how I'd want to draw it anyway. Personally I'd just accept the gaps in the graph which (IMO) is more meaningful - for ping, no response is indistinguishable from "response outside the timeout window".
Manzke, Udo
2015-11-24 08:29:36 UTC
Permalink
Hi Simon,

thanks for your help. Without / it works fine.
I don't think INF is likely to be what you want, (according to the docs) it draws a line along the top of the graph which (depending on the data) may or may not be readily distinguishable >from steady data - it wouldn't be how I'd want to draw it anyway. Personally I'd just accept the gaps in the graph which (IMO) is more meaningful - for ping, no response is indistinguishable >from "response outside the timeout window".
Your right, this was an example i found but didn't worked. I think the best is to set if there is NaN display timeoutvalue and if there is a value display 0. Using the colour red it is clear that this is no real value.

CDEF:unknownpos=rt,UN,timeout,0,IF, \
LINE1:unknownpos#ff0000:"Timeout Reached" \

Udo

Loading...