Sign inSign up

badsmoke/docker-hub-exporter

By badsmoke

•Updated almost 4 years ago

Image
0

242

badsmoke/docker-hub-exporter repository overview

Github Repo⁠

⁠docker hub exporter for promtheus
⁠arch:
-amd64

⁠env

The available environment variables are:

  • BIND_PORT The port you wish to run the container on, defaults to 9170
  • ORGS The docker hub organizations you wish to monitor, expected in the format "org1, org2" (Also works for users)
  • IMAGES The images you wish to monitor, expected in the format "user/image1, user/image2". Can be across different dockerhub users. If empty -> all images

Below is a list of the available flags. You can also find this list by using the --help flag.

  • images Images you wish to monitor: expected format 'user/image1,user/image2'
  • listen-address Address on which to expose metrics and web interface. (default ":9170")
  • organisations Organisations/Users you wish to monitor: expected format 'org1,org2'
  • telemetry-path Path under which to expose metrics. (default "/metrics")

⁠Docker run / docker-compose

⁠docker run:
docker run -d --restart=always -p 9170:9170 badsmoke/docker-hub-exporter -listen-address=:9170 -images="badsmoke/mjpg-streamer,badsmoke/quay" -organisations="badsmoke"
⁠docker-compose:
version: '2'
services:
  docker-hub-exporter:
    image: badsmoke/docker-hub-exporter
    ports:
        - 9170:9170
    environment:
        - "ORGS=badsmoke"
        - "BIND_PORT=9170"


⁠Dockerfile:

FROM golang:1.19.3-alpine3.16 as builder





RUN apk --update add ca-certificates \
    && apk --update add --virtual build-deps git


WORKDIR /app


COPY ./src/ ./.
RUN go mod download


RUN go build -v -o exporter .



FROM alpine
LABEL maintainer badsmoke "[email protected]"


EXPOSE 9170

RUN addgroup exporter \
     && adduser -S -G exporter exporter \
     && apk --update --no-cache add ca-certificates

COPY --from=builder /app/exporter .

RUN chmod +x exporter



USER exporter

ENTRYPOINT ["/exporter"]


⁠sample output


# HELP docker_hub_image_last_updated last_updated
# TYPE docker_hub_image_last_updated gauge
docker_hub_image_last_updated{image="mjpg-streamer",user="badsmoke"} 1.583915174970809e+09
# HELP docker_hub_image_pulls_total pulls_total
# TYPE docker_hub_image_pulls_total counter
docker_hub_image_pulls_total{image="mjpg-streamer",user="badsmoke"} 869609
# HELP docker_hub_image_stars stars
# TYPE docker_hub_image_stars gauge
docker_hub_image_stars{image="mjpg-streamer",user="badsmoke"} 3.0

Tag summary

Content type

Image

Digest

sha256:6daf262e7…

Size

9.4 MB

Last updated

almost 4 years ago

docker pull badsmoke/docker-hub-exporter