Prometheus是一个开源监控报警系统和时序列数据库
主要模块包含: Server, Exporters, Pushgateway, PromQL, Alertmanager, WebUI 等。
此处采用GitHub资源下载,也可去Prometheus官网下载https://prometheus.io/download/
PROM_PATH='/data/prometheus' mkdir -p ${PROM_PATH} mkdir -p ${PROM_PATH}/{data,conf,logs,bin} useradd prometheus cd /usr/local/src wget https://github.com/prometheus/prometheus/releases/download/v2.26.0/prometheus-2.26.0.linux-amd64.tar.gz tar -xvf prometheus-2.26.0.linux-amd64.tar.gz cd prometheus-2.26.0.linux-amd64/ cp prometheus promtool ${PROM_PATH}/bin/ cp prometheus.yml ${PROM_PATH}/conf/ chown -R prometheus.prometheus /data/prometheus cat >> /etc/profile <<EOF PATH=/data/prometheus/bin:$PATH:$HOME/bin EOF
cat >>/etc/systemd/system/prometheus.service <<EOF [Unit] Description=Prometheus Documentation=https://prometheus.io/ After=network.target [Service] Type=simple User=prometheus ExecStart=/data/prometheus/bin/prometheus --config.file=/data/prometheus/conf/prometheus.yml --storage.tsdb.path=/data/prometheus/data --storage.tsdb.retention=90d Restart=on-failure [Install] WantedBy=multi-user.target EOF
systemctl daemon-reload systemctl enable prometheus systemctl start prometheus systemctl status prometheus
出现下图表示启动成功
查看9090端口是否正常:netstat -plntu |grep 9090
如果是使用云服务器,要根据对应云服务厂商提供的配置方法,在安全组中开放对应端口,才可以正常使用浏览器访问。
能访问这个页面表示安装成功!