mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #13398 from bergquist/bulk_alerting_dashboards
devenv: adds script for creating many dashboards with alerts
This commit is contained in:
commit
b41333d4b9
1
.gitignore
vendored
1
.gitignore
vendored
@ -72,3 +72,4 @@ debug.test
|
|||||||
*.orig
|
*.orig
|
||||||
|
|
||||||
/devenv/bulk-dashboards/*.json
|
/devenv/bulk-dashboards/*.json
|
||||||
|
/devenv/bulk_alerting_dashboards/*.json
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
providers:
|
||||||
|
- name: 'Bulk alerting dashboards'
|
||||||
|
folder: 'Bulk alerting dashboards'
|
||||||
|
type: file
|
||||||
|
options:
|
||||||
|
path: devenv/bulk_alerting_dashboards
|
||||||
|
|
168
devenv/bulk_alerting_dashboards/bulkdash_alerting.jsonnet
Normal file
168
devenv/bulk_alerting_dashboards/bulkdash_alerting.jsonnet
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
{
|
||||||
|
"editable": true,
|
||||||
|
"gnetId": null,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"id": null,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"alert": {
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"evaluator": {
|
||||||
|
"params": [
|
||||||
|
65
|
||||||
|
],
|
||||||
|
"type": "gt"
|
||||||
|
},
|
||||||
|
"operator": {
|
||||||
|
"type": "and"
|
||||||
|
},
|
||||||
|
"query": {
|
||||||
|
"params": [
|
||||||
|
"A",
|
||||||
|
"5m",
|
||||||
|
"now"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"reducer": {
|
||||||
|
"params": [],
|
||||||
|
"type": "avg"
|
||||||
|
},
|
||||||
|
"type": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"executionErrorState": "alerting",
|
||||||
|
"frequency": "10s",
|
||||||
|
"handler": 1,
|
||||||
|
"name": "bulk alerting",
|
||||||
|
"noDataState": "no_data",
|
||||||
|
"notifications": []
|
||||||
|
},
|
||||||
|
"aliasColors": {},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "gdev-prometheus",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 2,
|
||||||
|
"legend": {
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"show": true,
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 1,
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"seriesOverrides": [],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"$$hashKey": "object:117",
|
||||||
|
"expr": "go_goroutines",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 1,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
{
|
||||||
|
"colorMode": "critical",
|
||||||
|
"fill": true,
|
||||||
|
"line": true,
|
||||||
|
"op": "gt",
|
||||||
|
"value": 50
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Panel Title",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": []
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schemaVersion": 16,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-6h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
],
|
||||||
|
"time_options": [
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"1h",
|
||||||
|
"6h",
|
||||||
|
"12h",
|
||||||
|
"24h",
|
||||||
|
"2d",
|
||||||
|
"7d",
|
||||||
|
"30d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "New dashboard",
|
||||||
|
"uid": null,
|
||||||
|
"version": 0
|
||||||
|
}
|
@ -14,6 +14,20 @@ bulkDashboard() {
|
|||||||
ln -s -f -r ./bulk-dashboards/bulk-dashboards.yaml ../conf/provisioning/dashboards/custom.yaml
|
ln -s -f -r ./bulk-dashboards/bulk-dashboards.yaml ../conf/provisioning/dashboards/custom.yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bulkAlertingDashboard() {
|
||||||
|
|
||||||
|
requiresJsonnet
|
||||||
|
|
||||||
|
COUNTER=0
|
||||||
|
MAX=100
|
||||||
|
while [ $COUNTER -lt $MAX ]; do
|
||||||
|
jsonnet -o "bulk_alerting_dashboards/alerting_dashboard${COUNTER}.json" -e "local bulkDash = import 'bulk_alerting_dashboards/bulkdash_alerting.jsonnet'; bulkDash + { uid: 'bd-${COUNTER}', title: 'alerting-title-${COUNTER}' }"
|
||||||
|
let COUNTER=COUNTER+1
|
||||||
|
done
|
||||||
|
|
||||||
|
ln -s -f -r ./bulk_alerting_dashboards/bulk_alerting_dashboards.yaml ../conf/provisioning/dashboards/custom.yaml
|
||||||
|
}
|
||||||
|
|
||||||
requiresJsonnet() {
|
requiresJsonnet() {
|
||||||
if ! type "jsonnet" > /dev/null; then
|
if ! type "jsonnet" > /dev/null; then
|
||||||
echo "you need you install jsonnet to run this script"
|
echo "you need you install jsonnet to run this script"
|
||||||
@ -36,8 +50,9 @@ devDatasources() {
|
|||||||
usage() {
|
usage() {
|
||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo " bulk-dashboards - create and provisioning 400 dashboards"
|
echo " bulk-dashboards - create and provisioning 400 dashboards"
|
||||||
echo " no args - provisiong core datasources and dev dashboards"
|
echo " bulk-alerting-dashboards - create and provisioning 400 dashboards with alerts"
|
||||||
|
echo " no args - provisiong core datasources and dev dashboards"
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
@ -48,7 +63,9 @@ main() {
|
|||||||
|
|
||||||
local cmd=$1
|
local cmd=$1
|
||||||
|
|
||||||
if [[ $cmd == "bulk-dashboards" ]]; then
|
if [[ $cmd == "bulk-alerting-dashboards" ]]; then
|
||||||
|
bulkAlertingDashboard
|
||||||
|
elif [[ $cmd == "bulk-dashboards" ]]; then
|
||||||
bulkDashboard
|
bulkDashboard
|
||||||
else
|
else
|
||||||
devDashboards
|
devDashboards
|
||||||
|
Loading…
Reference in New Issue
Block a user