curl -v -H 'Content-Type:application/json;charset=utf8' -X POST -d pro-kube-system-grafana.json -u admin:xxxxxxx http://114.114.114.114:3000/api/dashboards/db
#需要注意
批量替换json文件中的servicename,NAMESPACE,grafanaEnv,grafanaFolderId才可使用
pro-kube-system-grafana.json
{
"dashboard": {
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana -",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration" 1693480666423,
"links": [],
"panels": [
{
"datasource": "Loki",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"gridPos": {
"h": 20,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"showLabels": false,
"showTime": false,
"sortOrder": "Descending",
"wrapLogMessage": true
},
"pluginVersion": "7.3.1",
"tagets": [
{
"expr": "{env="grafanaEnv",namspace="NAMESPACE",container="servicename"} |= "$ServicePersonalKW"",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "servicename",
"type": "logs"
}
],
"sch服务器托管网emaVersion": 26,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"sel服务器托管网ected": false,
"text": "",
"value": ""
},
"error": null,
"hide": 0,
"label": "关键字",
"name": "ServicePersonalKW",
"options": [
{
"selected": true,
"text": "",
"value": ""
}
],
"query": "",
"skipUrlSync": false,
"type": "textbox"
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "servicename",
"version": 3
},
"folderId": grafanaFolderId #grafanaFolderId 需要自己在grafana查看,此次不做说明
}
参考官网:https://grafana.com/docs/grafana/latest/developers/http_api/dashboard/
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
Plan9 Plan9 是一个操作系统。由贝尔实验室开发的,其主要的负责人是Rob Pike(现在在google工作,负责Go语言的开发)。 Plan 9不是一个很知名的作品,但是它的前身Unix是世人皆知的。而Plan 9是Unix的几位作者在AT&…