aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorbeorn7 <beorn@grafana.com>2019-07-06 20:21:56 +0200
committerbeorn7 <beorn@grafana.com>2019-07-06 20:21:56 +0200
commitf2891703a54ca0f4b518c77bfd4dbe0df056a6bb (patch)
tree37bceeaa0ea6ac62a0010223553e359ce940973c /docs
parentf17829c48b971a0507a47f14b0cae3950af249f7 (diff)
downloadprometheus_node_collector-f2891703a54ca0f4b518c77bfd4dbe0df056a6bb.tar.bz2
prometheus_node_collector-f2891703a54ca0f4b518c77bfd4dbe0df056a6bb.tar.xz
prometheus_node_collector-f2891703a54ca0f4b518c77bfd4dbe0df056a6bb.zip
Add Makefile to easily make output files and lint sources
Signed-off-by: beorn7 <beorn@grafana.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/node-mixin/.gitignore7
-rw-r--r--docs/node-mixin/Makefile28
2 files changed, 32 insertions, 3 deletions
diff --git a/docs/node-mixin/.gitignore b/docs/node-mixin/.gitignore
index 65d141b..522b99f 100644
--- a/docs/node-mixin/.gitignore
+++ b/docs/node-mixin/.gitignore
@@ -1,3 +1,4 @@
1/jsonnetfile.lock.json 1jsonnetfile.lock.json
2/vendor/ 2vendor
3 3*.yaml
4dashboards_out
diff --git a/docs/node-mixin/Makefile b/docs/node-mixin/Makefile
new file mode 100644
index 0000000..012a4b5
--- /dev/null
+++ b/docs/node-mixin/Makefile
@@ -0,0 +1,28 @@
1JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
2
3all: fmt node_alerts.yaml node_rules.yaml dashboards_out lint
4
5fmt:
6 find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
7 xargs -n 1 -- $(JSONNET_FMT) -i
8
9node_alerts.yaml: mixin.libsonnet config.libsonnet $(wildcard alerts/*)
10 jsonnet -S alerts.jsonnet > $@
11
12node_rules.yaml: mixin.libsonnet config.libsonnet $(wildcard rules/*)
13 jsonnet -S rules.jsonnet > $@
14
15dashboards_out: mixin.libsonnet config.libsonnet $(wildcard dashboards/*)
16 @mkdir -p dashboards_out
17 jsonnet -J vendor -m dashboards_out dashboards.jsonnet
18
19lint: node_alerts.yaml node_rules.yaml
20 find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
21 while read f; do \
22 $(JSONNET_FMT) "$$f" | diff -u "$$f" -; \
23 done
24
25 promtool check rules node_alerts.yaml node_rules.yaml
26
27clean:
28 rm -rf dashboards_out node_alerts.yaml node_rules.yaml