[collectd] 4.5.0 on solaris with gcc and the postgresql plugin

Sebastian Harl sh at tokkee.org
Tue Oct 14 11:58:40 CEST 2008


Hi Admin,

On Tue, Oct 14, 2008 at 02:47:17PM +1030, Admin wrote:
> Here are a few things I've come across with regards to running 4.5.0 on 
> solaris

Thanks a lot for you comments and the detailed information!

> Building with gcc fails for two reasons.
> The first is that gcc will throw pragma errors during compilation (as it does 
> with most builds on solaris), and the AM_CFLAGS setting (-Wall -Werror) 
> causes the build to fail. Fixed by changing this to -Werror only

Hrm, this is unfortunate and I would not like to see this included in
the collectd distribution. What kind of errors do you get? Is there some
other way to fix / work around this?

> Any reference to networking headers (specifically sys/strft.h which most of 
> them include) will cause building with gcc to fail with an error like the 
> following
[...]
> /usr/include/sys/strft.h:112:4: attempt to use poisoned "sprintf"
[...]
> Fixed by surrounding the offending include with the DONT_POISON_SPRINTF_YET 
> trick from the perl plugin. I don't know if this is the correct fix but it 
> works.

This is not nice, but I guess, it's the only way to work around that.

> The postgresql plugin is missing a couple of PQclear() calls
> 
> --- src/postgresql.c.orig       2008-10-13 15:10:21.648228533 +1030
> +++ src/postgresql.c    2008-10-13 17:26:08.884228200 +1030
> @@ -417,8 +417,10 @@
>         }
>  
>         rows = PQntuples (res);
> -       if (1 > rows)
> +       if (1 > rows) {
> +               PQclear (res);
>                 return 0;
> +       }
>  
>         cols = PQnfields (res);
>         if (query->cols_num != cols) {
> @@ -442,6 +444,7 @@
>                                 submit_gauge (db, col.type, col.type_instance, 
> value);
>                 }
>         }
> +       PQclear (res);
>         return 0;
>  } /* c_psql_exec_query */

Signed-off-by: Sebastian Harl <sh at tokkee.org>

[...]
> After the kstat change message and the notification of the new successful 
> database connections being made, the old connections are still open. So every 
> 2 to 5 minutes or so the daemon makes (in this case) an additional 5 
> connections to the database.

This is a bug in the postgresql plugin. I will provide a patch later on.

> Also on the subject of the postgresql plugin, would it be possible to make it 
> an option as to whether the connections to the database are persistent or 
> not?

What would be the benefit of that? Of course, that would be possible but
I don't currently know how much code changes that would require.

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: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20081014/e369b714/attachment.pgp 


More information about the collectd mailing list