【Prometheus】二进制安装

发布时间:2024年01月24日

安装 prometheus

  • https://prometheus.io/download/
# 创建 prometheus 用户
# -M 不创建家目录
# -s 使用指定的 shell,这里禁止登录
useradd -M -s /usr/sbin/nologin prometheus

wget https://github.com/prometheus/prometheus/releases/download/v2.45.2/prometheus-2.45.2.linux-amd64.tar.gz
tar xfv prometheus-2.45.2.linux-amd64.tar.gz

mkdir /opt/prometheus/
mv prometheus-2.45.2.linux-amd64 /opt/prometheus/prometheus
chown -R prometheus:prometheus /opt/prometheus/prometheus

vim /etc/systemd/system/prometheus.service

[Unit]
Description=PrometheusServer
After=network-online.target

[Service]
Type=simple
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/opt/prometheus/prometheus/prometheus \
        --config.file=/opt/prometheus/prometheus/prometheus.yml \
        --storage.tsdb.path=/opt/prometheus/prometheus/data \
        --storage.tsdb.retention.time=60d \
        --web.enable-lifecycle
        
[Install]
WantedBy=multi-user.target

systemctl status prometheus 查看状态
systemctl enable prometheus 开机自启

http://localhost:9090
prometheus 1

安装 alertmanager

  • https://prometheus.io/download/

http://localhost:9093
alertmanager

安装 grafana

  • https://grafana.com/grafana/download
  • https://grafana.com/grafana/dashboards/1860-node-exporter-full/

http://localhost:3000
grafana
添加 prometheus 地址

安装 node_exporter

  • https://prometheus.io/download/

http://localhost:9100/
node_exporter
node exporter metrics

文章来源:https://blog.csdn.net/Hanoi_ahoj/article/details/135797185
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。