Skip to content

Commit

Permalink
fix: Only color the status cells
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Baldry <[email protected]>
  • Loading branch information
jdbaldry committed Nov 14, 2020
1 parent a11e322 commit 2d2d8a6
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 86 deletions.
148 changes: 96 additions & 52 deletions dashboards/haproxy-overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,48 +239,70 @@
},
"fieldConfig": {
"defaults": {
"custom": {
"displayMode": "color-background"
},
"custom": {},
"links": [
{
"url": "/d/HAProxyFrontend/haproxy-frontend?${__all_variables}\u0026var-frontend=${__data.fields.Frontend}",
"title": "Frontend"
}
],
"mappings": [
{
"text": "Down",
"value": "0",
"id": 1,
"type": 1
},
{
"text": "Up",
"value": "1",
"id": 2,
"type": 1
}
],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
"steps": []
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Status"
},
"properties": [
{
"color": "rgba(0,0,0,0)",
"value": null
"value": [
{
"text": "Down",
"value": "0",
"id": 1,
"type": 1
},
{
"text": "Up",
"value": "1",
"id": 2,
"type": 1
}
],
"id": "mappings"
},
{
"color": "red",
"value": 0
"value": "color-background",
"id": "custom.displayMode"
},
{
"color": "green",
"value": 1
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(0,0,0,0)",
"value": null
},
{
"color": "red",
"value": 0
},
{
"color": "green",
"value": 1
}
]
},
"id": "thresholds"
}
]
}
},
"overrides": []
]
},
"datasource": "prometheus",
"gridPos": {
Expand Down Expand Up @@ -343,48 +365,70 @@
"options": {},
"fieldConfig": {
"defaults": {
"custom": {
"displayMode": "color-background"
},
"custom": {},
"links": [
{
"url": "/d/HAProxyBackend/haproxy-backend?${__all_variables}\u0026var-backend=${__data.fields.Backend}",
"title": "Backend"
}
],
"mappings": [
{
"text": "Down",
"value": "0",
"id": 1,
"type": 1
},
{
"text": "Up",
"value": "1",
"id": 2,
"type": 1
}
],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
"steps": []
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Status"
},
"properties": [
{
"color": "rgba(0,0,0,0)",
"value": null
"value": [
{
"text": "Down",
"value": "0",
"id": 1,
"type": 1
},
{
"text": "Up",
"value": "1",
"id": 2,
"type": 1
}
],
"id": "mappings"
},
{
"color": "red",
"value": 0
"value": "color-background",
"id": "custom.displayMode"
},
{
"color": "green",
"value": 1
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(0,0,0,0)",
"value": null
},
{
"color": "red",
"value": 0
},
{
"color": "green",
"value": 1
}
]
},
"id": "thresholds"
}
]
}
},
"overrides": []
]
},
"datasource": "prometheus",
"gridPos": {
Expand Down
96 changes: 62 additions & 34 deletions dashboards/panels.cue
Original file line number Diff line number Diff line change
Expand Up @@ -463,24 +463,38 @@ serverTable: _tablePanel & {

frontendTable: _tablePanel & {
datasource: "prometheus"
fieldConfig: defaults: {
custom: {displayMode: "color-background"}
thresholds: {
mode: "absolute"
steps: [
{color: "rgba(0,0,0,0)", value: null},
{color: "red", value: 0},
{color: "green", value: 1},
]
fieldConfig: {
defaults: {
links: [{
title: "Frontend"
url: "/d/HAProxyFrontend/haproxy-frontend?${__all_variables}&var-frontend=${__data.fields.Frontend}"
}]
}
links: [{
title: "Frontend"
url: "/d/HAProxyFrontend/haproxy-frontend?${__all_variables}&var-frontend=${__data.fields.Frontend}"
}]
mappings: [
{id: 1, type: 1, text: "Down", value: "0"},
{id: 2, type: 1, text: "Up", value: "1"},
]
overrides: [{
matcher: {id: "byName", options: "Status"}
properties: [
{
id: "mappings"
value: [
{id: 1, type: 1, text: "Down", value: "0"},
{id: 2, type: 1, text: "Up", value: "1"},
]
},
{
id: "custom.displayMode"
value: "color-background"
},
{
id: "thresholds"
value: {
mode: "absolute"
steps: [
{color: "rgba(0,0,0,0)", value: null},
{color: "red", value: 0},
{color: "green", value: 1},
]
}
}]}]
}
options: sortBy: [{displayName: "Status", desc: false}]
targets: [{
Expand Down Expand Up @@ -510,24 +524,38 @@ frontendTable: _tablePanel & {

backendTable: _tablePanel & {
datasource: "prometheus"
fieldConfig: defaults: {
custom: {displayMode: "color-background"}
thresholds: {
mode: "absolute"
steps: [
{color: "rgba(0,0,0,0)", value: null},
{color: "red", value: 0},
{color: "green", value: 1},
]
fieldConfig: {
defaults: {
links: [{
title: "Backend"
url: "/d/HAProxyBackend/haproxy-backend?${__all_variables}&var-backend=${__data.fields.Backend}"
}]
}
links: [{
title: "Backend"
url: "/d/HAProxyBackend/haproxy-backend?${__all_variables}&var-backend=${__data.fields.Backend}"
}]
mappings: [
{id: 1, type: 1, text: "Down", value: "0"},
{id: 2, type: 1, text: "Up", value: "1"},
]
overrides: [{
matcher: {id: "byName", options: "Status"}
properties: [
{
id: "mappings"
value: [
{id: 1, type: 1, text: "Down", value: "0"},
{id: 2, type: 1, text: "Up", value: "1"},
]
},
{
id: "custom.displayMode"
value: "color-background"
},
{
id: "thresholds"
value: {
mode: "absolute"
steps: [
{color: "rgba(0,0,0,0)", value: null},
{color: "red", value: 0},
{color: "green", value: 1},
]
}
}]}]
}
targets: [{
expr: "haproxy_backend_status" + "{\(_baseMatchers)}"
Expand Down

0 comments on commit 2d2d8a6

Please sign in to comment.