Fotolia / collectd-mod-haproxy

Haproxy module for collectd
17 stars 12 forks source link

Unable to build the source #4

Open saurabhnanda opened 3 years ago

saurabhnanda commented 3 years ago

Does this plugin work with any specific version of collectd?

Error:

root@ca151d987f52:~/collectd-mod-haproxy# make
cc -DHAVE_CONFIG_H -I/usr/include/collectd/  -Wall -Werror -g -O2 -c haproxy.c  -fPIC -DPIC -o haproxy.o
haproxy.c:29:10: fatal error: collectd.h: No such file or directory
 #include "collectd.h"
          ^~~~~~~~~~~~
compilation terminated.
Makefile:8: recipe for target 'bin' failed
make: *** [bin] Error 1

The file is there, but probably in a different location:

root@ca151d987f52:/usr/lib# find /usr -iname 'collectd.h'
/usr/include/collectd/core/daemon/collectd.h

Ubuntu version:

root@ca151d987f52:~# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"

collectd version:

root@ca151d987f52:~# apt-cache show collectd
Package: collectd
Architecture: amd64
Version: 5.7.2-2ubuntu1.2

collectd-dev version:

root@ca151d987f52:~# apt-cache show collectd-dev    
Package: collectd-dev
Architecture: all
Version: 5.7.2-2ubuntu1.2

Haproxy version (if it matters):

root@ca151d987f52:~# haproxy --version
HA-Proxy version 1.8.8-1ubuntu0.11 2020/06/22
saurabhnanda commented 3 years ago

I've gotten this to compile by making the following changes, but since I'm not a C programmer, I'm a little skeptical or running the resulting .so file in production. Is it safe?

#include "collectd/core/daemon/collectd.h"
#include "collectd/core/daemon/common.h"
#include "collectd/core/daemon/plugin.h"
#include "collectd/core/daemon/configfile.h"