Kiến Thức Linux Tutorial

📊 How to Install the TIG Stack (Telegraf, InfluxDB, and Grafana) on Rocky Linux

TIG Stack

The TIG Stack—comprising Telegraf, InfluxDB, and Grafana—is a powerful combination for collecting, storing, and visualizing time-series data. This guide will walk you through the installation and configuration process on a Rocky Linux system.


🛠️ Prerequisites

Before you begin, ensure you have:

  • A server running Rocky Linux 8 or 9.
  • A user account with sudo privileges.
  • SELinux set to permissive or disabled.
  • A stable internet connection.

🔄 Step 1: Update System Packages

Start by updating your system’s package index:

sudo dnf update -y

Reboot the system if necessary:

sudo reboot

🔥 Step 2: Configure Firewall

Allow necessary ports for InfluxDB and Grafana:

sudo firewall-cmd --permanent --add-port=8086/tcp
sudo firewall-cmd --permanent --add-port=3000/tcp
sudo firewall-cmd --reload

🗄️ Step 3: Install InfluxDB

Create the InfluxDB repository file:

sudo nano /etc/yum.repos.d/influxdb.repo

Add the following content:

[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

Save and exit the file. Then, install InfluxDB:

sudo dnf install influxdb2 -y

Start and enable the InfluxDB service:

sudo systemctl start influxdb
sudo systemctl enable influxdb

🧪 Step 4: Set Up InfluxDB

Run the initial setup for InfluxDB:

influx setup

You’ll be prompted to enter:

  • Username
  • Password
  • Organization name
  • Bucket name
  • Retention period (in hours)

Confirm the settings to complete the setup.


📈 Step 5: Install Telegraf

Install Telegraf using the InfluxDB repository:

sudo dnf install telegraf -y

Start and enable the Telegraf service:

sudo systemctl start telegraf
sudo systemctl enable telegraf

⚙️ Step 6: Configure Telegraf

Edit the Telegraf configuration file:

sudo nano /etc/telegraf/telegraf.conf

Locate the [outputs.influxdb_v2] section and configure it as follows:

[[outputs.influxdb_v2]]
  urls = ["http://localhost:8086"]
  token = "your-influxdb-token"
  organization = "your-org"
  bucket = "your-bucket"

Replace your-influxdb-token, your-org, and your-bucket with the values you set during the InfluxDB setup.

Save and exit the file. Restart Telegraf to apply the changes:

sudo systemctl restart telegraf

📊 Step 7: Install Grafana

Add the Grafana repository:

sudo tee /etc/yum.repos.d/grafana.repo<<EOF
[grafana]
name=Grafana Repository
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
EOF

Install Grafana:

sudo dnf install grafana -y

Start and enable the Grafana service:

sudo systemctl start grafana-server
sudo systemctl enable grafana-server

🌐 Step 8: Access Grafana Web Interface

Open your web browser and navigate to:

http://your-server-ip:3000

Log in with the default credentials:

  • Username: admin
  • Password: admin

You’ll be prompted to change the password upon first login.


🔌 Step 9: Configure Grafana Data Source

In Grafana:

  1. Navigate to Configuration > Data Sources.
  2. Click Add data source.
  3. Select InfluxDB.
  4. Configure the following:
    • URL: http://localhost:8086
    • Organization: Your InfluxDB organization name
    • Token: Your InfluxDB token
    • Default Bucket: Your InfluxDB bucket name
  5. Click Save & Test to verify the connection.

📈 Step 10: Create Grafana Dashboard

With the data source configured, you can now create dashboards:

  1. Navigate to Create > Dashboard.
  2. Click Add new panel.
  3. Build your queries to visualize metrics collected by Telegraf.
  4. Customize the visualization type and panel settings.
  5. Click Apply to add the panel to your dashboard.

✅ Conclusion

You’ve successfully installed and configured the TIG Stack on your Rocky Linux system. This setup enables efficient collection, storage, and visualization of time-series data, providing valuable insights into your system’s performance.


Meta Description: Learn how to install and configure the TIG Stack (Telegraf, InfluxDB, and Grafana) on Rocky Linux. Step-by-step guide with preserved commands for effective system monitoring.

SEO Keywords: TIG Stack installation Rocky Linux, Telegraf InfluxDB Grafana setup, Rocky Linux monitoring tools, install TIG Stack Rocky Linux

Hướng dẫn cài đặt Cluster Kafka trên Ubuntu

https://forum.congdonglinux.com


Add Comment

Click here to post a comment