mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 20:36:21 +01:00
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>
This commit is contained in:
parent
e5266c242e
commit
f331b308f3
@ -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;
|
||||
|
||||
{
|
||||
|
@ -19,6 +19,16 @@
|
||||
}
|
||||
},
|
||||
"version": "master"
|
||||
},
|
||||
{
|
||||
"name": "promgrafonnet",
|
||||
"source": {
|
||||
"git": {
|
||||
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
|
||||
"subdir": "lib/promgrafonnet"
|
||||
}
|
||||
},
|
||||
"version": "master"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -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',
|
||||
},
|
||||
},
|
||||
}
|
@ -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)',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
numbersinglestat:: import 'numbersinglestat.libsonnet',
|
||||
gauge:: import 'gauge.libsonnet',
|
||||
percentlinegraph:: import 'percentlinegraph.libsonnet',
|
||||
}
|
Loading…
Reference in New Issue
Block a user