A GoCache API Exporter for Prometheus.
The gocache_exporter is a simple server that removes the GoCache API to obtain domain access statistics and exports them via HTTP for consumption by Prometheus.
First I would like to share with everyone that this was my first code using GO. I believe this will definitely not be the best code you will see. But it was the only alternative to capture metrics from the GoCache platform. I decided to publish this repository not only because I lack knowledge in the language but to be able to use the strength of a community to improve this code. I count on everyone's help.
The first step is to grab an API key from the GoCache site. Metrics are captured based on this doc. GoCache Api.
Important: Be advised to set a high scrape interval (e.g. 5min). Each scrape performs a direct API call and to frequent requests can lead to the deauthorization of your API key!
Note: Since gocache isn't a very handy word, the metric namespace is
gocache
.
TODO: The easiest way to run the gocache is by grabbing the latest binary from the [release page][release].
git clone https://github.com/felipegfalcao/gocache-prometheus-exporter
cd gocache-prometheus-exporter
go build .
./gocache-prometheus-exporter [flags]
./gocache-prometheus-exporter -domain <DOMAIN> -token <token_GoCache>
At the moment we can pass another -host argument that allows filtering by subdomain. The value must be the complete subdomain (ex: www.yourdomain.com)
./gocache-prometheus-exporter -domain <DOMAIN> -token <TOKEN_GoCache> -host <host>
###We are currently with a fixed value in the range of capturing latest value
Feel free to submit PRs or to fill Issues. Every kind of help is appreciated.
Distributed under Apache License (Apache License, Version 2.0
).
See LICENSE for more information.