The TICK stack comprises 4 technologies that closely work together to capture, store, monitor, and visualize time series data. The 4 tools in the TICK stack are, Telgeraf, InfluxDB, Chronograf, and Kapacitor. These tools unlike Prometheus which uses a pull model, work with a push model.
InfluxDB is the high-performance time series database that is the heart of the TICK stack. It is designed from the ground level to handle high volumes of time series data. It stores the collected data in time order which is a sequence of data points. This is vital for cases such as DevOps, IoT monitoring, and real-time analytics and monitoring.
InfluxDB is preferred due to the following:
- A powerful API & toolset for real-time applications
- A large community of cloud and open source developers
- Easy-to-build/share templates provided through influxDb templates
- Efficient in developer productivity with storage, ingest, query, and visualization
- UI dashboards to view the data like Grafana, Chronograf
- Deep insights and analytics
Telegraf is a plugin used for collecting sequential time series data from a range of sources, that include IoT devices e.t.c. It sources these data from the system it runs on, performs metric pulling from third-party APIs, or listens for metrics from Kafka and StatsD consumer services. It also has the output plugins responsible for sending the metrics to data sources such as Graphite, Datadog, Librato, Kafka, InfluxDB, MQTT, OpenTSDB, NSQ e.t.c
Chronograf is the visualization engine for the TICK stack. It helps users to quickly set up and maintain alerting and monitoring of the infrastructure. It comes with templates and libraries that make it easy to build dashboards and get real-time visualizations.
Grafana can also be used to provide visualization for metrics collected. This is because it has context-rich visualizations, provided not only through graphs but also through other data presentation methods. Another good feature is that the dashboards can be customized to meet the needs of the particular software development project.
Garana offers the following features:
- Unify your data: Grafana uses a unique approach to providing a “single-pane-of-glass”. It unifies the existing data, wherever it lives
- Dashboards that anyone can use: the dashboards on Grafana give insightful meaning to metrics collected from numerous sources. You can also share the dashboard with other team members allowing you to analyze the data together.
- Flexibility and versatility: allows one to translate and transform any of your data into flexible and versatile dashboards
- Data everyone can see: it is built with the key focus of data being accessible to everyone in the organization and not a single developer.
Kapacitor is another component of the TICK stack. It is responsible for native data processing. It processes both stream and batch data from InfluxDB. It allows users to plug and set custom functions to process alerts with dynamic thresholds, match metrics for patterns, compute anomalies in statistics e.t.c
For better comprehension, the below diagram shows how the components work.
In this guide, we will walk through how to install InfluxDB 2 and Telegraf on Rocky Linux 9 / AlmaLinux 9
#1. Install InfluxDB 2 on Rocky Linux 9 / AlmaLinux 9
InfluxDB 2 does not exist in the default Rocky Linux 9 / AlmaLinux 9 repositories. To be able to install it, you need to add the TICK stack repositories below to the system.
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[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
EOF
Once the repository has been added, InfluxDB 2 can be installed with the command:
sudo dnf install influxdb2 influxdb2-cli
Dependency Tree:
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
influxdb2 x86_64 2.4.0-1 influxdb 88 M
influxdb2-cli x86_64 2.4.0-1 influxdb 5.8 M
Transaction Summary
================================================================================
Install 2 Packages
Total download size: 93 M
Installed size: 105 M
Is this ok [y/N]: y
Also accept GPG key importation:
Importing GPG key 0x2582E0C5:
Userid : "InfluxDB Packaging Service <[email protected]>"
Fingerprint: 05CE 1508 5FC0 9D18 E99E FB22 684A 14CF 2582 E0C5
From : https://repos.influxdata.com/influxdb.key
Is this ok [y/N]: y
Now start and enable the service:
sudo systemctl start influxdb
sudo systemctl enable influxdb
Check if the service is running:
$ systemctl status influxdb
● influxdb.service - InfluxDB is an open-source, distributed, time series database
Loaded: loaded (/usr/lib/systemd/system/influxdb.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2022-08-26 10:13:18 CEST; 6s ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 1931 (influxd)
Tasks: 7 (limit: 23441)
Memory: 50.5M
CPU: 283ms
CGroup: /system.slice/influxdb.service
└─1931 /usr/bin/influxd
Check the port on which InfluxDB is listening to:
$ sudo ss -plunt|grep influxd
tcp LISTEN 0 4096 *:8086 *:* users:(("influxd",pid=1931,fd=9))
Allow the InfluxDB port through the firewall:
sudo firewall-cmd --add-port=8086/tcp --permanent
sudo firewall-cmd --reload
#2. Configure InfluxDB 2 on Rocky Linux 9 / AlmaLinux 9
First, create a token, primary user, organization, and bucket with the command:
influx setup -t strong_influxdb_token
Proceed as below:
> Welcome to InfluxDB 2.0!
? Please type your primary username admin
? Please type your password *********
? Please type your password again *********
? Please type your primary organization name my-org
? Please type your primary bucket name my-bucket
? Please type your retention period in hours, or 0 for infinite 0
? Setup with these parameters?
Username: admin
Organization: my-org
Bucket: my-bucket
Retention Period: infinite
(y/N) y
Check the token list:
$ influx auth list
ID Description Token User Name User ID Permissions
09e24f5ad13b5000 admin's Token strong_influxdb_token admin 09e24f5aacbb5000 [read:/authorizations write:/authorizations read:/buckets write:/buckets read:/dashboards write:/dashboards read:/orgs write:/orgs read:/sources write:/sources read:/tasks write:/tasks read:/telegrafs write:/telegrafs read:/users write:/users read:/variables write:/variables read:/scrapers write:/scrapers read:/secrets write:/secrets read:/labels write:/labels read:/views write:/views read:/documents write:/documents read:/notificationRules write:/notificationRules read:/notificationEndpoints write:/notificationEndpoints read:/checks write:/checks read:/dbrp write:/dbrp read:/notebooks write:/notebooks read:/annotations write:/annotations read:/remotes write:/remotes read:/replications write:/replications]
Once created access the CLI using the created token:
$ influx v1 shell --token strong_influxdb_token
InfluxQL Shell 2.4.0
Connected to InfluxDB OSS v2.4.0
>
Once in the shell, you can list the available databases/buckets;
> show databases
Interactive Table View (press q to exit mode, shift+up/down to navigate tables):
Name: databases
┏━━━━━━━┳━━━━━━━━━━━━━┓
┃ index ┃ name ┃
┣━━━━━━━╋━━━━━━━━━━━━━┫
┃ 1┃_monitoring ┃
┃ 2┃_tasks ┃
┃ 3┃my-bucket ┃
┣━━━━━━━┻━━━━━━━━━━━━━┫
┃ 2 Columns, 3 Rows,┃
┃ Page 1/1┃
┃ Table 1/1, Statement┃
┃ 1/1┃
┗━━━━━━━━━━━━━━━━━━━━━┛
To exit press q.
You can now login to the web interface using the URL http://IP_Address:8086
Provide the created user and password to be authenticated to the below dashboard.
On this dashboard, you can view graphs, buckets, organizations e,t,c
#3. Install and Configure Telegraf on Rocky Linux 9 / AlmaLinux 9
Telegraf is provided by the same repositories that provide InfluxDB. Since we already have the repositories added to the system, we will install Telegraf with the command:
sudo yum install telegraf
Dependency Tree:
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
telegraf x86_64 1.23.4-1 influxdb 39 M
Transaction Summary
================================================================================
Install 1 Package
Total download size: 39 M
Installed size: 39 M
Is this ok [y/N]: y
Once installed, configure Telegraf by editing the file:
sudo vim /etc/telegraf/telegraf.conf
Locate the [[outputs.influxdb_v2]], comment it out and modify it as shown.
[[outputs.influxdb_v2]]
# ## The URLs of the InfluxDB cluster nodes.
.........
# ### ## ex: urls = ["https://us-west-2-1.aws.cloud2.influxdata.com"]
urls = ["http://192.168.205.12:8086"]
#
# ## Token for authentication.
token = "strong_influxdb_token"
#
# ## Organization is the name of the organization you wish to write to.
organization = "my-org"
#
# ## Destination bucket to write into.
bucket = "my-bucket"
Save the file and start Telegraf.
sudo systemctl start telegraf
Check the status of the service.
$ systemctl status telegraf
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
Loaded: loaded (/usr/lib/systemd/system/telegraf.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2022-08-26 10:56:16 CEST; 5s ago
Docs: https://github.com/influxdata/telegraf
Main PID: 2393 (telegraf)
Tasks: 9 (limit: 48180)
Memory: 42.1M
CPU: 106ms
CGroup: /system.slice/telegraf.service
└─2393 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
Now in your InfluxDB bucket, you will see measurements added.
You can also view graphs, heatmaps e.t.c by loading the measurements as shown;
These measurements have been collected by Telegraf. There are other input plugins for Telegraf. These include Elasticsearch, Graylog, Apache, Cassandra, Docker, SNMP, Redis, PostgreSQL, MySQL, IPtables e.t.c
You can view the usage of each plugin with the command:
telegraf -usage plugin-name
#4. Install Grafana on Rocky Linux 9 / AlmaLinux 9
Now we need to visualize the collected metrics with dashboards. Here we will use Grafana as the visualization tool.
Add the Grafana repositories on Rocky Linux 9 / AlmaLinux 9.
cat <<EOF | sudo tee /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=0
enabled=1
gpgcheck=0
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF
Now install Grafana with the command:
sudo yum install grafana
Once installed, reload the daemon:
sudo systemctl daemon-reload
Start and enable Grafana;
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
Allow Grafana through the firewall;
sudo firewall-cmd --add-port=3000/tcp --permanent
sudo firewall-cmd --reload
#5. Access the Grafana Web UI
Now we can access the Grafana web UI using the URL http://IP_Address:3000
Login with the default credentials
username: admin
password: admin
Set and new password and proceed to the dashboard below
Now add InfluxDB as a data source on Grafana by navigating to Data sources->InfluxDB to add a new data source as shown:
Switch to the Flux query language which is preferred for InfluxDB2, then provide the InfluxDB details:
Scroll down and provide the bucket, token, and organization name.
Once all the required details have been provided as shown above, click on Save and Test. The output above shows the data source has been added and InfluxDB2 is reachable.
Now we can create dashboards on Grafana using the InfluxDB data source. I will use a sample Telegraf Metrics dashboard with ID 15650
To load the dashboard, select InfluxDB as the data source and click on import.
Now to view the metrics, select the bucket from the 3 buckets in your organization (my-org)
Now you can configure the desired alerting rules on Grafana.
Closing Thoughts
In this guide, we have learned how to install InfluxDB 2 and Telegraf on Rocky Linux 9 / AlmaLinux 9. We have also learned how to configure Telegraf to write metrics to the InfluxDB database and view the metrics collected on the Grafana dashboard. I hope this was significant to you.
See more:
Setup Prometheus and Grafana on Kubernetes using prometheus-operator
Install Grafana on Kubernetes for Cluster Monitoring