Article

Table of Contents
Try Vultr Today with

$50 Free on Us!

Installing and Configuring Chronograf on Ubuntu 16.04 LTS

Published on: Fri, Mar 9, 2018 at 6:05 pm EST
Linux Guides Server Apps System Admin Ubuntu

Chronograf is a time-series data grapher, similar to Grafana, which uses InfluxDB as it's backend. Chronograf is far more than just a data visualization tool though; through Kapacitor, an entire backend for alerting and monitoring is provided.

Installation

Tools

A variety of tools are used in this guide for different purposes, so please ensure the following packages are installed on your system.

sudo apt-get install wget curl

InfluxDB

Since Chronograf relies on InfluxDB as the primary data source, we have to install the latest version first. It can be archived by simply downloading and installing the pre-created .deb file.

wget https://dl.influxdata.com/influxdb/releases/influxdb_1.2.4_amd64.deb
sudo dpkg -i influxdb_1.2.4_amd64.deb

If the installation succeeds, we can continue with enabling and starting the service using systemctl.

sudo systemctl enable influxdb
sudo systemctl start influxdb

To make sure the service is running properly, we can invoke the following command, connecting directly to the InfluxDB HTTP API.

curl "http://localhost:8086/query?q=show+databases"

If everything is in order, the output should look similar to the following.

{"results":[{"statement_id":0,"series":[{"name":"databases","columns":["name"]}]}]}

If you are experiencing an error while running the above command, make sure InfluxDB is enabled and has started properly and try again.

Kapacitor

Kapacitor provides most of the functionality of Chronograf. In particular it is responsible for sending alerts. Alerts can be sent using various different services ranging from SMTP to Slack and HipChat. This package is provided through a pre-built .deb file as well.

wget https://dl.influxdata.com/kapacitor/releases/kapacitor_1.3.1_amd64.deb
sudo dpkg -i kapacitor_1.3.1_amd64.deb

Enable and start the service using systemctl.

sudo systemctl enable kapacitor
sudo systemctl start kapacitor

In order to verify that everything has been installed properly we can invoke the following command, which would usually return the currently queued tasks.

kapacitor list tasks

Make sure the output looks like this text.

ID Type      Status    Executing Databases and Retention Policies

In case an error is encountered, a detailed error-report will be shown.

Telegraf

After installing InfluxDB and Kapacitor successfully, we can continue with installing Telegraf. Telegraf is responsible for gathering all metrics which will further be visualized through Chronograf.

wget https://dl.influxdata.com/telegraf/releases/telegraf_1.3.2-1_amd64.deb
sudo dpkg -i telegraf_1.3.2-1_amd64.deb

Enable and start the service.

sudo systemctl enable telegraf
sudo systemctl start telegraf

Double-check the initial configuration provided through the installation. Open /etc/telegraf/telegraf.conf and make sure the lines below reflect your configuration.

urls = ["http://localhost:8086"]
database = "telegraf"

Chronograf

Next we will proceed with installing the core-package of Chronograf.

wget https://dl.influxdata.com/chronograf/releases/chronograf_1.3.3.0_amd64.deb
sudo dpkg -i chronograf_1.3.3.0_amd64.deb

Afterwards the service can be enabled and started.

sudo systemctl enable chronograf
sudo systemctl start chronograf

In order to verify that the installation was successful, point your browser to http://<server-ip>:8888 which shows an initial setup page on which we'll continue.

Initial Setup

Enter the InfluxDB connection details. Fill out the available forms as indicated below.

"Connection String" - http://localhost:8086
"Name" - InfluxDB
"Telegraf Database" - telegraf

Make sure to also check the box labeled Make this the default source.

Kapacitor

Click on the gears icon on the left navbar (the last item). Under the Active Kapacitor column press Add config. Fill out the provided form using the values below.

"Kapacitor URL" - http://localhost:9092
"Name" - Kapacitor

You may now continue with adding alert endpoints through the provided form.

Add other hosts

In order to add other hosts to Chronograf using SNMP we have to make changes to our Telegraf configuration and install a few necessary plugins.

sudo apt-get install snmp snmp-mibs-downloader

After authorizing the host running Chronograf on another host, we can add said host to our Telegraf configuration using the lines below.

[[inputs.snmp]]
  agents = [ "<ip-address-of-other-host>:161" ]
  version = 2
  community = "<snmp-community>"
  name = "snmp"

 [[inputs.snmp.field]]
    name = "hostname"
    oid = "RFC1213-MIB::sysName.0"
    is_tag = true

  [[inputs.snmp.table]]
    name = "snmp"
    inherit_tags = [ "hostname" ]
    oid = "IF-MIB::ifXTable"

    [[inputs.snmp.table.field]]
      name = "ifName"
      oid = "IF-MIB::ifName"
      is_tag = true

This, in particular, monitors all metrics such as CPU usage, memory usage and network usage split per interface with in-depth statistics including values like unicast packets and interface errors.

Firewall

As of now, Chronograf doesn't provide a classic authentication system such as username and password authentication. In order to keep our installation secure, we'll utilize the Vultr Firewall feature to block any ports going to port 8888 TCP and add an exception rule for our client's IP address which should be allowed to view it.

Since the other installed services only listen on the loopback IP address ( 127.0.0.1 ) we are not required to explicitly block requests going to it.

Conclusion

Chronograf is a very flexible and beatiful metric visualization tool bundled with decent alerting and data-collecting packages creating a decent monitoring solution.

Want to contribute ?

You could earn up to $300 by adding new articles