Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inovex/trovilo
trovilo collects and prepares files from Kubernetes ConfigMaps for Prometheus & friends
https://github.com/inovex/trovilo
alertmanager alerts configmap dashboards grafana kubernetes monitoring prometheus
Last synced: 3 months ago
JSON representation
trovilo collects and prepares files from Kubernetes ConfigMaps for Prometheus & friends
- Host: GitHub
- URL: https://github.com/inovex/trovilo
- Owner: inovex
- License: apache-2.0
- Created: 2018-03-10T22:16:08.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-21T07:14:02.000Z (over 5 years ago)
- Last Synced: 2024-09-30T08:03:06.026Z (4 months ago)
- Topics: alertmanager, alerts, configmap, dashboards, grafana, kubernetes, monitoring, prometheus
- Language: Go
- Homepage:
- Size: 52.7 KB
- Stars: 16
- Watchers: 16
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# trovilo
[![Build Status](https://travis-ci.org/inovex/trovilo.png?branch=master)](https://travis-ci.org/inovex/trovilo)
[![Go Report Card](https://goreportcard.com/badge/github.com/inovex/trovilo)](https://goreportcard.com/report/github.com/inovex/trovilo)
[![Docker Pulls](https://img.shields.io/docker/pulls/inovex/trovilo.svg?maxAge=604800)](https://hub.docker.com/r/inovex/trovilo/)trovilo collects and prepares files from Kubernetes ConfigMaps for Prometheus & friends.
## Philosophy
This simple helper tool aims to collect ConfigMaps (files) via the Kubernetes API and writes them down into the filesystem, that may be internally processed by apps like Prometheus or Grafana. It focuses to serve this purpose only on a very generic way. This means it's not meant to work with a specific app only and won't contain such specific code. Instead we try to provide an extensive UI and try keep the code maintainable.
Contributions are highly appreciated. :)
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Setup your GO environment if not already done:
```
$ export GOPATH=${HOME}/GOPATH GOBIN=${HOME}/GOPATH/bin
``````
$ go get -u github.com/inovex/trovilo/cmd/trovilo
$ $GOBIN/trovilo --help
usage: trovilo --config=CONFIG []Trovilo collects and prepares files from Kubernetes ConfigMaps for Prometheus & friends
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--config=CONFIG YAML configuration file.
--kubeconfig=KUBECONFIG Optional kubectl configuration file. If undefined we expect trovilo is running in a pod.
--log-level="info" Specify log level (debug, info, warn, error).
--log-json Enable JSON-formatted logging on STDOUT.
-v, --version Show application version.
```## Deployment
Deploy the binary to your target systems or use the [official Docker image](https://hub.docker.com/r/inovex/trovilo/). Notice: The *tools*-tagged Docker image additionally contains useful tools for verify or post-deploy commands.
Simple trovilo example configuration file:
```
$ cat trovilo-config.yaml
# Which namespace to check (empty string means all namespaces)
#namespace: ""
jobs:
# Arbitrary name for identification (and troubleshooting in logs)
- name: alert-rules
# Kubernetes-styled label selector to define how to find ConfigMaps
selector:
type: prometheus-alerts
verify:
# Example verification step to check whether the contents of the ConfigMap are valid Prometheus alert files. %s will be replaced by the ConfigMap's file path(s).
- name: verify alert rule validity
cmd: ["promtool", "check", "rules", "%s"]
target-dir: /etc/prometheus-alerts/
# Enable directory flattening so all ConfigMap files will be placed into a single directory
flatten: true
# After successfully verifying the ConfigMap and deploying it into the target-dir, run the following commands to trigger (e.g. Prometheus) manual config reloads
post-deploy:
- name: reload prometheus
cmd: ["curl", "-s", "-X", "POST", "http://localhost:9090/-/reload"]
# Another job example, but for Grafana dashboards (JSON model)
- name: grafana-dashboards
selector:
type: grafana-dashboards
target-dir: tmp/target-grafana-dashboards/
```Full example Kubernetes deployment with Prometheus:
```
$ kubectl apply \
-f https://raw.githubusercontent.com/inovex/trovilo/master/examples/k8s/alert-rules-team1.yaml \
-f https://raw.githubusercontent.com/inovex/trovilo/master/examples/k8s/prometheus-config.yaml \
-f https://raw.githubusercontent.com/inovex/trovilo/master/examples/k8s/trovilo-config.yaml \
-f https://raw.githubusercontent.com/inovex/trovilo/master/examples/k8s/deployment.yaml
```
## AlternativesSome projects with very similar use case(s):
* [PierreVincent/k8s-grafana-watcher](https://github.com/PierreVincent/k8s-grafana-watcher)
* [nordstrom/prometheusRuleLoader](https://github.com/nordstrom/prometheusRuleLoader)
* [stakater/Reloader](https://github.com/stakater/Reloader)## License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details