aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorbeorn7 <beorn@grafana.com>2019-07-06 21:09:17 +0200
committerbeorn7 <beorn@grafana.com>2019-07-06 21:11:23 +0200
commitf331b308f36012d6c00d00914ce2165c996ed321 (patch)
treee9814db978096d65ab4a5997aa03516e096066d4 /docs
parente5266c242e4f6243e33d7893f0bd76e2c895dc75 (diff)
downloadprometheus_node_collector-f331b308f36012d6c00d00914ce2165c996ed321.tar.bz2
prometheus_node_collector-f331b308f36012d6c00d00914ce2165c996ed321.tar.xz
prometheus_node_collector-f331b308f36012d6c00d00914ce2165c996ed321.zip
Use promgrafonnet as a vendored library from its source
The only deviation that happened so far is to use format="percentunit" in a Grafana gauge. This change wasn't even properly used in this repo so far, so I opted to stick with "upstream" for now. If changes are really needed, we can try to change upstream first. Another change was done in parallal here and upstream, but it was "more correct" in upstream. (Change datasource to $datasource variable, only partially applied here.) Which is another point for using the upstream and not copy it here. Signed-off-by: beorn7 <beorn@grafana.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/node-mixin/dashboards/node.libsonnet2
-rw-r--r--docs/node-mixin/jsonnetfile.json10
-rw-r--r--docs/node-mixin/lib/promgrafonnet/gauge.libsonnet60
-rw-r--r--docs/node-mixin/lib/promgrafonnet/numbersinglestat.libsonnet48
-rw-r--r--docs/node-mixin/lib/promgrafonnet/promgrafonnet.libsonnet5
5 files changed, 11 insertions, 114 deletions
diff --git a/docs/node-mixin/dashboards/node.libsonnet b/docs/node-mixin/dashboards/node.libsonnet
index 4594e3e..80e2fa9 100644
--- a/docs/node-mixin/dashboards/node.libsonnet
+++ b/docs/node-mixin/dashboards/node.libsonnet
@@ -4,7 +4,7 @@ local row = grafana.row;
4local prometheus = grafana.prometheus; 4local prometheus = grafana.prometheus;
5local template = grafana.template; 5local template = grafana.template;
6local graphPanel = grafana.graphPanel; 6local graphPanel = grafana.graphPanel;
7local promgrafonnet = import '../lib/promgrafonnet/promgrafonnet.libsonnet'; 7local promgrafonnet = import 'promgrafonnet/promgrafonnet.libsonnet';
8local gauge = promgrafonnet.gauge; 8local gauge = promgrafonnet.gauge;
9 9
10{ 10{
diff --git a/docs/node-mixin/jsonnetfile.json b/docs/node-mixin/jsonnetfile.json
index fc5aeee..dc92880 100644
--- a/docs/node-mixin/jsonnetfile.json
+++ b/docs/node-mixin/jsonnetfile.json
@@ -19,6 +19,16 @@
19 } 19 }
20 }, 20 },
21 "version": "master" 21 "version": "master"
22 },
23 {
24 "name": "promgrafonnet",
25 "source": {
26 "git": {
27 "remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
28 "subdir": "lib/promgrafonnet"
29 }
30 },
31 "version": "master"
22 } 32 }
23 ] 33 ]
24} 34}
diff --git a/docs/node-mixin/lib/promgrafonnet/gauge.libsonnet b/docs/node-mixin/lib/promgrafonnet/gauge.libsonnet
deleted file mode 100644
index 43640b6..0000000
--- a/docs/node-mixin/lib/promgrafonnet/gauge.libsonnet
+++ /dev/null
@@ -1,60 +0,0 @@
1local grafana = import 'grafonnet/grafana.libsonnet';
2local singlestat = grafana.singlestat;
3local prometheus = grafana.prometheus;
4
5{
6 new(title, query)::
7 singlestat.new(
8 title,
9 datasource='$datasource',
10 span=3,
11 format='percentunit',
12 valueName='current',
13 colors=[
14 'rgba(245, 54, 54, 0.9)',
15 'rgba(237, 129, 40, 0.89)',
16 'rgba(50, 172, 45, 0.97)',
17 ],
18 thresholds='50, 80',
19 valueMaps=[
20 {
21 op: '=',
22 text: 'N/A',
23 value: 'null',
24 },
25 ],
26 )
27 .addTarget(
28 prometheus.target(
29 query
30 )
31 ) + {
32 gauge: {
33 maxValue: 100,
34 minValue: 0,
35 show: true,
36 thresholdLabels: false,
37 thresholdMarkers: true,
38 },
39 withTextNullValue(text):: self {
40 valueMaps: [
41 {
42 op: '=',
43 text: text,
44 value: 'null',
45 },
46 ],
47 },
48 withSpanSize(size):: self {
49 span: size,
50 },
51 withLowerBeingBetter():: self {
52 colors: [
53 'rgba(50, 172, 45, 0.97)',
54 'rgba(237, 129, 40, 0.89)',
55 'rgba(245, 54, 54, 0.9)',
56 ],
57 thresholds: '80, 90',
58 },
59 },
60}
diff --git a/docs/node-mixin/lib/promgrafonnet/numbersinglestat.libsonnet b/docs/node-mixin/lib/promgrafonnet/numbersinglestat.libsonnet
deleted file mode 100644
index bc1d6f6..0000000
--- a/docs/node-mixin/lib/promgrafonnet/numbersinglestat.libsonnet
+++ /dev/null
@@ -1,48 +0,0 @@
1local grafana = import 'grafonnet/grafana.libsonnet';
2local singlestat = grafana.singlestat;
3local prometheus = grafana.prometheus;
4
5{
6 new(title, query)::
7 singlestat.new(
8 title,
9 datasource='prometheus',
10 span=3,
11 valueName='current',
12 valueMaps=[
13 {
14 op: '=',
15 text: '0',
16 value: 'null',
17 },
18 ],
19 )
20 .addTarget(
21 prometheus.target(
22 query
23 )
24 ) + {
25 withTextNullValue(text):: self {
26 valueMaps: [
27 {
28 op: '=',
29 text: text,
30 value: 'null',
31 },
32 ],
33 },
34 withSpanSize(size):: self {
35 span: size,
36 },
37 withPostfix(postfix):: self {
38 postfix: postfix,
39 },
40 withSparkline():: self {
41 sparkline: {
42 show: true,
43 lineColor: 'rgb(31, 120, 193)',
44 fillColor: 'rgba(31, 118, 189, 0.18)',
45 },
46 },
47 },
48}
diff --git a/docs/node-mixin/lib/promgrafonnet/promgrafonnet.libsonnet b/docs/node-mixin/lib/promgrafonnet/promgrafonnet.libsonnet
deleted file mode 100644
index 013ff42..0000000
--- a/docs/node-mixin/lib/promgrafonnet/promgrafonnet.libsonnet
+++ /dev/null
@@ -1,5 +0,0 @@
1{
2 numbersinglestat:: import 'numbersinglestat.libsonnet',
3 gauge:: import 'gauge.libsonnet',
4 percentlinegraph:: import 'percentlinegraph.libsonnet',
5}