线上第六期_Docker 进阶_20181028

搭建testlink

    1. docker run -d --name mariadb -e ALLOW_EMPTY_PASSWORD=yes -e MARIADB_USER=bn_testlink -e MARIADB_DATABASE=bitnami_testlink -v /home/gaofei/test/mysql:/var/lib/mysql -p 8088:3306 bitnami/mariadb:latest
    1. docker run -d --name testlink -p 8099:80 -p 444:443 -e ALLOW_EMPTY_PASSWORD=yes -e TESTLINK_DATABASE_USER=bn_testlink -e TESTLINK_DATABASE_NAME=bitnami_testlink --link mariadb bitnami/testlink:latest

使用selenium docker(拉镜像)

    1. docker pull selenium/node-chrome-debug:3.7.1-beryllium
    1. docker pull selenium/hub:3.7.1-beryllium

启动命令

  • 1.docker run --name=hub -p 5001:4444 -e GRID_TIMEOUT=0 -e GRID_THROW_ON_CAPABILITY_NOT_PRESENT=true -e GRID_NEW_SESSION_WAIT_TIMEOUT=-1 -e GRID_BROWSER_TIMEOUT=15000 -e GRID_TIMEOUT=30000 -e GRID_CLEAN_UP_CYCLE=30000 -d selenium/hub:3.7.1-beryllium
  • 2.docker run --name=chrome -p 5902:5900 -e NODE_MAX_INSTANCES=6 -e NODE_MAX_SESSION=6 -e NODE_REGISTER_CYCLE=5000 -e DBUS_SESSION_BUS_ADDRESS=/dev/null -v /dev/shm:/dev/shm --link hub -d selenium/node-chrome-debug:3.7.1-beryllium
  • VNC密码是:secret

启动prometheus和node-exporter

    1. docker run --name prometheus -d -p 9090:9090 -v pwd/prometheus.yml:/etc/prometheus/prometheus.yml -v pwd/rules/:/etc/prometheus/ prom/prometheus --config.file=/etc/prometheus/prometheus.yml
    1. 下载好node exporter的包后,运行: ./node_exporter

启动prometheus和node-exporter

    1. docker run --name prometheus -d -p 9090:9090 -v pwd/prometheus.yml:/etc/prometheus/prometheus.yml -v pwd/rules/:/etc/prometheus/ prom/prometheus --config.file=/etc/prometheus/prometheus.yml
    1. 下载好node exporter的包后,运行: ./node_exporter

prometheus配置文件

global:
  scrape_interval:     15s
  evaluation_interval: 15s

alerting:
  alertmanagers:
  - static_configs:
    - targets:
      - localhost:9093

rule_files:
  - rules/*.rules

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['39.105.132.200:9090']
  - job_name: 'node_exporter'
    static_configs:
    - targets: ['39.105.132.200:9100']
  - job_name: 'mysql'
    static_configs:
    - targets: ['39.105.132.200:9104']

启动grafana

    1. docker run --name grafana -d -p 8000:3000 grafana/grafana

启动mysqld-exeporter

    1. docker run -d --name mysql-exporter -p 9104:9104 -e DATA_SOURCE_NAME=“root:1qaz9ol.@(39.105.132.200:8888)/mysql” prom/mysqld-exporter

内存使用率

  • 100*(node_memory_MemTotal_bytes - node_memory_MemFree_bytes - node_memory_Buffers_bytes - node_memory_Cached_bytes) / node_memory_MemTotal_bytes

磁盘使用率

  • 100.0 - 100 * ((node_filesystem_avail_bytes{mountpoint=~"/", device!=“rootfs”} / 1000 / 1000 ) / (node_filesystem_size_bytes{mountpoint=~"/", device!=“rootfs”} / 1024 / 1024))
关闭