-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add grafana provisioning content
- Loading branch information
Showing
4 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: 1 | ||
|
||
providers: | ||
- name: 'htmlgraphics' | ||
type: file | ||
options: | ||
path: /etc/grafana/provisioning/dashboards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ | ||
"annotations": { | ||
"list": [ | ||
{ | ||
"builtIn": 1, | ||
"datasource": "-- Grafana --", | ||
"enable": true, | ||
"hide": true, | ||
"iconColor": "rgba(0, 211, 255, 1)", | ||
"name": "Annotations & Alerts", | ||
"target": { | ||
"limit": 100, | ||
"matchAny": false, | ||
"tags": [], | ||
"type": "dashboard" | ||
}, | ||
"type": "dashboard" | ||
} | ||
] | ||
}, | ||
"editable": true, | ||
"fiscalYearStartMonth": 0, | ||
"gnetId": null, | ||
"graphTooltip": 0, | ||
"id": 2, | ||
"links": [], | ||
"liveNow": false, | ||
"panels": [ | ||
{ | ||
"datasource": null, | ||
"fieldConfig": { | ||
"defaults": { | ||
"color": { | ||
"mode": "thresholds" | ||
}, | ||
"mappings": [], | ||
"thresholds": { | ||
"mode": "absolute", | ||
"steps": [ | ||
{ | ||
"color": "green", | ||
"value": null | ||
}, | ||
{ | ||
"color": "red", | ||
"value": 80 | ||
} | ||
] | ||
} | ||
}, | ||
"overrides": [] | ||
}, | ||
"gridPos": { | ||
"h": 9, | ||
"w": 12, | ||
"x": 0, | ||
"y": 0 | ||
}, | ||
"id": 2, | ||
"options": { | ||
"SVGBaseFix": true, | ||
"add100Percentage": true, | ||
"calcsMutation": "standard", | ||
"centerAlignContent": true, | ||
"codeData": "{\n \"text\": \"Random text\"\n}", | ||
"css": "* {\n font-family: Open Sans;\n}\n\ndiv {\n text-align: center;\n}", | ||
"dynamicData": false, | ||
"dynamicFieldDisplayValues": false, | ||
"dynamicHtmlGraphics": false, | ||
"dynamicProps": false, | ||
"html": "<div>\n <p><span>Height: </span><span class=\"value-field\" /></p>\n <p><span>Width: </span><span class=\"value-field\" /></p>\n</div>\n", | ||
"onInit": "// REMEMBER TO TURN DYNAMIC HTMLGRAPHICS AND TRIGGER ONINIT ON RESIZE TO TRUE\n\nconst [heightValueElt, widthValueElt] = htmlNode.querySelectorAll(\".value-field\");\n\nconst updateValueText = () => {\n heightValueElt.textContent = htmlGraphics.height;\n widthValueElt.textContent = htmlGraphics.width;\n}\n\nupdateValueText();\n\n", | ||
"onInitOnResize": true, | ||
"onRender": "", | ||
"overflow": "visible", | ||
"panelupdateOnMount": true, | ||
"reduceOptions": { | ||
"calcs": [ | ||
"lastNotNull", | ||
"last", | ||
"first", | ||
"firstNotNull", | ||
"min", | ||
"max", | ||
"mean", | ||
"sum", | ||
"count", | ||
"range", | ||
"delta", | ||
"step", | ||
"diff", | ||
"logmin", | ||
"allIsZero", | ||
"allIsNull", | ||
"diffperc" | ||
] | ||
}, | ||
"renderOnMount": true, | ||
"rootCSS": "", | ||
"useGrafanaScrollbar": true | ||
}, | ||
"title": "Panel Title", | ||
"type": "gapit-htmlgraphics-panel" | ||
} | ||
], | ||
"schemaVersion": 31, | ||
"style": "dark", | ||
"tags": [], | ||
"templating": { | ||
"list": [] | ||
}, | ||
"time": { | ||
"from": "now-6h", | ||
"to": "now" | ||
}, | ||
"timepicker": {}, | ||
"timezone": "", | ||
"title": "Dynamic height and width", | ||
"uid": "eSuyonDHk", | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"annotations": { | ||
"list": [ | ||
{ | ||
"builtIn": 1, | ||
"datasource": "-- Grafana --", | ||
"enable": true, | ||
"hide": true, | ||
"iconColor": "rgba(0, 211, 255, 1)", | ||
"name": "Annotations & Alerts", | ||
"target": { | ||
"limit": 100, | ||
"matchAny": false, | ||
"tags": [], | ||
"type": "dashboard" | ||
}, | ||
"type": "dashboard" | ||
} | ||
] | ||
}, | ||
"editable": true, | ||
"fiscalYearStartMonth": 0, | ||
"gnetId": null, | ||
"graphTooltip": 0, | ||
"id": 2, | ||
"iteration": 1736334492953, | ||
"links": [], | ||
"liveNow": false, | ||
"panels": [ | ||
{ | ||
"datasource": null, | ||
"fieldConfig": { | ||
"defaults": { | ||
"color": { | ||
"mode": "thresholds" | ||
}, | ||
"mappings": [], | ||
"thresholds": { | ||
"mode": "absolute", | ||
"steps": [ | ||
{ | ||
"color": "green", | ||
"value": null | ||
}, | ||
{ | ||
"color": "red", | ||
"value": 80 | ||
} | ||
] | ||
} | ||
}, | ||
"overrides": [] | ||
}, | ||
"gridPos": { | ||
"h": 9, | ||
"w": 12, | ||
"x": 0, | ||
"y": 0 | ||
}, | ||
"id": 2, | ||
"options": { | ||
"SVGBaseFix": true, | ||
"add100Percentage": true, | ||
"calcsMutation": "standard", | ||
"centerAlignContent": true, | ||
"codeData": "{\n \"testVariable\": \"${testVariable}\"\n}", | ||
"css": "", | ||
"dynamicData": false, | ||
"dynamicFieldDisplayValues": false, | ||
"dynamicHtmlGraphics": false, | ||
"dynamicProps": false, | ||
"html": "<button></button>\n", | ||
"onInit": "// For Grafana v8.3.0+ the variable needs to be wrapped in ${}\nconst { testVariable } = customProperties;\nconst testVariableName = testVariable.replace(/[${}]/g, \"\");\nconst buttonElt = htmlNode.querySelector('button');\n\n/*\n Update a grafana variable\n\n More information in the grafana docs\n https://grafana.com/docs/grafana/v9.1/developers/plugins/add-support-for-variables/\n*/\nfunction updateGrafanaVariable(variableName, value) {\n getLocationSrv().update({\n query: {\n [`var-${variableName}`]: value,\n },\n partial: true, // partial: true makes the update only affect the query parameters listed in query, and leaves the other query parameters unchanged.\n replace: true, // replace: true tells Grafana to update the current URL state, rather than creating a new history entry.\n });\n}\n\nfunction getGrafanaVariableValue(variable) {\n return getTemplateSrv().replace(variable);\n}\n\nfunction updateButtonText() {\n buttonElt.textContent = `${testVariableName}'s current value is: ${getGrafanaVariableValue(testVariable)}`;\n}\n\nbuttonElt.onclick = function () {\n updateGrafanaVariable(testVariableName, getGrafanaVariableValue(testVariable) == 'b' ? 'a' : 'b');\n};\n\n/*\n When the variable changes panelupdate will trigger.\n The panelupdate is used to update the button text so the text is the same as the variable.\n*/\nhtmlNode.addEventListener('panelupdate', () => {\n updateButtonText();\n});\n", | ||
"onInitOnResize": false, | ||
"onRender": "", | ||
"overflow": "visible", | ||
"panelupdateOnMount": true, | ||
"reduceOptions": { | ||
"calcs": [ | ||
"lastNotNull", | ||
"last", | ||
"first", | ||
"firstNotNull", | ||
"min", | ||
"max", | ||
"mean", | ||
"sum", | ||
"count", | ||
"range", | ||
"delta", | ||
"step", | ||
"diff", | ||
"logmin", | ||
"allIsZero", | ||
"allIsNull", | ||
"diffperc" | ||
] | ||
}, | ||
"renderOnMount": true, | ||
"rootCSS": "", | ||
"useGrafanaScrollbar": true | ||
}, | ||
"title": "Panel Title", | ||
"type": "gapit-htmlgraphics-panel" | ||
} | ||
], | ||
"schemaVersion": 31, | ||
"style": "dark", | ||
"tags": [], | ||
"templating": { | ||
"list": [ | ||
{ | ||
"allValue": null, | ||
"current": { | ||
"selected": true, | ||
"text": "b", | ||
"value": "b" | ||
}, | ||
"description": null, | ||
"error": null, | ||
"hide": 0, | ||
"includeAll": false, | ||
"label": null, | ||
"multi": false, | ||
"name": "testVariable", | ||
"options": [ | ||
{ | ||
"selected": false, | ||
"text": "a", | ||
"value": "a" | ||
}, | ||
{ | ||
"selected": true, | ||
"text": "b", | ||
"value": "b" | ||
} | ||
], | ||
"query": "a,b", | ||
"queryValue": "", | ||
"skipUrlSync": false, | ||
"type": "custom" | ||
} | ||
] | ||
}, | ||
"time": { | ||
"from": "now-6h", | ||
"to": "now" | ||
}, | ||
"timepicker": {}, | ||
"timezone": "", | ||
"title": "Update grafana variable", | ||
"uid": "uVluJnDHk", | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: 1 | ||
|
||
datasources: | ||
- name: TestData DB | ||
type: testdata | ||
uid: trlxrdZVk | ||
isDefault: true |