Prometheus

来自Gea-Suan Lin's Wiki
跳到导航 跳到搜索
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Prometheus是一个TSDB

安装

Ubuntu 18.04系统内的Prometheus太旧(2.1),加上没有适合的PPA可以用,这边使用官方的binary安装:

cd /tmp; wget https://github.com/prometheus/prometheus/releases/download/v2.22.0/prometheus-2.22.0.linux-amd64.tar.gz; tar zxvf prometheus-2.22.0.linux-amd64.tar.gz; cd prometheus-2.22.0.linux-amd64; sudo cp prometheus promtool /usr/bin; sudo mkdir /etc/prometheus; sudo cp prometheus.yml /etc/prometheus/; sudo cp -R consoles/ console_libraries/ /etc/prometheus/; sudo useradd -r -U prometheus; sudo mkdir /var/lib/prometheus; sudo chown prometheus:prometheus /var/lib/prometheus; echo -e "[Unit]\nDescription=Prometheus Time Series Collection and Processing Server\nWants=network-online.target\nAfter=network-online.target\n\n[Service]\nUser=prometheus\nGroup=prometheus\n\nType=simple\n
ExecStart=/usr/bin/prometheus --config.file /etc/prometheus/prometheus.yml --storage.tsdb.path /var/lib/prometheus/ --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries\n\n[Install]\nWantedBy=multi-user.target" | sudo tee /lib/systemd/system/prometheus.service; sudo systemctl daemon-reload; sudo systemctl enable prometheus; sudo service prometheus start

设定

要注意官方安装档内的prometheus.ymlscrape_intervalevaluation_interval预设是15s(但不设定时预设是1m),正常情况下5m应该是够用,可以考虑指定5m降低频率。

外部链接