Skip to content

Instantly share code, notes, and snippets.

@toff63
Last active March 21, 2016 21:36
Show Gist options
  • Save toff63/9f3b9f82382dcde8fafb to your computer and use it in GitHub Desktop.
Save toff63/9f3b9f82382dcde8fafb 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

FQDNLookup true
LoadPlugin syslog
<Plugin syslog>
LogLevel info
</Plugin>
LoadPlugin amqp
LoadPlugin battery
LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin entropy
LoadPlugin interface
LoadPlugin irq
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin processes
LoadPlugin rrdtool
LoadPlugin swap
LoadPlugin users
<Plugin amqp>
<Publish "name">
Host "localhost"
Port "5672"
VHost "/"
User "guest"
Password "guest"
Exchange "collectd.amq.fanout"
ExchangeType "fanout"
RoutingKey "collectd"
Persistent false
StoreRates false
ConnectionRetryDelay 0
Format "json"
</Publish>
</Plugin>
<Plugin df>
FSType rootfs
FSType sysfs
FSType proc
FSType devtmpfs
FSType devpts
FSType tmpfs
FSType fusectl
FSType cgroup
IgnoreSelected true
</Plugin>
<Plugin network>
<Server "127.0.0.1" "25826">
</Server>
</Plugin>
<Plugin rrdtool>
DataDir "/var/lib/collectd/rrd"
</Plugin>
<Include "/etc/collectd/collectd.conf.d">
Filter "*.conf"
</Include>
reporting-disabled = false
[meta]
enabled = true
dir = "/var/lib/influxdb/meta"
bind-address = ":8088"
retention-autocreate = true
election-timeout = "1s"
heartbeat-timeout = "1s"
leader-lease-timeout = "500ms"
commit-timeout = "50ms"
cluster-tracing = false
[data]
enabled = true
dir = "/var/lib/influxdb/data"
max-wal-size = 104857600 # Maximum size the WAL can reach before a flush. Defaults to 100MB.
wal-flush-interval = "10m" # Maximum time data can sit in WAL before a flush.
wal-partition-flush-delay = "2s" # The delay time between each WAL partition being flushed.
wal-dir = "/var/lib/influxdb/wal"
wal-logging-enabled = true
data-logging-enabled = true
[hinted-handoff]
enabled = true
dir = "/var/lib/influxdb/hh"
max-size = 1073741824
max-age = "168h"
retry-rate-limit = 0
retry-interval = "1s"
retry-max-interval = "1m"
purge-interval = "1h"
[cluster]
shard-writer-timeout = "5s" # The time within which a remote shard must respond to a write request.
write-timeout = "10s" # The time within which a write request must complete on the cluster.
[retention]
enabled = true
check-interval = "30m"
[shard-precreation]
enabled = true
check-interval = "10m"
advance-period = "30m"
[monitor]
store-enabled = true # Whether to record statistics internally.
store-database = "_internal" # The destination database for recorded statistics
store-interval = "10s" # The interval at which to record statistics
[admin]
enabled = true
bind-address = ":8083"
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
[http]
enabled = true
bind-address = ":8086"
auth-enabled = false
log-enabled = true
write-tracing = false
pprof-enabled = false
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
[[graphite]]
enabled = false
[collectd]
enabled = true
bind-address = "localhost:25826"
database = "collectd_db"
typesdb = "/usr/share/collectd/types.db"
[opentsdb]
enabled = false
[[udp]]
enabled = false
[continuous_queries]
log-enabled = true
enabled = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment