Netdata with InfluxDB backend
In this article we will see how to install and configure Netdata with InfluxDB backend
Netdata is a popular Monitoring tool which does realtime performance and health monitoring of your servers and applications. It is fast and efficient, you can see the metrics in almost realtime. It is designed to permanently run on all systems, it uses very low cpu and memory resources.
One disadvantage with Netdata is that, it is not centralized. Unlike traditional monitoring tools , Netdata run on the machines and save metrics there itself. So if the machine is down we cannot see the data. Also, if the disk fails, we might not retrieve historical metrics.
Fortunately, Netdata supports archival of metrics data to popular TimeSeries datastores , like influxdb, Prometheus, Graphite etc.
Installing Netdata
Netdata installation steps are Documented here in another post. Please go though it.
Install Influxdb
Install InfluxDB on Centos & RedHat
On Centos , InfluxDB can be installed using YUM
1. Enable Influxdb repository
Open the file in vi editor
1 2 3 | vi /etc/yum.repos.d/influxdb.repo |
Add following line to the file
1 2 3 4 5 6 7 8 | [influxdb] name = InfluxDB Repository – RHEL \$releasever baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable enabled = 1 gpgcheck = 1 gpgkey = https://repos.influxdata.com/influxdb.key |
Once repository is added to the yum configuration, you can install and start the InfluxDB service by running:
1 2 3 4 | sudo yum install influxdb sudo service influxdb start |
Install InfluxDB on Debian/Ubuntu
On Ubuntu/Debian, we can install InfluxDB using apt-get utility
Install InfluxDB on Ubuntu
Add the InfluxDB repository using below commands
1 2 3 4 5 | 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 |
Then Install and start InfluxDB using
1 2 3 4 | sudo apt–get update ; sudo apt–get install influxdb sudo service influxdb start |
Install InfluxDB on Debian
Add the InfluxDB repository using below commands
1 2 3 4 5 6 | curl –sL https://repos.influxdata.com/influxdb.key | sudo apt-key add – source /etc/os–release test $VERSION_ID = “7” ; echo “deb https://repos.influxdata.com/debian wheezy stable” | sudo tee /etc/apt/sources.list.d/influxdb.list test $VERSION_ID = “8” ; echo “deb https://repos.influxdata.com/debian jessie stable” | sudo tee /etc/apt/sources.list.d/influxdb.list |
Then Install and start InfluxDB using
1 2 3 4 | sudo apt–get update && sudo apt–get install influxdb sudo service influxdb start |
Once InfluxDB started, you can connect to it and check the Data available in it.
1 2 3 4 5 6 7 8 9 10 11 | [root@test.test.com ~]# influx Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. Connected to http://localhost:8086 version 0.13.0 InfluxDB shell version: 0.13.0 > show databases; name: databases ———————– name _internal |
You can see that no databases are created yet.
Now let us configure Netdata with influxdb backend
Open netdata configuration file /etc/netdata/netdata.conf
1 2 3 4 5 6 7 8 9 10 11 12 | [backend] enabled = yes # data source = average type = graphite destination = udp:192.168.2.21:25836 prefix = netdata hostname = test.test.com # update every = 10 # buffer on failures = 10 # timeout ms = 20000 |
Configuration variables are self explanatory. InfluxDB is listening on UDP port “25836” , so we are configuring Netdata to send metrics to following end point
1 | “udp:192.168.2.21:25836” |
Once done, restart Netdata using
1 2 3 | service netdata restart |
After this you should be able to see the metrics inside InfluxDB. To check this, we connect to InfluxDB again
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | [root@test.test.com ~]# influx Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. Connected to http://localhost:8086 version 0.13.0 InfluxDB shell version: 0.13.0 > show databases; name: databases ———————– name _internal test telegraf use telegraf > use telegraf Using database telegraf > show series key cpu,cpu=cpu–total,host=test.test.com cpu,cpu=cpu0,host=test.test.com cpu,cpu=cpu1,host=test.test.com cpu,cpu=cpu2,host=test.test.com cpu,cpu=cpu3,host=test.test.com disk,fstype=ext4,host=test.test.com,path=/ disk,fstype=ext4,host=test.test.com,path=/boot disk,fstype=ext4,host=test.test.com,path=/home diskio,host=test.test.com,name=dm–0,serial=unknown diskio,host=test.test.com,name=dm–1,serial=unknown diskio,host=test.test.com,name=dm–10,serial=unknown diskio,host=test.test.com,name=dm–11,serial=unknown diskio,host=test.test.com,name=dm–2,serial=unknown diskio,host=test.test.com,name=dm–3,serial=unknown diskio,host=test.test.com,name=dm–4,serial=unknown diskio,host=test.test.com,name=dm–5,serial=unknown diskio,host=test.test.com,name=dm–6,serial=unknown diskio,host=test.test.com,name=dm–7,serial=unknown diskio,host=test.test.com,name=dm–8,serial=unknown diskio,host=test.test.com,name=dm–9,serial=unknown diskio,host=test.test.com,name=sda,serial=ST500LT012–9WS142_W0V104VK diskio,host=test.test.com,name=sda2,serial=ST500LT012–9WS142_W0V104VK kernel,host=test.test.com mem,host=test.test.com processes,host=test.test.com swap,host=test.test.com system,host=test.test.com > |
You can see that a new database named “telegraf” was created and system metrics are stored in that database. Now we can visualize this metrics data using Grafana or InfluxDB UI.
I have created a video on how to add and visualize InfluxDB data using Grafana
Please let me know if you face any issue ????