https://github.com/hdecarne-github/github-telegraf-plugin
Simple Telegraf plugin to gather GitHub statistics
https://github.com/hdecarne-github/github-telegraf-plugin
github monitoring telegraf
Last synced: 5 months ago
JSON representation
Simple Telegraf plugin to gather GitHub statistics
- Host: GitHub
- URL: https://github.com/hdecarne-github/github-telegraf-plugin
- Owner: hdecarne-github
- License: mit
- Created: 2022-05-15T08:17:41.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-14T11:51:26.000Z (over 2 years ago)
- Last Synced: 2024-06-21T10:58:50.641Z (about 2 years ago)
- Topics: github, monitoring, telegraf
- Language: Go
- Homepage:
- Size: 202 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/hdecarne-github/github-telegraf-plugin/releases)
[](https://github.com/hdecarne-github/github-telegraf-plugin/actions/workflows/build.yml)
[](https://sonarcloud.io/summary/new_code?id=hdecarne-github_github-telegraf-plugin)
## About github-telegraf-plugin
This [Telegraf](https://github.com/influxdata/telegraf) input plugin gathers repository stats from [GitHub](https://github.com/). It uses GitHub's [REST API](https://docs.github.com/en/rest) to retrieve the stats.
### Installation
To install the plugin you have to download a suitable [release archive](https://github.com/hdecarne-github/github-telegraf-plugin/releases) and extract it or build it from source by cloning the repository and issueing a simple
```
make
```
To build the plugin, Go version 1.16 or higher is required. The resulting plugin binary will be written to **./build/bin**.
Copy the either extracted or built plugin binary to a location of your choice (e.g. /usr/local/bin/telegraf/).
### Configuration
This is an [external plugin](https://github.com/influxdata/telegraf/blob/master/docs/EXTERNAL_PLUGINS.md) which has to be integrated via Telegraf's [excecd plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/execd).
To use it you have to create a plugin specific config file (e.g. /etc/telegraf/github.conf) with following template content:
```toml
[[inputs.github]]
## The repositories (/) to query
repos = ["influxdata/telegraf"]
## The API base URL to use for API access (empty URL defaults to https://api.github.com/)
# api_base_url = ""
## The Personal Access Token to use for API access
# access_token = ""
## The http timeout to use (in seconds)
# timeout = 10
## Enable debug output
# debug = false
```
The most important setting is the **repos** line. It defines the repositories (/) to query. At least one repository has to be defined.
To enable the plugin within your Telegraf instance, add the following section to your **telegraf.conf**
```toml
[[inputs.execd]]
command = ["/usr/local/bin/telegraf/github-telegraf-plugin", "-config", "/etc/telegraf/github.conf", "-poll_interval", "3600s"]
signal = "none"
```
Make sure to choose a high poll interval, to not waste your rate limit. As the github stats are low-traffic stats, there is furthermore no need to poll in high frequency mode.
### License
This project is subject to the the MIT License.
See [LICENSE](./LICENSE) information for details.