prometheus 安裝
官網(wǎng):https://prometheus.io/download/
wget https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz
tar xvf prometheus-2.10.0.linux-amd64.tar.gz
mv prometheus-2.10.0.linux-amd64 /usr/local/prometheus
創(chuàng)建用戶
groupadd prometheus
useradd -g prometheus -m -d /var/lib/prometheus -s /sbin/nologin prometheus
chown prometheus.prometheus -R /usr/local/prometheus
創(chuàng)建Systemd服務(wù)
cat > /etc/systemd/system/prometheus.service <<EOF
[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
其他參數(shù)
# 控制對admin HTTP API的訪問罪帖,其中包括刪除時間序列等功能
--web.enable-admin-api
# 支持熱更新,直接執(zhí)行l(wèi)ocalhost:9090/-/reload立即生效
--web.enable-lifecycle
# 熱更新
curl -X POST http://prometheous_ip:9090/-/reload
啟動Prometheus
systemctl start prometheus
驗(yàn)證Prometheus是否啟動成功
systemctl status prometheus
● prometheus.service - prometheus
Loaded: loaded (/etc/systemd/system/prometheus.service; disabled; vendor preset: disabled)
Active: active (running) since 三 2019-06-05 09:06:28 GMT; 2min 28s ago
Main PID: 1678 (prometheus)
CGroup: /system.slice/prometheus.service
└─1678 /usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus
開機(jī)啟動
systemctl enable prometheus
訪問自帶Web
自帶Web默認(rèn)http://ip:9090财破,如不通請關(guān)閉防火墻