• 服务器监控


    docker 监控(服务端)

    cAdvisor(Container Advisor)用于收集正在运行的容器资源使用和性能信息。
    Grafana 是一个开源的度量分析和可视化系统

    docker run -d 
    --volume=/:/rootfs:ro 
    --volume=/var/run:/var/run:ro 
    --volume=/sys:/sys:ro 
    --volume=/var/lib/docker/:/var/lib/docker:ro 
    --volume=/dev/disk/:/dev/disk:ro 
    --publish=8080:8080 
    --detach=true 
    --name=cadvisor 
    google/cadvisor:latest
    View Code

    主机监控

    安装node_exporter

    node_exporter.sh

    #!/bin/bash
    
    wget https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz
    
    tar zxf node_exporter-0.17.0.linux-amd64.tar.gz
    mv node_exporter-0.17.0.linux-amd64 /usr/local/node_exporter
    
    cat <<EOF >/usr/lib/systemd/system/node_exporter.service
    [Unit]
    Description=https://prometheus.io
    
    [Service]
    Restart=on-failure
    ExecStart=/usr/local/node_exporter/node_exporter
    
    [Install]
    WantedBy=multi-user.target
    EOF
    
    systemctl daemon-reload
    systemctl enable node_exporter
    systemctl restart node_exporter
    View Code

    数据存储

    Docker部署: https://prometheus.io/docs/prometheus/latest/installation/
    配置

    prometheus.yml

    # my global config
    global:
      scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
      evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
      # scrape_timeout is set to the global default (10s).
    
    # Alertmanager configuration
    alerting:
      alertmanagers:
      - static_configs:
        - targets:
          # - alertmanager:9093
    
    # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
    rule_files:
      # - "first_rules.yml"
      # - "second_rules.yml"
    
    # A scrape configuration containing exactly one endpoint to scrape:
    # Here it's Prometheus itself.
    scrape_configs:
      # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
      - job_name: 'prometheus'
    
        # metrics_path defaults to '/metrics'
        # scheme defaults to 'http'.
    
        static_configs:
        - targets: ['localhost:9090']
    
      - job_name: "docker"
        static_configs:
        - targets: ['192.168.31.62:8080']
    
      - job_name: "Linux"
        static_configs:
        - targets: ['192.168.31.62:9100']
    View Code
    docker run -d 
    --name=prometheus 
    -p 9090:9090 
    -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml 
    prom/prometheus
    View Code

    数据展示

    https://github.com/google/cadvisor
    https://grafana.com/grafana/download
    Docker主机监控模板: 193
    Linux主机监控模板: 9276
    账号密码默认admin

    docker run -d 
    --name=grafana 
    -p 3000:3000 
    grafana/grafana
    View Code

     

  • 相关阅读:
    vue入门:(方法、侦听器、计算属性)
    vue入门:(模板语法与指令)
    前端资源
    CSS3总结七:变换(transform)
    CSS总结六:动画(一)ransition:过渡、animation:动画、贝塞尔曲线、step值的应用
    设计模式(一):简单工厂
    正则命令积累
    命令模式 & 策略模式 & 模板方法
    抽象工厂:简单游戏角色
    简单工厂模式—>工厂模式
  • 原文地址:https://www.cnblogs.com/huay/p/13760477.html
Copyright © 2020-2023  润新知