├── .blank ├── .github └── workflows │ └── docker-publish.yml ├── Dockerfile ├── README.md └── docker-entrypoint.sh /.blank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carlosedp/docker-arm_exporter/649e2e5903bebbf6e2536739115ba643f66f7889/.blank -------------------------------------------------------------------------------- /.github/workflows/docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: Docker 2 | 3 | # This workflow uses actions that are not certified by GitHub. 4 | # They are provided by a third-party and are governed by 5 | # separate terms of service, privacy policy, and support 6 | # documentation. 7 | 8 | on: 9 | schedule: 10 | - cron: '0 0 * * 0' 11 | push: 12 | branches: [ master ] 13 | # Publish semver tags as releases. 14 | tags: [ 'v*.*.*' ] 15 | pull_request: 16 | branches: [ master ] 17 | 18 | env: 19 | # Use docker.io for Docker Hub if empty 20 | REGISTRY: docker.io 21 | # github.repository as / 22 | IMAGE_NAME: carlosedp/arm_exporter 23 | 24 | 25 | jobs: 26 | build: 27 | 28 | runs-on: ubuntu-latest 29 | permissions: 30 | contents: read 31 | packages: write 32 | 33 | steps: 34 | - name: Checkout repository 35 | uses: actions/checkout@v2 36 | 37 | - name: Set up QEMU 38 | uses: docker/setup-qemu-action@v1 39 | 40 | - name: Set up Docker Buildx 41 | uses: docker/setup-buildx-action@v1 42 | 43 | - name: Login to DockerHub 44 | uses: docker/login-action@v1 45 | with: 46 | username: ${{ secrets.DOCKERHUB_USERNAME }} 47 | password: ${{ secrets.DOCKERHUB_TOKEN }} 48 | 49 | # Extract metadata (tags, labels) for Docker 50 | # https://github.com/docker/metadata-action 51 | - name: Extract Docker metadata 52 | id: meta 53 | uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 54 | with: 55 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 56 | 57 | # Build and push Docker image with Buildx (don't push on PR) 58 | # https://github.com/docker/build-push-action 59 | - name: Build and push Docker image 60 | uses: docker/build-push-action@v2 61 | with: 62 | context: . 63 | push: ${{ github.event_name != 'pull_request' }} 64 | tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest 65 | labels: ${{ steps.meta.outputs.labels }} 66 | platforms: linux/arm,linux/arm64,linux/arm/v6 67 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Build with: docker buildx build -t carlosedp/arm_exporter:latest --platform linux/arm,linux/arm64 -f Dockerfile --push . 2 | # Builder container 3 | FROM --platform=$BUILDPLATFORM golang:1.17 AS builder 4 | ARG TARGETPLATFORM 5 | ARG TARGETOS 6 | ARG TARGETARCH 7 | 8 | WORKDIR $GOPATH 9 | 10 | ENV PROJECT github.com/lukasmalkmus/rpi_exporter 11 | ENV CGO_ENABLED=0 12 | 13 | RUN mkdir -p $GOPATH/src/github.com/lukasmalkmus && \ 14 | git clone https://$PROJECT $GOPATH/src/$PROJECT && \ 15 | cd $GOPATH/src/$PROJECT && \ 16 | GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -ldflags '-s -w -extldflags "-static"' -o main . && \ 17 | mv main / 18 | 19 | # Application Image 20 | FROM alpine 21 | 22 | ENV NODE_ID=none 23 | 24 | # Required for GPU temperature scrape to work 25 | RUN apk add raspberrypi 26 | 27 | COPY --from=builder /main /bin/rpi_exporter 28 | COPY ./docker-entrypoint.sh /etc/rpi_exporter/docker-entrypoint.sh 29 | RUN chmod +x /etc/rpi_exporter/docker-entrypoint.sh 30 | 31 | ENTRYPOINT [ "/etc/rpi_exporter/docker-entrypoint.sh" ] 32 | EXPOSE 9243 33 | CMD ["/bin/rpi_exporter"] 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-arm_exporter 2 | 3 | [![Build Status](https://travis-ci.org/carlosedp/docker-arm_exporter.svg?branch=master)](https://travis-ci.org/carlosedp/docker-arm_exporter) [![](https://images.microbadger.com/badges/image/carlosedp/arm_exporter.svg)](https://microbadger.com/images/carlosedp/arm_exporter "Get your own image badge on microbadger.com") 4 | 5 | ARM CPU temperature exporter for Prometheus. Exporter code by [Lukas Malkmus](https://github.com/lukasmalkmus/rpi_exporter) 6 | 7 | Usage: 8 | 9 | ## Docker Run 10 | Run the container in the same network as your Prometheus 11 | 12 | docker run -d \ 13 | --name=arm_exporter \ 14 | --restart always \ 15 | --net=monitoring \ 16 | -p 9243:9243 \ 17 | -v /etc/hostname:/etc/nodename:ro \ 18 | -v /etc/localtime:/etc/localtime:ro \ 19 | -v /etc/timezone:/etc/TZ:ro \ 20 | carlosedp/arm_exporter 21 | 22 | ## Docker Compose File (yml) 23 | 24 | rpi-exporter: 25 | image: carlosedp/arm_exporter 26 | environment: 27 | - NODE_ID={{.Node.ID}} 28 | volumes: 29 | - /etc/hostname:/etc/nodename:ro 30 | - /etc/localtime:/etc/localtime:ro 31 | - /etc/timezone:/etc/TZ:ro 32 | command: 33 | - '--collector.textfile.directory=/etc/rpi_exporter/' 34 | ports: 35 | - 9243:9243 36 | networks: 37 | - monitoring 38 | deploy: 39 | mode: global 40 | 41 | networks: 42 | monitoring: 43 | driver: overlay 44 | 45 | ## Docker Stack 46 | docker stack deploy monitoring --compose-file docker-compose-monitoring.yml 47 | 48 | ## Add target to Prometheus: 49 | 50 | - job_name: 'node' 51 | scrape_interval: 10s 52 | dns_sd_configs: 53 | - names: 54 | - 'arm_exporter' 55 | type: 'A' 56 | port: 9243 57 | 58 | Get images on [DockerHub](https://hub.docker.com/r/carlosedp/arm_exporter/) 59 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | if [ -f "/etc/nodename" ]; 4 | then 5 | NODE_NAME=$(cat /etc/nodename) 6 | echo "node_meta{node_id=\"$NODE_ID\", container_label_com_docker_swarm_node_id=\"$NODE_ID\", node_name=\"$NODE_NAME\"} 1" > /etc/rpi_exporter/node-meta.prom 7 | 8 | set -- /bin/rpi_exporter "$@" 9 | 10 | exec "$@" 11 | else 12 | echo "No /etc/nodename has been set, running with no nodename identifier." 13 | exec "$@" 14 | fi 15 | --------------------------------------------------------------------------------