Skip to content

Instantly share code, notes, and snippets.

@standaloneSA
Created July 28, 2014 00:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save standaloneSA/e863fedf0a849bd0b8d4 to your computer and use it in GitHub Desktop.
Save standaloneSA/e863fedf0a849bd0b8d4 to your computer and use it in GitHub Desktop.
# We're going to use fpm to create the package.
# https://github.com/jordansissel/fpm
sudo gem install fpm
cd ~
# This is where we'll install the compiled collectd into
mkdir ~/collectd-package
# Get the source
wget https://collectd.org/files/collectd-5.4.1.tar.gz
# Untar it
tar zxvf collectd-5.4.1.tar.gz
cd collectd-5.4.1/
# enable debug doesn't make debug the default, it just allows it
# I also want to distribute it around, and not have a bunch of libraries need installed everywhere
# so I do --enable-static. I don't know why the perl bindings don't work without this. It seems standard.
./configure --enable-debug --enable-static --with-perl-bindings="PREFIX=/usr"
make
# The make script is not a fan of relative directory paths, so ../collectd-package/ doesn't work for me
make DESTDIR="/home/YOURUSERNAME/collectd-package" install
cd ..
mkdir -p collectd-package/etc/init.d/
# This is a customized init script that I modified. Since /opt/ is where this will live, the
# factory default init script doesn't work
wget --no-check-certificate -O collectd-package/etc/init.d/collectd https://gist.githubusercontent.com/standaloneSA/29aa32a8f7796e6c4b22/raw/99d68635660cff46364ff7e5b81de6f8aee3e6c9/collectd-init
chmod +x collectd-package/etc/init.d/collectd
# fakeroot allows fpm to set root permissions in the package when it really doesn't have root. More info here:
#### http://man.he.net/man1/fakeroot
# -C says "change directory"
# --iteration is the version of the package (not the software; that's --version). This is so that if you discover
# bugs in the packaging, you can do a --iteration 2 and upgrade things based on that.
# libltdl7 is required otherwise collectd won't work.
fakeroot fpm -t deb -C collectd-package/ --name collectd --version 5.4.1 --iteration 1 --depends libltdl7 -s dir opt/ usr/ etc/
# At this point, you should have a file named collectd_5.4.1-1.deb.
# When you go to use the write_graphite plugin, make sure to uncomment and modify the config in /opt/collectd/etc/collectd.conf.
# Here's mine:
#
#<Plugin write_graphite>
# <Node "THISHOSTNAME">
# Host "YOURGRAPHITESERVER"
# Port "2003"
# Protocol "tcp"
# LogSendErrors true
# Prefix "WHATEVER-PREFIX-IS-IN-YOUR-STORAGESCHEMAS.CONF-FILE"
# StoreRates true
# AlwaysAppendDS false
# EscapeCharacter "_"
# </Node>
#</Plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment