Stackdriver / collectd

Stackdriver's monitoring agent based on collectd (http://collectd.org).
https://cloud.google.com/monitoring/agent/
Other
51 stars 15 forks source link

Varnish Collectd Plugin on CentOS 7 fails to load. #149

Closed viable-hartman closed 5 years ago

viable-hartman commented 5 years ago

Expected behavior

I expect the plugin configured as indicated here Google Raw StackDriver Varnish Config to actually load.

Actual behavior

systemctl restart stackdriver-agent.service Job for stackdriver-agent.service failed because the control process exited with error code. See "systemctl status stackdriver-agent.service" and "journalctl -xe" for details.

journalctl -xe: May 28 23:05:10 varnish-001 collectd[31561]: plugin_load: plugin "aggregation" successfully loaded. May 28 23:05:10 varnish-001 collectd[31561]: lt_dlopen ("/opt/stackdriver/collectd/lib64/collectd/varnish.so") failed: file not found. The most common cause for this problem is missing dependencies. Use ldd(1) to check the dependencies of the plug May 28 23:05:10 varnish-001 collectd[31561]: plugin_load: Load plugin "varnish" failed with status 1. May 28 23:05:10 varnish-001 systemd[1]: stackdriver-agent.service: control process exited, code=exited status=1

ldd /opt/stackdriver/collectd/lib64/collectd/varnish.so /opt/stackdriver/collectd/lib64/collectd/varnish.so: /lib64/libvarnishapi.so.1: version `LIBVARNISHAPI_1.0' not found (required by /opt/stackdriver/collectd/lib64/collectd/varnish.so) linux-vdso.so.1 => (0x00007ffc10fdc000) libvarnishapi.so.1 => /lib64/libvarnishapi.so.1 (0x00007fac4a0d3000) libc.so.6 => /lib64/libc.so.6 (0x00007fac49d06000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fac49aa4000) librt.so.1 => /lib64/librt.so.1 (0x00007fac4989c000) libm.so.6 => /lib64/libm.so.6 (0x00007fac4959a000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fac4937e000) /lib64/ld-linux-x86-64.so.2 (0x00007fac4a502000)

However libvarnishapi.so.1 is there as a sym link to the actual library, but the compiled varnish.so library from stackdriver does not believe it's the correct version.

Steps to reproduce

viable-hartman commented 5 years ago

Just a follow up strings on the Varnish 5.2.1 api lib shows:

strings /lib64/libvarnishapi.so.1.0.6 | grep LIBVARNISHAPI LIBVARNISHAPI_2.0 LIBVARNISHAPI_2.0

...so /lib64/libvarnishapi.so.1: version `LIBVARNISHAPI_1.0' will of course fail, but the merged pull request here: https://github.com/Stackdriver/collectd/pull/134 seems to indicate this should work for 5.2, but I'm not sure how that's possible when 5.2 uses LIBVARNISHAPI_2.0 and the stackdriver agent is still looking for LIBVARNISHAPI_1.0

viable-hartman commented 5 years ago

Just another follow up, I think the issue is that your version of the stackdriver varnish.so plugin is compiled against the wrong varnish libs. I extracted the varnish.so lib from this Fedora RPM, http://download-ib01.fedoraproject.org/pub/fedora/linux/updates/29/Everything/x86_64/Packages/c/collectd-varnish-5.8.1-1.fc29.x86_64.rpm,

and it works just fine with my Varnish 5.2.1 and appears to reference the correct lib LIBVARNISHAPI_2.0

viable-hartman commented 5 years ago

I just confirmed. It looks like the varnish.so library deployed with stackdriver collectd is compiled against Varnish 3 or 4. I compiled it against Varnish 5 loaded as follows:

Add in the varnish 5 repo.

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish5/script.rpm.sh | bash

Add varnish 5 and libraries needed for collectd compile...

yum -y update \ && yum -y install varnish varnish-devel varnish-libs varnish-libs-devel varnish-modules

Compile Collectd

cd /tmp \ && git clone https://github.com/stackdriver/collectd.git \ && cd collectd/ \ && ./build.sh \ && ./configure --prefix=/opt/stackdriver/collectd --enable-varnish \ && make \ && make install \ && rm -rf /tmp/collectd \ && mv /opt/stackdriver/collectd/lib/collectd/varnish.so /root/build/varnish.so

and varnish.so is just fine. So its definitely the version of Varnish libs compiled against.

jkohen commented 5 years ago

I'm glad you were able to solve the issue. Support for Varnish in our agent has been deprecated, so we won't be updating the plugin for Varnish 5. For more details, see https://cloud.google.com/monitoring/agent/plugins/varnish