美文网首页
搭建性能监控体系

搭建性能监控体系

作者: 是萌萌哎 | 来源:发表于2020-11-05 15:58 被阅读0次

    一、Docker安装prometheus
    1.1首先用户目录下创建prometheus.yml文件,粘贴https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus.yml的内容
    1.2 执行docker pull prom/prometheus
    1.3 docker run -d --name prometheus --network grafana -p 9090:9090 -v %cd%/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus:latest --config.file=/etc/prometheus/prometheus.yml 挂载并且执行yml
    1.4 本机ip+9090访问页面

    image.png
    下图就是刚刚配置的yml
    image.png
    1.5 docker pull prom/node-exporter 拉取监控主机性能参数指标
    1.6 启用docker run -d -p 9100:9100 --name node-exporter prom/node-exporter:latest
    1.7 prometheus添加参数
    主机名 ip
    • job_name: 'ZhangMengm 172.27.122.145'
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    
    static_configs:
    - targets: ['172.27.122.145:9100']
    

    1.7重启prometheus docker restart prometheus
    如图,新增加targets并且状态为up

    image.png
    1.8 grafana配置数据源
    image.png
    image.png
    1.9 导入相应的监控模板
    https://grafana.com/grafana/dashboards/8919
    点击import
    image.png
    地址输入点击load后,主要要指定数据源
    image.png
    2.0 可以看到数据监测的情况了(注意这里我设置的是我自己的本机)
    image.png
    image.png
    image.png

    相关文章

      网友评论

          本文标题:搭建性能监控体系

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