Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/walkure/pushproxy-light
https://github.com/walkure/pushproxy-light
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/walkure/pushproxy-light
- Owner: walkure
- License: apache-2.0
- Created: 2021-05-16T14:01:33.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-05-16T14:01:42.000Z (over 3 years ago)
- Last Synced: 2024-12-23T15:48:20.392Z (28 days ago)
- Language: Go
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pushproxy-light
A primitive proxy implementation to transverse NAT for [Prometheus](https://prometheus.io/) like [PushProx](https://github.com/prometheus-community/PushProx) and [Pushgateway](https://github.com/prometheus/pushgateway).
# Difference from PushProx / Pushgateway
## PushProx
- Push metrics from client exporting program directly.## Pushgateway
- Metrics data has lifetime.# Motivation
I tried to use PushProx to monitor a Raspberry Pi Model B that was doing environmental observations of the room and executing dump1090/rtl-sdr. However I could not execute PushProx client due to limitation of computing resouces(dump1090 is so heavy). ;(.
# Usage
`pushprox-light --preSharedKey=hogehoge ...`- `--preSharedKey` (mandatory)
- Pre-Shared Key to sign metrics data.
- `--metricsLifetime` default=5
- Metrics Lifetime in minutes.
- `--httpListener` default=`:8080`
- Listening Address/Port
- `--proxyMetricsPath` default=`/metrics`
- Path URI of Metrics where Prometheus scapes.
- `--pushURIPrefix`
- Path Prefix of retrieving metrics URI(e.g. behind reverse proxy)# Push Protocol
PushProx-light accepts JSON text as metrics data(body).Send signature with pre-shared key for tamper detection and authentication.
## HTTP Methods
- GET
- `URL?signature=SIGNATURE&body=BODY`
- POST as Form data (`application/x-www-form-urlencoded`).
- `signature=SIGNATURE&body=BODY`
- POST JSON (`application/json`)
- `X-Signature` Header shows signature.
- body is POST body.## Push URL Path
`/push/{{hostname}}`
{{hostname}} is the same as the hostname in the Prometheus configuration.
## body
Metrics data expressed as JSON.```json
{
"name of metrics": {
"type": "gauge/counter",
"help": "description of metrics",
"metrics": [{
"value": "11.1",
"labels": {
"key1": "value1",
"key2": "value2"
}
}]
}
}
```## signature
`alg := '1'(md5),'5'(sha256)','6'(sha512)`
`signature := fmt.Sprintf("%c%x",alg, md5/sha256/sha512.Sum(body+preSharedKey))`
# Dependeicies
- [github.com/gorilla/mux](https://github.com/gorilla/mux)
- [github.com/patrickmn/go-cache](https://github.com/patrickmn/go-cache)# Author
walkure