在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:grafana/simple-json-datasource开源软件地址:https://github.com/grafana/simple-json-datasource开源编程语言:JavaScript 92.3%开源软件介绍:Simple JSON Datasource - a generic backend datasource
You can find more documentation about datasource plugins in Grafana's Docs. This also serves as a living example implementation of a datasource. Your backend needs to implement 4 urls:
Those two urls are optional:
InstallationTo install this plugin using the
See here for more information. Example backend implementations
Query APIExample {
"panelId": 1,
"range": {
"from": "2016-10-31T06:33:44.866Z",
"to": "2016-10-31T12:33:44.866Z",
"raw": {
"from": "now-6h",
"to": "now"
}
},
"rangeRaw": {
"from": "now-6h",
"to": "now"
},
"interval": "30s",
"intervalMs": 30000,
"targets": [
{ "target": "upper_50", "refId": "A", "type": "timeserie" },
{ "target": "upper_75", "refId": "B", "type": "timeserie" }
],
"adhocFilters": [{
"key": "City",
"operator": "=",
"value": "Berlin"
}],
"format": "json",
"maxDataPoints": 550
} Example [
{
"target":"upper_75", // The field being queried for
"datapoints":[
[622,1450754160000], // Metric value as a float , unixtimestamp in milliseconds
[365,1450754220000]
]
},
{
"target":"upper_90",
"datapoints":[
[861,1450754160000],
[767,1450754220000]
]
}
] If the metric selected is [
{
"columns":[
{"text":"Time","type":"time"},
{"text":"Country","type":"string"},
{"text":"Number","type":"number"}
],
"rows":[
[1234567,"SE",123],
[1234567,"DE",231],
[1234567,"US",321]
],
"type":"table"
}
] Annotation APIThe annotation request from the Simple JSON Datasource is a POST request to
the {
"range": {
"from": "2016-04-15T13:44:39.070Z",
"to": "2016-04-15T14:44:39.070Z"
},
"rangeRaw": {
"from": "now-1h",
"to": "now"
},
"annotation": {
"name": "deploy",
"datasource": "Simple JSON Datasource",
"iconColor": "rgba(255, 96, 96, 1)",
"enable": true,
"query": "#deploy"
}
} Grafana expects a response containing an array of annotation objects in the following format: [
{
annotation: annotation, // The original annotation sent from Grafana.
time: time, // Time since UNIX Epoch in milliseconds. (required)
title: title, // The title for the annotation tooltip. (required)
tags: tags, // Tags for the annotation. (optional)
text: text // Text for the annotation. (optional)
}
] Note: If the datasource is configured to connect directly to the backend, you
also need to implement an OPTIONS endpoint at
Search APIExample request { target: 'upper_50' } The search api can either return an array or map. Example array response ["upper_25","upper_50","upper_75","upper_90","upper_95"] Example map response [ { "text" :"upper_25", "value": 1}, { "text" :"upper_75", "value": 2} ] Tag Keys APIExample request { } The tag keys api returns: [
{"type":"string","text":"City"},
{"type":"string","text":"Country"}
] Tag Values APIExample request {"key": "City"} The tag values api returns: [
{'text': 'Eins!'},
{'text': 'Zwei'},
{'text': 'Drei!'}
] Dev setupThis plugin requires node 6.10.0
Changelog1.4.1
1.4.0
1.3.5
1.3.4
1.3.3
1.2.4
1.2.3
1.2.2
If using Grafana 2.6NOTE! for grafana 2.6 please use this version Copy the data source you want to |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论