lloydsla.de random hacks and pointless shenanigans

InfluxDB + Grafana with netdata

If you’re using the excellent netdata for server monitoring and want to stick the data in a database for long-term storage and pretty graphs, this generally works. If you’re feeling fancy, you can set up retention policies in InfluxDB – this post assumes you’ve already got a working InfluxDB + Grafana stack set up somewhere. Kudos to this blog post, which is referenced by the netdata documentation.

Add this section to your netdata.conf file, replacing $INFLUXDB with a more relevant IP address:

        host tags = $TAG
        enabled = yes
        data source = average
        type = opentsdb
        destination = tcp:$INFLUXDB:$PORT
        prefix = $PREFIX
        hostname = $HOSTNAME
        update every = 10
        buffer on failures = 10
        timeout ms = 20000
        # send names instead of ids = yes
        # send charts matching = *

Over on your InfluxDB server, make a database for all this data to end up in, and make sure you’ve got an OpenTSDB listening service in influx.conf:

  enabled = true
  bind-address = ":$PORT"
  database = "opentsdb"

Once you’ve restarted both services, netdata should be happily filling your InfluxDB server with data. You can grab an example Grafana dashboard in JSON format here – just be sure to replace $PREFIX with the prefix you set in the netdata config file, and $HOSTNAME with the hostname. It should start showing data immediately.