Merge "Add datasource option to more elements"

This commit is contained in:
Jenkins 2017-04-02 20:02:11 +00:00 committed by Gerrit Code Review
commit fccc26d53b
9 changed files with 186 additions and 0 deletions

View File

@ -115,6 +115,7 @@ class Graph(Base):
graph = {
v.Required('bars', default=False): v.All(bool),
v.Optional('datasource'): v.All(str),
v.Required('fill', default=1): v.All(int),
v.Optional('hideTimeOverride'): v.All(bool),
v.Optional('leftYAxisLabel'): v.All(str, v.Length(min=1)),

View File

@ -62,6 +62,7 @@ class Singlestat(Base):
v.Match(r'^[1-9]?[0]{1}%$|^1[0-9]?[0]{1}%$|^200%$')),
v.Required('valueName', default='avg'): v.Any(
'avg', 'current', 'max', 'min', 'total'),
v.Optional('datasource'): v.All(str),
v.Optional('decimals'): v.All(int, v.Range(min=0, max=12)),
v.Optional('hideTimeOverride'): v.All(bool),
v.Optional('timeFrom'): v.All(v.Match(r'[1-9]+[0-9]*[smhdw]')),

View File

@ -25,6 +25,7 @@ class Query(Base):
v.Required('multi', default=False): v.All(bool),
v.Required('query', default=''): v.All(str),
v.Required('refresh', default=False): v.All(bool),
v.Optional('datasource'): v.All(str),
}
query.update(self.base)
return v.Schema(query)

View File

@ -0,0 +1,43 @@
{
"dashboard": {
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"bars": false,
"datasource": "graphite",
"editable": true,
"error": false,
"fill": 1,
"lines": true,
"linewidth": 2,
"percentage": false,
"pointradius": 5,
"points": false,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [],
"title": "no title (click here)",
"type": "graph",
"x-axis": true,
"y-axis": true
}
],
"showTitle": false,
"title": "New row"
}
],
"templating": {
"enabled": false,
"list": []
},
"timezone": "utc",
"title": "New dashboard"
}
}
}

View File

@ -0,0 +1,9 @@
dashboard:
title: New dashboard
rows:
- title: New row
height: 250px
panels:
- title: no title (click here)
type: graph
datasource: graphite

View File

@ -0,0 +1,48 @@
{
"dashboard": {
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"colorBackground": false,
"colorValue": false,
"datasource": "graphite",
"editable": true,
"error": false,
"maxDataPoints": 100,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"span": 12,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [],
"thresholds": "",
"title": "no title (click here)",
"type": "singlestat",
"valueFontSize": "80%",
"valueName": "avg"
}
],
"showTitle": false,
"title": "New row"
}
],
"templating": {
"enabled": false,
"list": []
},
"timezone": "utc",
"title": "New dashboard"
}
}
}

View File

@ -0,0 +1,9 @@
dashboard:
title: New dashboard
rows:
- title: New row
height: 250px
panels:
- title: no title (click here)
type: singlestat
datasource: graphite

View File

@ -0,0 +1,57 @@
{
"dashboard": {
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"bars": false,
"datasource": "graphite",
"editable": true,
"error": false,
"fill": 1,
"lines": true,
"linewidth": 2,
"percentage": false,
"pointradius": 5,
"points": false,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"target": "$hostname.Cpu.cpu_prct_used"
}
],
"title": "no title (click here)",
"type": "graph",
"x-axis": true,
"y-axis": true
}
],
"showTitle": false,
"title": "New row"
}
],
"templating": {
"enabled": true,
"list": [
{
"datasource": "graphite",
"includeAll": false,
"multi": false,
"name": "hostname",
"query": "node*",
"refresh": true,
"type": "query"
}
]
},
"timezone": "utc",
"title": "New dashboard"
}
}
}

View File

@ -0,0 +1,17 @@
dashboard:
templating:
- name: hostname
type: query
datasource: graphite
query: node*
refresh: true
title: New dashboard
rows:
- title: New row
height: 250px
panels:
- title: no title (click here)
type: graph
datasource: graphite
targets:
- target: $hostname.Cpu.cpu_prct_used