Skip to content

Latest commit

 

History

History
 
 

Extra

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

InfluxDB/Telegraf/Grafana Using Docker


There are many options for setting up a new TSDB/Collector/Visualization stack, one of which is using existing supported Docker images.

Quick Start

  1. Select a desired host (<dockerhost>), such as any of the common Linux distributions.
  2. Ensure required docker components and dependencies exist
  • (.deb) sudo apt-get -y install docker-engine
  • (.rpm) sudo yum -y install docker
  1. Identify local persistent storage location(s)
  2. InfluxDB Data (<influxdir>)
  3. Grafana Data (<grafanadir>)
  4. Configuration Dir (<configdir>)
  5. (Optional) SNMP MIBs Dir (<mibsdir>)
  6. Ensure persistent storage locations exist
  • mkdir -p <influxdir> <grafanadir> <configdir> <mibsdir>
  1. If using the Telegraf SNMP plugin, obtain dependent MIB files if needed.
  • Place these in <mibsdir> identified above
  1. Copy the telegraf.conf from this directory to <configdir>
  2. Edit telegraf.conf and either explicitly define hostname (do not leave empty) or change omit_hostname to true.
  3. Append to telegraf.conf any additional telegraf configurations identified with the desired dashboard
  4. Start three Docker containers:
  5. InfluxDB - docker run --name influxdb --rm -d -p 8086:8086 -v <influxdir>:/var/lib/influxdb influxdb
  6. Telegraf - docker run --name telegraf --rm -d -v <configdir>/telegraf.conf:/etc/telegraf/telegraf.conf:ro -v <mibsdir>:/root/.snmp/mibs:ro --net=container:influxdb nuntz/telegraf-snmp
  7. Grafana - docker run --name grafana --rm -d -p 3000:3000 -v <grafanadir>:/var/lib/grafana grafana/grafana
  8. Point a browser to the new Grafana instance at http://<dockerhost>:3000
  9. Login with default user/pass of admin/admin
  10. Click 'Add a Datasource'
  11. Use 'Telegraf' for the name
  12. Select 'InfluxDB' as the type
  13. Use 'http://<dockerhost>:8086' as the URL
  14. Use 'direct' for access
  15. Use 'telegraf' for InfluxDB Database (must match the database defined in telegraf.conf)
  16. Click 'Add'
  17. From the main menu, select 'Dashboards -> Import' to start importing and using dashboards.

References

Notes

  • The above assumes the use of the Telegraf SNMP input plugin. The official Telegraf Docker image currently lacks the needed support for this plugin, so an alternate Docker image based on the official image is used above.
  • The OS default distributions may have older versions of Docker. Often the official docker package repositories are configured and used instead of the OS-provided versions. See Install Docker Engine for detail.
  • Once the stack is up and running, the database (InfluxDB) should be configured with authentication (users/passwords) and authorization (grants). A read/write user for Telegraf and a read-only user for Grafana is recommended.
  • All three components support all of their standard configurations with their Docker implementations. See the References above for specific documentation.