- Thanos is an open-source project designed to enhance the capabilities of Prometheus, especially for large-scale and long-term monitoring.
- While Prometheus is powerful for real-time metrics collection, it has limitations such as short-term storage and lack of native horizontal scalability.
- Thanos solves these problems by providing long-term storage, high availability, and global query capabilities across multiple Prometheus instances
In this guide, we will walk you through the steps to Install Thanos Sidecar on Ubuntu, enabling seamless integration with Prometheus for scalable and reliable monitoring.
Configure Prometheus for Thanos
Edit Prometheus configuration.
sudo nano /etc/prometheus/prometheus.yml
Add external labels:
global:
scrape_interval: 15s
external_labels:
cluster: monitoring-cluster
replica: prometheus-1
Restart Prometheus
sudo systemctl restart prometheus
Enable Prometheus TSDB Block Duration
Thanos requires 2h block duration.
Edit Prometheus service file:
vim /etc/systemd/system/prometheus.service
Add:
Prometheus
Install Thanos
Download the latest Thanos release.
wget https://github.com/thanos-io/thanos/releases/latest/download/thanos-linux-amd64.tar.gz
tar -xvzf thanos-linux-amd64.tar.gz
--version
Configure Object Storage
Thanos needs object storage (S3).
Create configuration file:
sudo mkdir /etc/thanos
sudo vim /etc/thanos/bucket.yml
Example S3 config:
type: S3
config:
bucket: thanos
endpoint: minio.example.com:9000
access_key:
secret_key:
insecure: true
Create Systemd Service for Thanos
Create service file:
sudo vim /etc/systemd/system/thanos-sidecar.service
[Unit]
Description=Thanos Sidecar
After=network.target
[Service]
User=prometheus
ExecStart=/usr/local/bin/thanos sidecar \
--tsdb.path=/var/lib/prometheus \
--prometheus.url=http://localhost:9090 \
--objstore.config-file=/etc/thanos/bucket.yml \
--grpc-address=0.0.0.0:10901 \
--http-address=0.0.0.0:10902
Restart=always
[Install]
WantedBy=multi-user.target
Reload systemd:
sudo systemctl daemon-reload
sudo systemctl enable thanos-sidecar
Start service:
sudo systemctl start thanos-sidecar
Verify Thanos Sidecar
Check service:
systemctl status thanos-sidecar
http://SERVER-IP:9091
Conclusion
Implementing Thanos Sidecar alongside Prometheus significantly improves the scalability and reliability of your monitoring infrastructure. While Prometheus is excellent for realtime metrics collection, it has limitations in terms of long-term storage and horizontal scalability. Thanos addresses these challenges by extending Prometheus with features like durable object storage integration, high availability, and global querying capabilities.
If you need expert assistance to Install Thanos Sidecar on Ubuntu, the team at Skynats is here to help. Setting up Thanos with Prometheus can involve complex configurations, especially in production monitoring environments. With our DevOps Support Services, we help businesses deploy, configure, and optimize monitoring stacks to ensure scalability, reliability, and high availability. Whether you need help with installation, troubleshooting, or integrating Thanos into your existing infrastructure, our DevOps engineers can provide the right guidance and support. Contact Skynats today to simplify your deployment and keep your monitoring systems running smoothly.