0

I have some complex expression for rrdtool graph that is built by a script. I also think this once worked, but since then I upgraded rrdtool. Unfortunately the only output I get is ERROR: RPN final stack size != 1.

Is there a way to get some better diagnostics, (e.g. trace or dump rrdtool's stack)?

U. Windl
  • 3,480
  • 26
  • 54
  • Eventually I found the cause of the problem (inspired by http://forums.cacti.net/post-78489.html), but still do not how to debug it in a better way: It seems one of my `CDEF`s was incorrect. Instead of `CDEF:S=P0,P1,P22,P23,'+','+','+'` I had written `CDEF:S=P0,P1,P22,P23,'+'`. – U. Windl Apr 20 '17 at 11:48
  • I'm afraid there is not much more to say than that the stack must contain a single value after your RPN expression has been processed ... as to why you did not process all elements of the stack, that is something the program can not advise you on ... – Tobi Oetiker Apr 20 '17 at 13:08
  • @Tobi Oetiker: If rrdtool would print the items on the stack (plus maybe the number of items) one would get at least some hint where to look for the error. Some diagnostic option would be really useful. The tool does not have to explain why I made an error, but simply which error I made. – U. Windl Apr 21 '17 at 06:28
  • yes, the debug output could certainly be fancied up ... if you are inclined to help with that, by all means ... checkout master and send a PR ... if you have questions on how to implement, just ask! – Tobi Oetiker Apr 24 '17 at 10:11

1 Answers1

0

This error message indicates an error in your RPN; usually, this will be CDEF.

When the RPN is fully processed, there should be exactly one item in the stack; if you get more or less then you'll see this error.

The best way to verify is to simple run through the RPN process by hand on paper for one sample data set; if you have an error then it will become clear. There is no debug option to the RRDTool processor that will provide a step-by-step debug on the RPN, as this would be run for every datapoint in the set, generating a huge log.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
  • Yes the formulas will be applied for every data point, but if there is an error in the formula rrdtool quits anyway, so the debug output would be short. Guess your C compiler just says "syntax error" and you are suggested to check your program with the C grammar on paper ;-) – U. Windl Apr 21 '17 at 06:24
  • I agree that an analysis of errors, and detailed debug output of RPN, would be helpful; however RRDTool does not currently provide this, and the answer was intended to indicate what is possible *now* rather than in the future. – Steve Shipway Apr 22 '17 at 06:56