Monitoring with Collectd, InfluxDB and Grafana (Part2)

Rate this post

Installation and setup (Part 1/2)

Install Grafana (beta version of 4.x which was just previously mentioned):

  • yum install https://grafanarel.s3.amazonaws.com/builds/grafana-4.0.0-1477314783pre1.x86_64.rpm
  • sudo yum install grafana
  • Install InfluxDB and collectd:
  • yum install -y influxdb collectd

Enable services to start at boot:

  • systemctl enable grafana-server.service
  • systemctl enable influxdb.service
  • systemctl enable collectd.service

Setup InfluxDB

Edit the influxdb.conf file (located /etc/influxdb/influxdb.conf) to make some of the following
changes and enable collectd:
[collectd]
enabled = true
bind-address = “0.0.0.0:8888”
database = “collections”
# typesdb = “”
# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Batching
# will buffer points in memory if you have many coming in.
batch-size = 1000
batch-pending = 5
batch-timeout = “1s”
read-buffer = 0

Launch influxdb.service with the systemctl command :

  • systemctl start influxdb.service

Allow the admin to access to the interface :
[admin]
enabled = true
Allow InfluxDB to pass through Firewall :

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

Access the web GUI to InfluxDB (http://<IPAddress>:8083).
Create new admin user using the InfluxDB admin GUI:

  • CREATE USER “testmonitor1ad” WITH PASSWORD ‘r2w6*$^ep6T7t!’ WITH ALL PRIVILEGES
  • CREATE USER “testmonitordb1ad” WITH PASSWORD ‘r2w6*$^4U6T7t!’ WITH ALL PRIVILEGES

Create new database with the name we used in the configuration file for influxdb:

  • CREATE DATABASE “testmonitor1db”
  • CREATE DATABASE “testmonitordb1”
  • Create READ/WRITE user for collectd and assign permissions:
  • CREATE USER “collectdrw” WITH PASSWORD ‘HR893J%Dw5<y[^’
  • GRANT ALL ON “testmonitor1db” TO “collectdrw”
  • GRANT ALL ON “testmonitordb1” TO “collectdrw”
  • Create READ-ONLY user for collectd (stats reader) and grant those permissions:
  • CREATE USER “collectdread” WITH PASSWORD ‘hCA32<6R}8eD’
  • GRANT READ ON “testmonitor1db” TO “collectdread”
  • GRANT READ ON “testmonitordb1” TO “collectdread”

 

Until now we installed all the components and start to setup our influxDB as a datastore with the database necessary for the storage of the metrics as well as the users needed to write the metric received from CollectD and a user to read them to let grafana to use them in dashboard.

In the next page we will finish our installation process.