[rrd-developers] rrd_tool in pipe mode quits when wrong update information is given

William Castillo wcastillo at pictage.com
Mon Dec 19 23:25:36 MET 2005


Hi.
We are running rrdtool-1.0.50.  We noticed that when rrdtool is ran as a
pipe "Remote Control," (batch/script mode)  if there is an error in one
of the update commands
it quits rather than letting us know that an error was encountered and
will continue taking input.  This issue was not found in version 1.0.39,
however it seems
to be present on version 1.0.50.  We researched this issue and found no
bug report, so we created a patch that would fix this.  We hope that it
was placed in the 
right location, if not, please let us know. For example:

Example:
cacheatt6_traffic_in_4621.rrd contains two datasets traffic_in and
traffic_out.   "traffic_out:traffic_in 1135015231:3684229887:1094717398"

In the good example, I will send a correct update command with the right
information for that particular rrd.  In the bad example, I will send a
bad update, one which is missing,
the dataset and does not have enough values for that rrdtool.
--------------------------------------------------------
Good Example: (Ignore time stamp)
sh: rrdtool -
sh:
update /afs/pictage.com/software/common/cacti-0.8.6g-1/rra/cacheatt6_traffic_in_4621.rrd --template traffic_out:traffic_in 1135015231:3684229887:1094717398

we get a return of: OK u:0.00 s:0.01 r:187.02
----------------------------------------------------------
Bad Example: (Ignore time stamp)
sh: rrdtool -
sh:
update /afs/pictage.com/software/common/cacti-0.8.6g-1/rra/cacheatt6_traffic_in_4621.rrd --template 1135015231:3684229887

we get a return of: ERROR: Not enough arguments
and rrdtool stops the open pipe, not allowing us to send more input...
even if the rest of the input lines where correct.
--------------------------------------------------------

We patched the rrd_tool.c main() with this lines:
line 249 to 251 contain this:

249:              if (HandleInputLine(argc, myargv, stdout))
250:                  return -1;                /* If there is an error
return a -1 and exit the while loop.  If we are in the main() function,
any return would exit us from the program. */
251:              free(myargv);

with this lines:
249:               if (HandleInputLine(argc, myargv, stdout)) {
250:                 free(myargv);           /* If there is an error, it
will free myargv and continue to the beginning of the while loop to take
on another input, rather than exiting.
251:                 continue;
252:               }
253:               free(myargv);

------------------------------------------------------------
Here the is the actual patch file:

--- src/rrd_tool.c.orig 2005-12-19 11:49:14.000000000 -0800
+++ src/rrd_tool.c      2005-12-19 11:49:00.000000000 -0800
@@ -246,8 +246,10 @@
                    return -1;
                }

-               if (HandleInputLine(argc, myargv, stdout))
-                   return -1;
+               if (HandleInputLine(argc, myargv, stdout)) {
+                    free(myargv);
+                   continue;
+                }
                free(myargv);

#if HAVE_GETRUSAGE

--------------------------------------------------------------

I hope I have provided enough information and that it makes sense... I
am new to mailing lists, specially providing fixes, so please let me
know of anything I should add for the future.

Thank You.

William Castillo
Systems Administrator
Pictage, Inc.


--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-developers
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-developers mailing list