Monitoring with Collectd, InfluxDB and Grafana (Part3)

Installation and setup (Part 2/2)

 

Edit the configuration for InfluxDB one more time to enable authentication as by default, it is
disabled (so you can create an admin user):
[http]
enabled = true
bind-address = “:8086”
auth-enabled = true
log-enabled = true
write-tracing = false
pprof-enabled = false
https-enabled = false
https-certificate = “/etc/ssl/influxdb.pem”
Restart InfluxDB so the authentication setting can take effect:

  • systemctl restart influxdb.service

Setup collectd to send data to InfluxDB

Edit the collectd config to enable the “network” plugin:
LoadPlugin network
Add configuration for “network” plugin:
<Plugin “network”>
<Server “<InfluxDB IP>” “8888”>
SecurityLevel None
Username “collectdrw”
Password “collectdrwpassword!!!”
Interface “eth0”
</Server>
</Plugin>
eno16777736 interface
Restart collectd:

  • systemctl restart collectd.service

Verification metric in testmonitor1db:

  • select * from /.*/ limit 1

At this moment you should start seeing data from collectd into influxdb database “collections”.

Since we are *writing* data, we want to use the “collectdrw” user as this user has read/write permissions.

Setup Grafana

Starting grafana will automatically create an administrator user with the username//
password “admin//admin”.
Start Grafana:

  • systemctl start grafana-server.service

Allow Grafana to go through the firewall

  • firewall-cmd –permanent –zone=public –add-port=3000/tcp
  • firewall-cmd –reload

Access the web GUI for Grafana: (http://<grafana IP>:3000) with the previous admin credentials above.
Change usernames, add users, change passwords, etc. as needed.
Add a new datasource :
Name: Influx
Type: InfluxDB
URL: http://<InfluxDB IP>:8086
Database: collections
User: collectdread
Pass: hCA32<5R}8eD
Click “ADD” to make sure you test the connection between influxDB and Grafana.

Now we have a complete decoupled architecture available with Grafana as the visualizer, Influxdb as data store containing the data collected by CollectD.

The choice of this decoupled monitoring architecture can be challenged in relation to the need. There are many tools and datastore compatible with Grafana which is the number one visualization product.

In order to have a complete centralization of our services, I will show you an installation of the ELK stack which means ElasticSearch, Logstash and Kibana which today is the most popular of the market log management stack centralizes and opensource.

Here is a live demo where you can play with a configured Grafana : http://play.grafana.org/

Enjoy !

Leave a Reply