Skip to main content

Prometheus

Linux Monitoring

Linux Monitoring with Prometheus

MySQL Monitoring

AIX Monitoring

Installation

Download: Download | Prometheus ,select Operating system: linux, Architecture: amd64

tar xzf prometheus-2.43.0.linux-amd64.tar.gz
mv prometheus-2.43.0.linux-amd64 /opt

第一次啟動

cd /opt/prometheus-2.43.0.linux-amd64/
./prometheus --config.file="prometheus.yml"

網頁介面 (僅限本機端): 

  • http://localhost:9090/metrics
    顯示預設會有本機系統的效能指標
  • http://localhost:9090/
    選擇 Graph,在 Expression 輸入 promhttp_metric_handler_requests_total ,按下 Execute,會有圖形顯示。

Configuration

資料儲存與清理週期
  • --storage.tsdb.path:
    Where Prometheus writes its database. Defaults to data/.
  • --storage.tsdb.retention.time:
    When to remove old data. Defaults to 15d. Overrides storage.tsdb.retention if this flag is set to anything other than default.
  • --storage.tsdb.retention.size:
    The maximum number of bytes of storage blocks to retain. The oldest data will be removed first. Defaults to 0 or disabled. Units supported: B, KB, MB, GB, TB, PB, EB. Ex: "512MB". Based on powers-of-2, so 1KB is 1024B. Only the persistent blocks are deleted to honor this retention although WAL and m-mapped chunks are counted in the total size. So the minimum requirement for the disk is the peak space taken by the wal (the WAL and Checkpoint) and chunks_head (m-mapped Head chunks) directory combined (peaks every 2 hours).