Skip to content

Commit 51225e1

Browse files
committedMar 2, 2021
feat(mixin): Add grafana mixins support for postgres exporter
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
1 parent 21f27a8 commit 51225e1

File tree

7 files changed

+1389
-0
lines changed

7 files changed

+1389
-0
lines changed
 

‎postgres_mixin/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/alerts.yaml
2+
/rules.yaml
3+
dashboards_out

‎postgres_mixin/Makefile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
2+
3+
default: build
4+
5+
all: fmt lint build clean
6+
7+
fmt:
8+
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
9+
xargs -n 1 -- $(JSONNET_FMT) -i
10+
11+
lint:
12+
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
13+
while read f; do \
14+
$(JSONNET_FMT) "$$f" | diff -u "$$f" -; \
15+
done
16+
17+
mixtool lint mixin.libsonnet
18+
19+
build:
20+
mixtool generate all mixin.libsonnet
21+
22+
clean:
23+
rm -rf dashboards_out alerts.yaml rules.yaml

‎postgres_mixin/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Postgres Mixin
2+
3+
_This is a work in progress. We aim for it to become a good role model for alerts
4+
and dashboards eventually, but it is not quite there yet._
5+
6+
The Postgres Mixin is a set of configurable, reusable, and extensible alerts and
7+
dashboards based on the metrics exported by the Postgres Exporter. The mixin creates
8+
recording and alerting rules for Prometheus and suitable dashboard descriptions
9+
for Grafana.
10+
11+
To use them, you need to have `mixtool` and `jsonnetfmt` installed. If you
12+
have a working Go development environment, it's easiest to run the following:
13+
```bash
14+
$ go get github.com/monitoring-mixins/mixtool/cmd/mixtool
15+
$ go get github.com/google/go-jsonnet/cmd/jsonnetfmt
16+
```
17+
18+
You can then build the Prometheus rules files `alerts.yaml` and
19+
`rules.yaml` and a directory `dashboard_out` with the JSON dashboard files
20+
for Grafana:
21+
```bash
22+
$ make build
23+
```
24+
25+
For more advanced uses of mixins, see
26+
https://github.com/monitoring-mixins/docs.
File renamed without changes.

0 commit comments

Comments
 (0)