Install InfluxDB Server and Data Source

Video Lecture

Install InfluxDB Server and Data Source Install InfluxDB Server and Data Source Install InfluxDB Server and Data Source

Description

We are going to install InfluxDB, the InfluxDB data source, a Telegraf agent and then collect data from some SNMP devices.

InfluxDB is a database useful for storing large amounts of timestamped data.

Telegraf is an agent that support plugins and it will save it's data into InfluxDB.

Note : The configuration of Grafana, InfluxDB and Telegraf is commonly known on the internet as the TIG stack.

Lets continue,

The first part is to Install the InfluxDB service and create the data source in Grafana.

The install commands for your OS are at https://docs.influxdata.com/influxdb/v1.7/introduction/installation/

I am using Ubuntu 18.

So first, I add the required information to the repository

wget -qO- 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

then update and install

sudo apt update
sudo apt install influxdb -y

then start the service, ensure it starts in case of reboot and check it's status is active.

sudo systemctl start influxdb
sudo systemctl enable influxdb
sudo systemctl status influxdb

The InfluxDB will listen on port 8086, and if your server is on the internet, like mine, then anybody will be able to access the server using the url http://[your domain name or ip]:8086

If you want to prevent direct internet access, then you can use iptables to only allow the port for localhost.

iptables -A INPUT -p tcp -s localhost --dport 8086 -j ACCEPT
iptables -A INPUT -p tcp --dport 8086 -j DROP

You have other options to secure your InfluxDB as well which are listed at https://docs.influxdata.com/influxdb/v1.7/administration/security/

Next, start the InfluxDB prompt, create and add the Telegraf database and user,

influx
> create database telegraf
> create user telegraf with password 'password'
> show databases
> show users

Note

It may take several seconds to initially connect to the InfluxDB before you get the prompt

Now continue to add the InfluxDB Data Source as shown in the video lecture.