Skip to main content

2 posts tagged with "Prometheus"

View All Tags

· 3 min read
zaxro

kibana

這邊用docker-compose起服務,不過會有conatiner一個使用者,而非預設的root

mkdir -p ./data
chown -R 472:472 ./data
version: "3.3"
services:
grafana:
image: grafana/grafana-enterprise:9.5.6
user: "472"
container_name: grafana
restart: unless-stopped
environment:
- GF_SERVER_ROOT_URL=http://*.948787.store/
- GF_INSTALL_PLUGINS=grafana-clock-panel
ports:
- '3000:3000'
volumes:
- '$PWD/data:/var/lib/grafana'

基本上,grafana只要設定資料源去拉prometheues,然後知道怎麼找適合的dashboard,以及變數如何設定就差不多!

· 15 min read
zaxro

prometheus

相較於Zabbix系統使用mysql之類的關聯式資料庫,prometheus使用是的TSDB時序資料庫,因其主要功能聚焦在看log跟分析數據,並不需要對不同表格做關聯.

採用tsdb的prometheus最最直觀的差別就是

  1. 使用 TSDB,它對系統資源的需求相對較低,這避免了 MySQL 等關聯式資料庫可能對系統資源的大量消耗
  2. 由於 TSDB 專為時間序列數據設計,它可以更有效地索引和查詢此類數據,使 Prometheus 的查詢速度比使用傳統關聯式資料庫的系統更快 在我自己的測試環境,用一台free tier的機器運行prometheus,也可以跑很順!

prometheus安裝

建立使用者

useradd --no-create-home --shell /bin/false prometheus

建立資料夾並授予使用者

mkdir -p /etc/prometheus /var/lib/prometheus
chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus

下載prometheus

wget https://github.com/prometheus/prometheus/releases/download/v2.44.0/prometheus-2.44.0.linux-amd64.tar.gz
tar xvfz prometheus-*.tar.gz

mv prometheus-2.44.0.linux-amd64 prometheuspackage
chown -R prometheus:prometheus prometheuspackage