美文网首页
Prometheus搭建

Prometheus搭建

作者: 测试生财 | 来源:发表于2020-07-23 08:04 被阅读0次

    1、下载Prometheus(建议使用2.x版本)

    wget https://github.com/prometheus/prometheus/releases/download/v2.8.0/prometheus-2.8.0.linux-amd64.tar.gz

    tar xf prometheus-2.8.0.linux-amd64.tar.gz -C /usr/local/

    mv /usr/local/prometheus-2.8.0.linux-amd64 /usr/local/prometheus

    cd /usr/local/prometheus

    2、查看Prometheus版本

    ./promethues --version

    #显示如下

    prometheus, version 2.8.0 (branch: HEAD, revision: 59369491cfdfe8dcb325723d6d28a837887a07b9)

      build user:       root@4c4d5c29b71f

      build date:       20190312-07:46:58

      go version:       go1.11.5

    3、启动Prometheus(后台)

    #默认启动9090端口,读取当前目录下的promethues.yml配置

    cd /usr/local/promethus && nohup ./promethues &

    4、以服务方式启动

    #添加到系统服务,方便于管理

    vi /etc/systemd/system/prometheus.service

    #添加如下内容

    [Unit]

    Description=Prometheus Monitoring System

    Documentation=Prometheus Monitoring System

    [Service]

    ExecStart=/usr/local/prometheus/prometheus \

      --config.file=/usr/local/prometheus/prometheus.yml \

      --web.listen-address=:9090

    [Install]

    WantedBy=multi-user.target

    5、启动服务,设置开机自启

    systemctl daemon-reload

    systemctl enable prometheus

    systemctl start prometheus

    6、访问Promethues主页

    访问http://{IP}:9090,如果是本机则是http://localhost:9090

    相关文章

      网友评论

          本文标题:Prometheus搭建

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