update
This commit is contained in:
30
dcgm-exporter/Dockerfile.grafana
Normal file
30
dcgm-exporter/Dockerfile.grafana
Normal file
@@ -0,0 +1,30 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG GRAFANA_VERSION="9.5.2"
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ARG DEBIAN_FRONTEND="noninteractive"
|
||||
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
|
||||
ARG HTTP_PROXY
|
||||
ARG HTTPS_PROXY
|
||||
ENV http_proxy=${HTTP_PROXY}
|
||||
ENV https_proxy=${HTTPS_PROXY}
|
||||
|
||||
# 替换 sources.list 文件以使用阿里云镜像源
|
||||
# RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list && \
|
||||
# sed -i 's|http://security.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list
|
||||
|
||||
# 安装必要的工具和库
|
||||
RUN apt-get update && \
|
||||
apt-get install -y wget vim bash ca-certificates
|
||||
|
||||
RUN wget https://dl.grafana.com/oss/release/grafana_${GRAFANA_VERSION}_amd64.deb && \
|
||||
dpkg -i grafana_${GRAFANA_VERSION}_amd64.deb && \
|
||||
rm grafana_${GRAFANA_VERSION}_amd64.deb
|
||||
|
||||
COPY grafana.ini /etc/grafana/grafana.ini
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["/usr/sbin/grafana-server", "--config=/etc/grafana/grafana.ini"]
|
||||
32
dcgm-exporter/Dockerfile.prometheus
Normal file
32
dcgm-exporter/Dockerfile.prometheus
Normal file
@@ -0,0 +1,32 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG PROMETHEUS_VERSION="2.45.6"
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ARG DEBIAN_FRONTEND="noninteractive"
|
||||
ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND}
|
||||
ARG HTTP_PROXY
|
||||
ARG HTTPS_PROXY
|
||||
ENV http_proxy=${HTTP_PROXY}
|
||||
ENV https_proxy=${HTTPS_PROXY}
|
||||
|
||||
# 替换 sources.list 文件以使用阿里云镜像源
|
||||
# RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list && \
|
||||
# sed -i 's|http://security.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list
|
||||
|
||||
|
||||
# 安装必要的工具和库
|
||||
RUN apt-get update && \
|
||||
apt-get install -y wget vim bash ca-certificates
|
||||
|
||||
RUN wget https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz && \
|
||||
tar xvfz prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz && \
|
||||
mv prometheus-${PROMETHEUS_VERSION}.linux-amd64 /opt/prometheus && \
|
||||
rm prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz
|
||||
|
||||
COPY prometheus.yml /opt/prometheus/prometheus.yml
|
||||
|
||||
EXPOSE 9090
|
||||
|
||||
CMD ["/opt/prometheus/prometheus", "--config.file=/opt/prometheus/prometheus.yml"]
|
||||
7
dcgm-exporter/README.md
Normal file
7
dcgm-exporter/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
构建和运行
|
||||
使用 Docker Compose 构建和运行容器:
|
||||
|
||||
```shell
|
||||
docker-compose up --build -d
|
||||
```
|
||||
34
dcgm-exporter/docker-compose.yml
Normal file
34
dcgm-exporter/docker-compose.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
prometheus:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.prometheus
|
||||
args:
|
||||
PROMETHEUS_VERSION: "2.45.6"
|
||||
HTTP_PROXY: "http://localhost:15777"
|
||||
HTTPS_PROXY: "http://localhost:15777"
|
||||
image: zly/prometheus:latest
|
||||
container_name: prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
volumes:
|
||||
- ./prometheus.yml:/opt/prometheus/prometheus.yml
|
||||
restart: unless-stopped
|
||||
|
||||
grafana:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.grafana
|
||||
args:
|
||||
GRAFANA_VERSION: "9.5.2"
|
||||
HTTP_PROXY: "http://localhost:15777"
|
||||
HTTPS_PROXY: "http://localhost:15777"
|
||||
image: zly/grafana:latest
|
||||
container_name: grafana
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./grafana.ini:/etc/grafana/grafana.ini
|
||||
restart: unless-stopped
|
||||
6
dcgm-exporter/grafana.ini
Normal file
6
dcgm-exporter/grafana.ini
Normal file
@@ -0,0 +1,6 @@
|
||||
[server]
|
||||
http_port = 3000
|
||||
|
||||
[security]
|
||||
admin_user = admin
|
||||
admin_password = grafana
|
||||
11
dcgm-exporter/prometheus.yml
Normal file
11
dcgm-exporter/prometheus.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
- job_name: 'dcgm-exporter'
|
||||
static_configs:
|
||||
- targets: ['127.0.0.1:9400']
|
||||
Reference in New Issue
Block a user