Re: getting new RRA entries since last update

Frederik Kriewitz <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <[email protected]>
On Wed, Apr 14, 2010 at 1:07 AM, Tobias Oetiker <[email protected]> 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()?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.