[collectd] [patch] WriteHttp plugin StoreRates config option

Sebastian Harl sh at tokkee.org
Wed Feb 17 00:20:12 CET 2010


Hi Paul,

On Sun, Feb 14, 2010 at 10:36:18PM -0700, Paul Sadauskas wrote:
> I've added a "StoreRates" option to the write_http plugin, similar to
> how it works in the csv plugin. I've attached the patch, or there's
> this branch on github, which should merge cleanly with 4.9.

Thanks for your patch!

Since Florian is offline for a few days, I've put your patch into the
sh/next branch in git.tokkee.org/collectd.git, ready to be merged into
Florian's master whenever he's back.

See two quick comments below.

> @@ -142,7 +143,7 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */
>                  ssnprintf (cb->credentials, credentials_size, "%s:%s",
>                                  cb->user, (cb->pass == NULL) ? "" : cb->pass);
>                  curl_easy_setopt (cb->curl, CURLOPT_USERPWD, cb->credentials);
> -                curl_easy_setopt (cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
> +                curl_easy_setopt (cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
>          }
>  
>          curl_easy_setopt (cb->curl, CURLOPT_SSL_VERIFYPEER, cb->verify_peer);

This hunk is already available in collectd-4.8 and will be merged into
4.9 and master soonish. I've, thus, removed it from your patch.

> @@ -299,7 +302,22 @@ static int wh_value_list_to_string (char *buffer, /* {{{ */
>          if (ds->ds[i].type == DS_TYPE_GAUGE)
>                  BUFFER_ADD (":%f", vl->values[i].gauge);
>          else if (ds->ds[i].type == DS_TYPE_COUNTER)
> -                BUFFER_ADD (":%llu", vl->values[i].counter);
> +        {
> +                if (cb->store_rates != 0) 
> +                {
> +			if (rates == NULL)
> +				rates = uc_get_rate (ds, vl);

The memory returned by uc_get_rate() has to be freed by the caller. I've
fixed that in sh/next as well.

Cheers,
Sebastian

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20100217/fe52cf8a/attachment.pgp 


More information about the collectd mailing list