Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB)。Prometheus使用Go语言开发,是Google BorgMon监控系统的开源版本。
环境说明
操作系统:centos 7.6
ip地址:192.168.31.150
下载包
https://prometheus.io/download/
目前最新版是:2.14.0
下载链接:
https://github.com/prometheus/prometheus/releases/download/v2.14.0/prometheus-2.14.0.linux-amd64.tar.gz
useradd prometheus -s /sbin/nologin
tar zxvf prometheus-2.14.0.linux-amd64.tar.gz -C /data
mv /data/prometheus-2.14.0.linux-amd64 /data/prometheus
chown prometheus:prometheus -R /data/prometheus
封装service
vi /etc/systemd/system/prometheus.service
内容如下:
[Unit]
Description=Prometheus
After=network.target
[Service]
ExecStart=/data/prometheus/prometheus --config.file=/data/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus/data
User=prometheus
[Install]
WantedBy=multi-user.target
注意:主要修改ExecStart和User
设置开机自启动
systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus
查看端口
# ss -tunlp|grep prometheus
tcp LISTEN 0 128 :::9090 :::* users:(("prometheus",pid=969,fd=5))
访问targets
http://192.168.31.150:9090/targets
到这里,安装就结束了。