https://github.com/mnitchev/metrics-example
https://github.com/mnitchev/metrics-example
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mnitchev/metrics-example
- Owner: mnitchev
- Created: 2018-10-31T08:30:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-01T08:55:17.000Z (over 7 years ago)
- Last Synced: 2025-02-28T17:41:32.383Z (over 1 year ago)
- Language: Go
- Size: 3.65 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sending container metrics from Kubernetes to Doppler
*_NOTE:_* This is example code from this [spike](https://www.pivotaltracker.com/story/show/160848366)
### Prerequisites
1. Kube cluster with [heapster](https://github.com/kubernetes/heapster) installed (should be installed by default if the cluster is version <=1.10)
2. A doppler running somewhere that's reachable from inside the cluster
### Example code
The example gathers the metrics for all pods running in the `opi` namespace. Unfortunately the metrics that are returned are just `cpu` and `memory` and doppler [requires](https://github.com/cloudfoundry/loggregator-api#containermetric) also `disk`, `disk_quota` and `memory_quota` to also be set for it to interpret the Envelope as a ContainerMetric.
To emit the envelopes the [go-loggregator](https://github.com/cloudfoundry/go-loggregator/) client is used. The client has a [hardcoded value](https://github.com/cloudfoundry/go-loggregator/blob/master/tls.go#L13) for the "serverName" for which the doppler certificates are valid. In this example the code in `vendor` has been changed but a more permanent solution would be to add the "metron" alternative name to the certificates.