Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save diegopacheco/76718a04494815698407 to your computer and use it in GitHub Desktop.
Save diegopacheco/76718a04494815698407 to your computer and use it in GitHub Desktop.

Install collectd on Ubuntu 14.04

curl http://pkg.ci.collectd.org/pubkey.asc | sudo apt-key add -
sudo bash -c  'echo "deb http://pkg.ci.collectd.org/deb/ trusty collectd-5.5" > /etc/apt/sources.list.d/collectd-ci.list'
sudo apt-get update
sudo apt-get install collectd # This should install collectd version 5.5.x

Install Influxdb on Ubuntu 14.04

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add - source /etc/lsb-release echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list sudo apt-get update && sudo apt-get install influxdb sudo service influxdb start curl -G localhost:8086/query --data-urlencode "q=CREATE DATABASE collectd_db"

Enable collectd input for influxdb

Edit /etc/influxdb/influxdb.conf collectd section part with the following:

[collectd]
  enabled = true
  bind-address = "localhost:25826"
  database = "collectd_db"
  typesdb = "/usr/share/collectd/types.db"

Have collectd sending data to influxdb

Edit /etc/collectd/collectd.conf to enable the Network plugin uncommenting the line

LoadPlugin network

and add the following network plugin config

<Plugin network>
        <Server "127.0.0.1" "25826">
        </Server>
</Plugin>

Restart influxdb and collectd:

sudo service influxdb restart
sudo service collectd restart

You should be able to find new series in collectd_db in influxdb admin page

@diegopacheco
Copy link
Author

cat /etc/influxdb/influxdb.conf

###
### [collectd]
###
### Controls the listener for collectd data.
###
[collectd]
  enabled = true
  bind-address = "127.0.0.1:25826"
  database = "collectd_db"
  typesdb =  "/usr/share/collectd/types.db"

@diegopacheco
Copy link
Author

sudo cat /opt/collectd/etc/collectd.conf

#
# Config file for collectd(1).
# Please read collectd.conf(5) for a list of options.
# http://collectd.org/
#

##############################################################################
# Global                                                                     #
#----------------------------------------------------------------------------#
# Global settings for the daemon.                                            #
##############################################################################

Hostname    "localhost"
FQDNLookup   true
BaseDir     "/var/lib/collectd"
PIDFile     "/var/run/collectd.pid"
PluginDir   "/usr/lib/collectd/"
TypesDB     "/usr/share/collectd/types.db"

#----------------------------------------------------------------------------#
# When enabled, plugins are loaded automatically with the default options    #
# when an appropriate <Plugin ...> block is encountered.                     #
# Disabled by default.                                                       #
#----------------------------------------------------------------------------#
#AutoLoadPlugin false

#----------------------------------------------------------------------------#
# When enabled, internal statistics are collected, using "collectd" as the   #
# plugin name.                                                               #
# Disabled by default.                                                       #
#----------------------------------------------------------------------------#
#CollectInternalStats false

#----------------------------------------------------------------------------#
# Interval at which to query values. This may be overwritten on a per-plugin #
# base by using the 'Interval' option of the LoadPlugin block:               #
#   <LoadPlugin foo>                                                         #
#       Interval 60                                                          #
#   </LoadPlugin>                                                            #
#----------------------------------------------------------------------------#
Interval     5

#MaxReadInterval 86400
#Timeout         2
#ReadThreads     5
#WriteThreads    5

# Limit the size of the write queue. Default is no limit. Setting up a limit is
# recommended for servers handling a high volume of traffic.
#WriteQueueLimitHigh 1000000
#WriteQueueLimitLow   800000

##############################################################################
# Logging                                                                    #
#----------------------------------------------------------------------------#
# Plugins which provide logging functions should be loaded first, so log     #
# messages generated when loading or configuring other plugins can be        #
# accessed.                                                                  #
##############################################################################

LoadPlugin syslog
LoadPlugin logfile
##LoadPlugin log_logstash

<Plugin logfile>
    LogLevel info
    File STDOUT
    Timestamp true
    PrintSeverity false
        File "/var/log/collectd.log"
        Timestamp true
</Plugin>

#<Plugin log_logstash>
#   LogLevel info
#   File "${prefix}/var/log/collectd.json.log"
#</Plugin>

<Plugin syslog>
    LogLevel info
</Plugin>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment