add make deploy

This commit is contained in:
Vitaly Zhuravlev 2022-05-11 21:47:39 +04:00
parent 5e83738d1d
commit a9f76485dd
2 changed files with 32 additions and 1 deletions

View file

@ -29,6 +29,24 @@ dashboards_out: mixin.libsonnet config.libsonnet $(wildcard dashboards/*)
prometheus_alerts.yaml: mixin.libsonnet alerts/*.libsonnet
mixtool generate alerts mixin.libsonnet -a prometheus_alerts.yaml
.PHONY: deploy deploy_rules deploy_dashboards
deploy: deploy_rules deploy_dashboards
deploy_dashboards:
ifdef GRAFANA_URL
grr apply mixin.libsonnet --target "Dashboard.*" --target "DashboardFolder.*"
else
$(warning GRAFANA_URL is not set, skipping grafana dashboards deployment)
endif
deploy_rules:
ifdef CORTEX_ADDRESS
grr apply mixin.libsonnet --target "PrometheusRuleGroup.*"
else
$(warning CORTEX_ADDRESS is not set, skipping prometheus alerts deployment)
endif
.PHONY: clean
clean:
rm -rf dashboards_out prometheus_alerts.yaml

View file

@ -4,7 +4,7 @@ Apache HTTP mixin is a set of configurable Grafana dashboards and alerts based o
![image](https://user-images.githubusercontent.com/14870891/167886371-92c60942-bbfa-43d2-ba16-ee13e629020a.png)
Install tools before generating dashboards and alerts:
## Install tools
```bash
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
@ -23,11 +23,24 @@ into your Grafana server. The exact details will be depending on your environme
`prometheus_alerts.yaml` needs to be imported into Prometheus.
## Generate dashboards and alerts
Edit `config.libsonnet` if required and then build JSON dashboard files for Grafana:
```bash
make
```
## Import dashboards and alerts using Grizzly tool
Install grizzly first: https://grafana.github.io/grizzly/installation/
Set env variables GRAFANA_URL and optionally CORTEX_ADDRESS (see for [details](https://grafana.github.io/grizzly/authentication/)).
Then run to actually import the dashboards and alerts into Grafana instance:
```bash
make deploy
```
For more advanced uses of mixins, see
https://github.com/monitoring-mixins/docs.