[rrd-developers] getting new RRA entries since last update

Frederik Kriewitz frederik at kriewitz.eu
Wed Apr 14 11:33:49 CEST 2010


On Wed, Apr 14, 2010 at 1:07 AM, Tobias Oetiker <tobi at oetiker.ch> wrote:
> Yesterday Gustav Koller wrote:
>
>> Hello,
>>
>>  my problem:
>>  I call rrd_update_r() and some RRAs are updated.
>>  How can I get all the RRA entries which were updated?
>> [...]
>
> are you using multithreaded rrdtool calls ? else the rrd_update_v
> call is what you need.

I'm working on a patch for rrdcached and had the same problem.

rrd_update_v() works but results in some ugly code including a malloc
which souldn't be necessary:

/* We need to use rrd_update_v and construct update_argv because
   rrd_update_r doesn't allow us to use the rrd_info_t * pcdp_summary
   parameter of _rrd_update() */
int update_argc = values_num + 2;
char **update_argv = (char**) malloc (update_argc * sizeof (char*));
if (update_argv == NULL)
{
  RRDD_LOG (LOG_ERR, "queue_thread_main: update_argv malloc failed.");
}
else
{
  /* construct argv rrd_update_v */
  update_argv[0] = NULL;
  update_argv[1] = file;
  for (size_t i = 0; i < values_num; i++)
    update_argv[i+2] = values[i];

  data = rrd_update_v(update_argc, update_argv);
  free(update_argv);
}

Here's rrd_update_r from rrd_update.c using a hardcoded NULL for pcdp_summary:

int rrd_update_r(const char *filename, const char *tmplt, int argc,
const char **argv)
{
    return _rrd_update(filename, tmplt, argc, argv, NULL);
}

Is there a reason why pcdp_summary can't be passed to rrd_update_r()?



More information about the rrd-developers mailing list