[collectd] Varnish plugin

Marc Fournier marc.fournier at camptocamp.com
Tue Jun 8 15:08:22 CEST 2010


> could you look for relevant information in "config.log", the file
> created by the configure script? Something like
> 
>   grep -C 10 varnish config.log

Here you are:

| #define HAVE_PTHREAD_H 1
| #define HAVE_LIBPTHREAD 1
| #define HAVE_RRD_H 1
| #define HAVE_THREADSAFE_LIBRRD 1
| #define HAVE_LIBXMMS 0
| /* end confdefs.h.  */
| #include <yajl/yajl_parse.h>
configure:43973: result: no
configure:44008: checking for yajl/yajl_parse.h
configure:44015: result: no
configure:44178: Checking for varnishapi using /usr/bin/pkg-config
configure:44224: checking varnish/varnishapi.h usability
configure:44236: gcc -c -g -O2  -I/usr/include/varnish   conftest.c >&5
configure:44242: $? = 0
configure:44246: test -z 
                         || test ! -s conftest.err
configure:44249: $? = 0
configure:44252: test -s conftest.o
configure:44255: $? = 0
configure:44265: result: yes
configure:44269: checking varnish/varnishapi.h presence
configure:44279: gcc -E  -I/usr/include/varnish   conftest.c
configure:44285: $? = 0
configure:44305: result: yes
configure:44340: checking for varnish/varnishapi.h
configure:44347: result: yes
configure:44373: checking for VSL_OpenStats in -lvarnishapi
configure:44403: gcc -o conftest -g -O2  -I/usr/include/varnish    conftest.c -lvarnishapi -lvarnishapi    >&5
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libvarnishapi.so: undefined reference to `VRE_compile'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libvarnishapi.so: undefined reference to `VRE_exec'
collect2: ld returned 1 exit status
configure:44409: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME "collectd"
| #define PACKAGE_TARNAME "collectd"
| #define PACKAGE_VERSION "4.10.0.36.g25e6243"
| #define PACKAGE_STRING "collectd 4.10.0.36.g25e6243"
| #define PACKAGE_BUGREPORT ""
--
config.status:1120: creating src/collectd.conf
config.status:1120: creating src/owniptc/Makefile
config.status:1120: creating src/libcollectdclient/Makefile
config.status:1120: creating src/libcollectdclient/libcollectdclient.pc
config.status:1120: creating src/liboconfig/Makefile
config.status:1120: creating bindings/Makefile
config.status:1120: creating bindings/java/Makefile
config.status:1224: creating src/config.h
config.status:1874: executing depfiles commands
configure:55091: configuring in libltdl
configure:55208: running /bin/sh './configure' --prefix=/opt/collectd  '--prefix' '/opt/collectd' '--disable-all-plugins' '--enable-varnish' --enable-ltdl-convenience --cache-file=/dev/null --srcdir=.
configure:55409: error: "Some plugins are missing dependencies - see the summary above for details"

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-redhat-linux-gnu
ac_cv_build_alias=x86_64-redhat-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_c_const=yes
--
ac_cv_header_sys_vfs_h=yes
ac_cv_header_sys_vfstab_h=no
ac_cv_header_sys_wait_h=yes
ac_cv_header_syslog_h=yes
ac_cv_header_tcrdb_h=no
ac_cv_header_termios_h=yes
ac_cv_header_time=yes
ac_cv_header_unistd_h=yes
ac_cv_header_utmp_h=yes
ac_cv_header_utmpx_h=yes
ac_cv_header_varnish_varnishapi_h=yes
ac_cv_header_vm_anon_h=no
ac_cv_header_wordexp_h=yes
ac_cv_header_xfs_xqm_h=no
ac_cv_header_yajl_yajl_parse_h=no
ac_cv_host=x86_64-redhat-linux-gnu
ac_cv_host_alias=x86_64-redhat-linux-gnu
ac_cv_lib_IOKit_IOServiceGetMatchingServices=no
ac_cv_lib_curl_curl_easy_init=yes
ac_cv_lib_dl_dlopen=yes
ac_cv_lib_dld_shl_load=no
--
ac_cv_lib_kvm_kvm_getprocs=no   
ac_cv_lib_kvm_kvm_getswapinfo=no
ac_cv_lib_kvm_kvm_nlist=no
ac_cv_lib_kvm_kvm_openfiles=no  
ac_cv_lib_oconfig_oconfig_parse_fh=no
ac_cv_lib_pcap_pcap_open_live=no
ac_cv_lib_pthread_pthread_create=yes
ac_cv_lib_resolv_res_search=no  
ac_cv_lib_rrd_th_rrd_update_r=yes
ac_cv_lib_rrd_th_rrdc_update=no 
ac_cv_lib_varnishapi_VSL_OpenStats=no
ac_cv_lib_xml2_xmlXPathEval=yes 
ac_cv_member_kstat_io_t_nwrites=no
ac_cv_member_kstat_io_t_nwritten=no
ac_cv_member_kstat_io_t_writes=no
ac_cv_member_kstat_io_t_wtime=no
ac_cv_member_struct_if_data_ifi_ibytes=no
ac_cv_member_struct_if_data_ifi_ierrors=no
ac_cv_member_struct_if_data_ifi_opackets=no
ac_cv_member_struct_ip_mreqn_imr_ifindex=yes
ac_cv_member_struct_kinfo_proc_ki_pid=no



> > /usr/lib64/libvarnish.so
> > /usr/lib64/libvarnishapi.so
> > /usr/lib64/libvarnishcompat.so
> 
> Also, an "ldd" of each of those files would be interesting for the RHEL
> box. On Debian Squeeze I know it's broken :/

/usr/lib64/libvarnish.so:
        librt.so.1 => /lib64/librt.so.1 (0x0000003ebce00000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003ebe200000)
        libm.so.6 => /lib64/libm.so.6 (0x0000003ebbe00000)
        libpcre.so.0 => /lib64/libpcre.so.0 (0x00000034f9a00000)
        libc.so.6 => /lib64/libc.so.6 (0x0000003ebb200000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003ebca00000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003ebae00000)
/usr/lib64/libvarnishapi.so:
        libc.so.6 => /lib64/libc.so.6 (0x0000003ebb200000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003ebae00000)
/usr/lib64/libvarnishcompat.so:
        libc.so.6 => /lib64/libc.so.6 (0x0000003ebb200000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003ebae00000)


Please note that these files come from an "unofficial" RPM of the latest
varnish 2.1 release (http://users.linpro.no/ingvar/varnish/).

I also tried using varnish 2.0 (previous release) instead, with packages
built by the fedora folks
(http://download.fedora.redhat.com/pub/epel/5/x86_64/repoview/varnish.html)
and the configure script works fine on commit 25e6243a.

As debian squeeze ships varnish 2.1 too, I'm wondering if the problem
wouldn't be in varnish 2.1 itself, not in the way the distros package
varnish ?


> To work around these problems, do the following:
> 
>   - Create the required symlinks by hand:
>   
>     /usr/lib # ln -s libvarnish.so.1 libvarnish.so
>     /usr/lib # ln -s libvarnishapi.so.1 libvarnish.so

You probably ment:
      /usr/lib # ln -s libvarnishapi.so.1 libvarnishapi.so

I suppose this must also be followed by a "ldconfig" run ?

>   - Add the .pc file to include the required libraries. Under Debian,
>     edit /usr/lib/pkgconfig/varnishapi.pc so that the "Libs:" line
>     reads:
> 
>     Libs: -L${libdir} -lvarnishapi -lvarnish -lpcre

To summarize my various attempts:

On the redhat 5.5 box:

 - the symlinks were already present
 - I modified varnishapi.pc as suggested
 - and run into the next problem:

configure:44347: result: yes
configure:44373: checking for VSL_OpenStats in -lvarnishapi
configure:44403: gcc -o conftest -g -O0  -I/usr/include/varnish    conftest.c -lvarnishapi -lvarnishapi -lvarnish -lpcre    >&5
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libvarnish.so: undefined reference to `strlcpy'
collect2: ld returned 1 exit status
configure:44409: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "collectd"
| #define PACKAGE_TARNAME "collectd"
| #define PACKAGE_VERSION "4.10.0.36.g25e6243"
| #define PACKAGE_STRING "collectd 4.10.0.36.g25e6243"
| #define PACKAGE_BUGREPORT ""

On the debian squeeze box:

 - I added the symlinks & run ldconfig
 - I modified varnishapi.pc as suggested
 - and run into the same problem (undefined reference to `strlcpy')
 - so I installed libbsd0 and libbsd-dev and edited varnishapi.pc to read
   "-lvarnishapi -lvarnish -lpcre -lbsd"
 - and success: collectd builds !
 - ...but I have the feeling this problem isn't going in the right
   direction (libbsd doesn't exist on redhat for example)...

readelf shows that /usr/lib/libvarnish.so has a reference to strlcpy but
/usr/lib/libvarnishapi.so doesn't. Maybe adding -lvarnish finally isn't a
good idea ? My knowledge of how all these librairies hook themselves
together is unfortunately only quite vague...

Anyway, thanks for your help so far !

Marc

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


More information about the collectd mailing list