1 Star 2 Fork 1

GiteeStudio / gitee-exporter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Prometheus Gitee Exporter

Exposes basic metrics for your repositories from the Gitee API, to a Prometheus compatible endpoint.

( Most of the inspiration comes from github-exporter, thanks to the infinityworks team for bringing us such wonderful examples. )

Configuration

This exporter is setup to take input from environment variables:

Required

  • ORGS If supplied, the exporter will enumerate all repositories for that organization. Expected in the format "org1, org2".
  • REPOS If supplied, The repos you wish to monitor, expected in the format "user/repo1, user/repo2". Can be across different Gitee users/orgs.
  • USERS If 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.

Optional

  • GITEE_TOKEN If supplied, enables the user to supply a gitee authentication token that allows the API to be queried more often. Optional, but recommended.
  • GITEE_TOKEN_FILE If supplied instead of GITEE_TOKEN, enables the user to supply a path to a file containing a gitee authentication token that allows the API to be queried more often. Optional, but recommended.
  • API_URL Gitee API URL, shouldn't need to change this. Defaults to https://gitee.com/api/v5
  • LISTEN_PORT The port you wish to run the container on, the Dockerfile defaults this to 9190
  • METRICS_PATH the metrics URL path you wish to use, defaults to /metrics
  • LOG_LEVEL The level of logging the exporter will run with, defaults to debug

Install and deploy

Run manually from Docker Hub:

docker run -d --restart=always -p 9190:9190 -e REPOS="oscstudio/gitee-exporter, atompitestorg/testrepo" oscstudio/gitee-exporter

Build a docker image:

docker build -t <image-name> .
docker run -d --restart=always -p 9190:9190 -e REPOS="oscstudio/gitee-exporter, atompitestorg/testrepo" <image-name>

Docker compose

gitee-exporter:
    tty: true
    stdin_open: true
    expose:
      - 9190
    ports:
      - 9190:9190
    image: oscstudio/gitee-exporter:latest
    environment:
      - REPOS=<REPOS you want to monitor>
      - GITEE_TOKEN=<your gitee api token>

Metrics

Metrics will be made available on port 9190 by default An example of these metrics can be found in the METRICS.md markdown file in the root of this repository

Tests

There is a set of blackbox behavioural tests which validate metrics endpoint in the test directory. Run as follows

make test
The MIT License (MIT) Copyright (c) 2016 Infinity Works Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Prometheus exporter for gitee metrics 展开 收起
Go 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/oscstudio/gitee-exporter.git
git@gitee.com:oscstudio/gitee-exporter.git
oscstudio
gitee-exporter
gitee-exporter
master

搜索帮助