Prometheus GitHub Exporter
Exposes basic metrics for your repositories from the GitHub API, to a Prometheus compatible endpoint.
This exporter was forked from: https://github.com/infinityworks/github-exporter - help is wanted to fill in the gaps and community requests of the upstream project.
This is a friendly, helpful soft fork of the work of @rucknar.
This exporter is setup to take input from environment variables:
ORGSIf supplied, the exporter will enumerate all repositories for that organization. Expected in the format "org1, org2".
REPOSIf supplied, The repos you wish to monitor, expected in the format "user/repo1, user/repo2". Can be across different Github users/orgs.
USERSIf supplied, the exporter will enumerate all repositories for that users. Expected in the format "user1, user2".
At least one of those 3 options should be provided.
GITHUB_TOKENIf supplied, enables the user to supply a github authentication token that allows the API to be queried more often. Optional, but recommended.
GITHUB_TOKEN_FILEIf supplied instead of
GITHUB_TOKEN, enables the user to supply a path to a file containing a github authentication token that allows the API to be queried more often. Optional, but recommended.
API_URLGithub API URL, shouldn't need to change this. Defaults to
LISTEN_PORTThe port you wish to run the container on, the Dockerfile defaults this to
METRICS_PATHthe metrics URL path you wish to use, defaults to
LOG_LEVELThe level of logging the exporter will run with, defaults to
Install and deploy
Run manually from Docker Hub:
docker run -d --restart=always -p 9171:9171 -e REPOS="infinityworks/ranch-eye, infinityworks/prom-conf" alexellis/github-exporter:0.1.0
Build a docker image:
docker build -t <image-name> . docker run -d --restart=always -p 9171:9171 -e REPOS="infinityworks/ranch-eye, infinityworks/prom-conf" <image-name>
github-exporter: tty: true stdin_open: true expose: - 9171 ports: - 9171:9171 image: alexellis/github-exporter:0.1.0 environment: - REPOS=<REPOS you want to monitor> - GITHUB_TOKEN=<your github api token>
Metrics will be made available on port 9171 by default
An example of these metrics can be found in the
METRICS.md markdown file in the root of this repository
- Propose change via an Issue
- Wait for approval from maintainer
- Sign off every commit with
git commit -sas part of the Developer Certificate of Origin.
Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.