diff --git a/docs/node-mixin/dashboards/node.libsonnet b/docs/node-mixin/dashboards/node.libsonnet index 4594e3ed..80e2fa92 100644 --- a/docs/node-mixin/dashboards/node.libsonnet +++ b/docs/node-mixin/dashboards/node.libsonnet @@ -4,7 +4,7 @@ local row = grafana.row; local prometheus = grafana.prometheus; local template = grafana.template; local graphPanel = grafana.graphPanel; -local promgrafonnet = import '../lib/promgrafonnet/promgrafonnet.libsonnet'; +local promgrafonnet = import 'promgrafonnet/promgrafonnet.libsonnet'; local gauge = promgrafonnet.gauge; { diff --git a/docs/node-mixin/jsonnetfile.json b/docs/node-mixin/jsonnetfile.json index fc5aeee0..dc92880d 100644 --- a/docs/node-mixin/jsonnetfile.json +++ b/docs/node-mixin/jsonnetfile.json @@ -19,6 +19,16 @@ } }, "version": "master" + }, + { + "name": "promgrafonnet", + "source": { + "git": { + "remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin", + "subdir": "lib/promgrafonnet" + } + }, + "version": "master" } ] } diff --git a/docs/node-mixin/lib/promgrafonnet/gauge.libsonnet b/docs/node-mixin/lib/promgrafonnet/gauge.libsonnet deleted file mode 100644 index 43640b6d..00000000 --- a/docs/node-mixin/lib/promgrafonnet/gauge.libsonnet +++ /dev/null @@ -1,60 +0,0 @@ -local grafana = import 'grafonnet/grafana.libsonnet'; -local singlestat = grafana.singlestat; -local prometheus = grafana.prometheus; - -{ - new(title, query):: - singlestat.new( - title, - datasource='$datasource', - span=3, - format='percentunit', - valueName='current', - colors=[ - 'rgba(245, 54, 54, 0.9)', - 'rgba(237, 129, 40, 0.89)', - 'rgba(50, 172, 45, 0.97)', - ], - thresholds='50, 80', - valueMaps=[ - { - op: '=', - text: 'N/A', - value: 'null', - }, - ], - ) - .addTarget( - prometheus.target( - query - ) - ) + { - gauge: { - maxValue: 100, - minValue: 0, - show: true, - thresholdLabels: false, - thresholdMarkers: true, - }, - withTextNullValue(text):: self { - valueMaps: [ - { - op: '=', - text: text, - value: 'null', - }, - ], - }, - withSpanSize(size):: self { - span: size, - }, - withLowerBeingBetter():: self { - colors: [ - 'rgba(50, 172, 45, 0.97)', - 'rgba(237, 129, 40, 0.89)', - 'rgba(245, 54, 54, 0.9)', - ], - thresholds: '80, 90', - }, - }, -} diff --git a/docs/node-mixin/lib/promgrafonnet/numbersinglestat.libsonnet b/docs/node-mixin/lib/promgrafonnet/numbersinglestat.libsonnet deleted file mode 100644 index bc1d6f6f..00000000 --- a/docs/node-mixin/lib/promgrafonnet/numbersinglestat.libsonnet +++ /dev/null @@ -1,48 +0,0 @@ -local grafana = import 'grafonnet/grafana.libsonnet'; -local singlestat = grafana.singlestat; -local prometheus = grafana.prometheus; - -{ - new(title, query):: - singlestat.new( - title, - datasource='prometheus', - span=3, - valueName='current', - valueMaps=[ - { - op: '=', - text: '0', - value: 'null', - }, - ], - ) - .addTarget( - prometheus.target( - query - ) - ) + { - withTextNullValue(text):: self { - valueMaps: [ - { - op: '=', - text: text, - value: 'null', - }, - ], - }, - withSpanSize(size):: self { - span: size, - }, - withPostfix(postfix):: self { - postfix: postfix, - }, - withSparkline():: self { - sparkline: { - show: true, - lineColor: 'rgb(31, 120, 193)', - fillColor: 'rgba(31, 118, 189, 0.18)', - }, - }, - }, -} diff --git a/docs/node-mixin/lib/promgrafonnet/promgrafonnet.libsonnet b/docs/node-mixin/lib/promgrafonnet/promgrafonnet.libsonnet deleted file mode 100644 index 013ff42b..00000000 --- a/docs/node-mixin/lib/promgrafonnet/promgrafonnet.libsonnet +++ /dev/null @@ -1,5 +0,0 @@ -{ - numbersinglestat:: import 'numbersinglestat.libsonnet', - gauge:: import 'gauge.libsonnet', - percentlinegraph:: import 'percentlinegraph.libsonnet', -}