美文网首页
安装prometheus

安装prometheus

作者: 木火应 | 来源:发表于2022-07-20 21:33 被阅读0次
  • 下载prometheus并解压到目录/home/mhy/prometheus
  • 建立软连接
    sudo ln -s /home/mhy/prometheus/promtool /usr/bin/promtool
    
  • 新建数据目录
    mkdir /data/prometheus
    chmod +rw -R /data/prometheus
    
  • 新建服务文件vim /usr/lib/systemd/system/prometheus.service
    [Unit]
    Description=Prometheus Server
    Documentation=https://prometheus.io/
    After=network.target
    [Service]
    Type=simple
    User=root
    Group=root
    WorkingDirectory=/home/mhy/prometheus
    ExecStart=/home/mhy/prometheus/prometheus \
    --web.listen-address=0.0.0.0:9090 \
    --storage.tsdb.path="/data/prometheus" \
    --config.file=prometheus.yml
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
    
  • 相关命令:
    promtool check config prometheus.yml   #使用promtool工具来验证配置文件 
    systemctl start prometheus.service
    

相关文章

网友评论

      本文标题:安装prometheus

      本文链接:https://www.haomeiwen.com/subject/mdjpirtx.html