Skip to content

Instantly share code, notes, and snippets.

@oprietop
Last active June 16, 2021 13:26
Show Gist options
  • Save oprietop/bbc7651dd93f5afe64f4793e6169da07 to your computer and use it in GitHub Desktop.
Save oprietop/bbc7651dd93f5afe64f4793e6169da07 to your computer and use it in GitHub Desktop.
Compiling an old collectd version with the apachelog plugin and other patches
#!/usr/bin/bash
# Used inside a centos:8 container:
# docker run -it --rm -v $(pwd):/mnt -w /mnt centos:8 bash
set -e
set -x
# Fix locales
dnf install -y glibc-langpack-en
# Install dev tools
dnf group install -y "Development Tools"
# Other toolchain requirements
dnf install -y libtool-ltdl-devel.x86_64 libgcrypt-devel.x86_64 glib2-devel.x86_64 perl-devel.x86_64 git.x86_64
# Collectd requirement
dnf install -y krb5-libs openssl zlib wget
mkdir -p /opt/collectd/lib
mkdir -p build
cd build
# oracle client
wget http://dit.globus-telecom.com/dist/oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
wget http://dit.globus-telecom.com/dist/oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
dnf install -y oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm libnsl
mkdir /usr/lib/oracle/11.2/client64/rdbms
ln -s /usr/include/oracle/11.2/client64 /usr/lib/oracle/11.2/client64/rdbms/public
# java jdk
wget https://packages.baidu.com/app/jdk-8/jdk-8u5-linux-x64.tar.gz
tar xvf jdk-8u5-linux-x64.tar.gz
mkdir -p /opt/collectd
mv jdk1.8.0_05 /opt/collectd/jre
# liboping
git clone git://github.com/octo/liboping.git
cd liboping
git checkout liboping-1.6.2
autoreconf --warnings=all --install
./configure
make CFLAGS="-Wno-error"
cp -r ./src/.libs/liboping.so* /opt/collectd/lib/
cd ..
# libcurl
git clone https://github.com/curl/curl.git
cd curl
git checkout curl-7_35_0
./buildconf
./configure
make CFLAGS="-Wno-error"
cp -r ./lib/.libs/libcurl.so* /opt/collectd/lib/
cd ..
# libyajl
dnf install -y cmake libarchive
git clone https://github.com/lloyd/yajl.git
cd yajl
git checkout 2.0.4
mkdir build
cd build/
cmake ..
make
cp -r yajl-2.0.4/lib/libyajl.so* /opt/collectd/lib/
cd ../..
# Collectd
git clone https://github.com/collectd/collectd.git
cd collectd
git config --global user.email "[email protected]"
git checkout collectd-5.4.1
# Creacion de un plugin especifico para parseo de logs de apache incluso con herramienta apachelog. https://github.com/collectd/collectd/pull/576
git pull --no-edit origin pull/576/head
# Mejora en separacion niveles graphite. https://github.com/collectd/collectd/pull/577
git pull --no-edit origin pull/577/head
# Renombrado de plugins para organizar metricas por producto/tecnologia. https://github.com/collectd/collectd/pull/585
git pull --no-edit origin pull/585/head
# CPU https://github.com/collectd/collectd/pull/639
git pull --no-edit origin pull/639/head
# Soporte de Collectd para entornos con balanceo de carga. https://github.com/collectd/collectd/pull/846
git pull --no-edit origin pull/846/head
# Apache https://github.com/collectd/collectd/pull/846
git cherry-pick --no-commit -X theirs 5f2f969335757f31f42cd8bb7e38eb8c5fe5e56
sh build.sh
export JAVA_HOME=/opt/collectd/jre
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib/
export CFLAGS="-g -O0"
./configure --prefix=/opt/collectd --enable-debug --disable-python --enable-oracle --with-java=$JAVA_HOME --with-oracle=$ORACLE_HOME --disable-md --enable-apachelog
make CFLAGS="-Wno-error"
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment