Wednesday, July 20, 2016

Telegraf, InfluxDB and Grafana on Armbian (OrangePi )

InfluxDB and Grafana

Here we will describe how to install Telegraf, InfluxDB, and Grafana on an Orange Pi computer running Armbian.

InfluxData  provides a suite of applications supporting Data collection (Telegraf), Time series Data storage, (InfluxDB) Data processing and alerting (Kapacitor), and Visualization (Chronograf)

Armbian supports installation of Debian and Ubuntu images for installation on a number of ARM based computers. For example Orange Pi, Banana Pi and a number of other similar devices.
The installation procedure below

Grafana is a Dashboard that can receive data from InfluxDB as well as other sources as Graphite and present it as graphs.

Typically Telegraf, Grafana and InfluxDB are installed on one computer. For other computers that are to be monitored only, only Telegraf installation is needed.

InfluxDB from Debian Repo

InfluxDB suppports a Debian repository including an armhf  package. A slightly modified procedure is shown below.


curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "7" && sudo echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "8" && sudo echo "deb https://repos.influxdata.com/debian jessie stable" | sudo  tee  /etc/apt/sources.list.d/influxdb.list

sudo apt-get update && sudo apt-get install influxdb telegraf

Grafana

It seems there is no Debian repository of  Grafana in Wheezy or Jessie. There is however support in 'stretch', the new Debian version.

sudo echo "deb https://repos.influxdata.com/debian stretch main  contrib non-free" | sudo  tee  /etc/apt/sources.list.d/grafana.list

sudo apt-get install grafana


Verification

Check that these are "active running":

sudo systemctl status influxdb.service
sudo systemctl status telegraf.service
sudo systemctl status grafana.service

These are my installed versions

anders@orangepi1:~$ dpkg -l | egrep -e "influx|telegraf|grafana"
ii  grafana             2.6.0+dfsg-3   armhf   feature rich metrics dashboard and graph editor
ii  grafana-data    2.6.0+dfsg-3    all       feature rich metrics dashboard and graph editor - data files
ii  influxdb           0.13.0-1      armhf     Distributed time-series database.

ii  telegraf            0.13.1-1       armhf   Plugin-driven server agent for reporting metrics into InfluxDB.


Configuration

Configuration is mostly left as an exercise for the reader. There ares several guides out there. 

Telegraf should be sufficiently configured by using the default configuration. When connfiguring on the monitored computer, change InfluxDB configuration from localhost to the remote IP or name of the computer on which InfluxDB is installed.

 vi /etc/telegraf/telegraf.conf 


InfluxDB configuration should be satisfactory wirh the default for many cases

vi /etc/influxdb/influxdb.conf

Grafana is available using a browser at port 3000:
e.g http://orangepi1:3000/

Add InfluxDB as Datasource

4 comments:

  1. the version of grafana contained in the repo is pretty shitty ,
    there is a bug preventing the display of icons when you run a headless version of the os (Orangepi zero)
    the version is fonctional , but barely usable
    i'm curently trying to compile the sourcecode from github

    ReplyDelete
  2. Anything new regarding this? Could you maybe extend this blog post with logging data to RAM and flushing to InfluxDB in regular intervals?

    ReplyDelete
  3. Hello, you can monitor SoC temp adding extra lines to /etc/telegraf/telegraf.conf

    [[inputs.exec]]
    commands = ["cat /sys/devices/virtual/thermal/thermal_zone0/temp"]
    name_override = "soc_temp"
    data_format = "value"
    data_type = "integer"


    I tested it on Orange Pi Zero - Armbian 5.38 Ubuntu
    You have to divide by 1000 to get the temp value in Celsius

    ReplyDelete