普罗米修斯实战
普罗米修斯的配置文件
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['ke.hogwarts.ceshiren.com:5005']
- job_name: 'mysql'
static_configs:
- targets: ['ke.hogwarts.ceshiren.com:5009']
- job_name: 'cadvisor'
static_configs:
- targets: ['ke.hogwarts.ceshiren.com:8091']
- job_name: 'pushgateway'
static_configs:
- targets: ['ke.hogwarts.ceshiren.com:9091']
labels:
instance: pushgateway
普罗米修斯的启动命令
docker run --name=prometheus -d -p 5004:9090 -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
grafana启动命令
docker run --name grafana -d -p 5007:3000 grafana/grafana
node-exporter启动命令
nohup ./node_exporter/node_exporter --web.listen-address=":5005" >> node_exporter.log 2>&1 &
mysql exporter
docker run -d --name mysql-exporter -p 5009:9104 -e DATA_SOURCE_NAME="root:1qaz9ol.@(47.93.32.161:5008)/mysql" prom/mysqld-exporter
普罗米修斯的文档
https://github.com/yunlzheng/prometheus-book
docker-compose模版
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:latest'
environment:
- MARIADB_USER=bn_testlink
- MARIADB_DATABASE=bitnami_testlink
- ALLOW_EMPTY_PASSWORD=yes
testlink:
image: 'bitnami/testlink:latest'
environment:
- MARIADB_HOST=mariadb
- MARIADB_PORT_NUMBER=3306
- TESTLINK_DATABASE_USER=bn_testlink
- TESTLINK_DATABASE_NAME=bitnami_testlink
- ALLOW_EMPTY_PASSWORD=yes
ports:
- '5003:8080'
- '443:443'
depends_on:
- mariadb
dockerfile模版
FROM centos:7
ADD entrypoint.sh /root
USER root
RUN yum install -y wget vim
RUN yum install -y vim wget
RUN yum install -y wget vim git
RUN yum install -y wget
RUN yum install -y openssh-server openssl
RUN yum install wget vim
RUN yum install git vim
USER jenkins
WORKDIR /root
ENTRYPOINT ["/bin/bash", "/root/entrypoint.sh"]