Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bwplotka/promeval
Test your Prometheus configuration locally before rollout! (:
https://github.com/bwplotka/promeval
configuration evaluation golang prometheus
Last synced: about 1 month ago
JSON representation
Test your Prometheus configuration locally before rollout! (:
- Host: GitHub
- URL: https://github.com/bwplotka/promeval
- Owner: bwplotka
- License: apache-2.0
- Created: 2018-01-02T21:20:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-13T22:46:42.000Z (about 6 years ago)
- Last Synced: 2024-12-27T07:03:27.271Z (about 1 month ago)
- Topics: configuration, evaluation, golang, prometheus
- Language: Go
- Homepage:
- Size: 25.1 MB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# promeval
NOTE: This started for good reasons, but `promtool` catches pretty quickly on tooling, checks and linters.
`promeval` is a small CLI tool that allows to test your scrape configuration before
attaching it to the Prometheus instance.## Setup
- setup your `$GOPATH`
- add `$GOPATH/bin` to your `$PATH`
- get tool:```
go get github.com/Bplotka/promeval
make install-tools
dep ensure
make build
```Hardest part:
If you want to run promeval on your local machine you need to "reproduce" setup you have on your Prometheus instance to have proper results.
For example for Kubernetes default SD config you need:
* KUBERNETES_SERVICE_HOST env variable
* KUBERNETES_SERVICE_PORT env variable
* `/var/run/secrets/kubernetes.io/serviceaccount/token`
* `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`All of this depends on your Prometheus scraping configuration.
Tool should print properly what is missing in case of missing configuration against certain service discoveries.
## Usage
### Targets
`targets` command allows you to print all discovered jobs after and before relabel.
You can use `--job` and `--source` flags that print only certain sources/jobs.For example:
`./promeval targets prometheus_config.yaml --job=kubernetes-pods --source=pod/default/service`will evaluate given prometheus config and print labels that will be used for Kubernetes
pod running in default namespace called "service". E.g:```
{
"job_name": "kubernetes-pods",
"source": "pod/default/service",
"before": {
"__address__": "...,
"__meta_kubernetes_namespace": "default",
"__meta_kubernetes_pod_annotation_kubernetes_io_created_by": "{\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"StatefulSet\",\"namespace\":\"default\",\...",
"__meta_kubernetes_pod_annotation_pod_alpha_kubernetes_io_initialized": "true",
"__meta_kubernetes_pod_annotation_pod_beta_kubernetes_io_hostname": "...",
"__meta_kubernetes_pod_annotation_pod_beta_kubernetes_io_subdomain": "...",
"__meta_kubernetes_pod_annotation_prometheus_io_path": "/metrics",
"__meta_kubernetes_pod_annotation_prometheus_io_scheme": "http",
"__meta_kubernetes_pod_container_name": "service",
"__meta_kubernetes_pod_container_port_name": "http",
"__meta_kubernetes_pod_container_port_number": "...",
"__meta_kubernetes_pod_container_port_protocol": "TCP",
"__meta_kubernetes_pod_host_ip": "....",
"__meta_kubernetes_pod_ip": "...",
"__meta_kubernetes_pod_label_component": "service",
"__meta_kubernetes_pod_name": "...",
"__meta_kubernetes_pod_node_name": "....",
"__meta_kubernetes_pod_ready": "true",
"__metrics_path__": "/metrics",
"__scheme__": "http",
"job": "kubernetes-pods"
},
"after": {
"__address__": "....",
"__metrics_path__": "/metrics",
"__scheme__": "http",
}
},
```NOTE: It is useful to actually print all before narrowing that to job and source to know exact name for `source` (: It is not straightforward and depends on your job.
Alternatively you can specify prometheus config from Kubernetes configmap directly (named with the key "prometheus.yaml"):
`./promeval targets configmap.yaml --configmap-item=prometheus.yaml --job=kubernetes-pods --source=pod/default/service`
### relabel
WIP: Basic idea is to feed labels that you are interested in manually and do relabel on it using given relabeling from your config.