2018-05-11 23:08:38 +00:00
import { interval } from 'src/shared/constants'
2018-05-01 22:15:15 +00:00
import {
2018-07-27 01:16:02 +00:00
Service ,
2018-05-01 22:15:15 +00:00
Source ,
2018-07-09 21:56:27 +00:00
SourceAuthenticationMethod ,
2018-05-01 22:15:15 +00:00
CellQuery ,
SourceLinks ,
Cell ,
TimeRange ,
Template ,
2018-05-02 17:09:26 +00:00
QueryConfig ,
2018-06-12 20:20:30 +00:00
TemplateType ,
TemplateValueType ,
2018-05-01 22:15:15 +00:00
} from 'src/types'
2018-05-10 18:36:50 +00:00
import {
Axes ,
TableOptions ,
FieldOption ,
DecimalPlaces ,
2018-06-25 22:49:58 +00:00
CellType ,
2018-09-05 18:49:10 +00:00
NoteVisibility ,
2018-09-14 23:24:17 +00:00
QueryType ,
2018-06-23 01:08:57 +00:00
} from 'src/types/dashboards'
2018-06-15 20:55:45 +00:00
import { LineColor , ColorNumber } from 'src/types/colors'
2018-06-26 21:48:23 +00:00
import { ServerLogConfig , ServerColumn } from 'src/types/logs'
2018-05-01 22:15:15 +00:00
export const sourceLinks : SourceLinks = {
2018-05-18 23:08:58 +00:00
services : '/chronograf/v1/sources/4' ,
2018-05-01 22:15:15 +00:00
self : '/chronograf/v1/sources/4' ,
kapacitors : '/chronograf/v1/sources/4/kapacitors' ,
proxy : '/chronograf/v1/sources/4/proxy' ,
queries : '/chronograf/v1/sources/4/queries' ,
write : '/chronograf/v1/sources/4/write' ,
permissions : '/chronograf/v1/sources/4/permissions' ,
users : '/chronograf/v1/sources/4/users' ,
databases : '/chronograf/v1/sources/4/dbs' ,
annotations : '/chronograf/v1/sources/4/annotations' ,
health : '/chronograf/v1/sources/4/health' ,
}
export const source : Source = {
id : '4' ,
name : 'Influx 1' ,
type : 'influx' ,
url : 'http://localhost:8086' ,
default : false ,
telegraf : 'telegraf' ,
organization : 'default' ,
role : 'viewer' ,
defaultRP : '' ,
links : sourceLinks ,
insecureSkipVerify : false ,
2018-07-09 21:56:27 +00:00
authentication : SourceAuthenticationMethod.Basic ,
2018-05-01 22:15:15 +00:00
}
2018-07-27 01:16:02 +00:00
export const service : Service = {
id : '1' ,
sourceID : '1' ,
name : 'Flux' ,
url : 'http://localhost:8093' ,
insecureSkipVerify : false ,
type : 'flux' ,
metadata : {
active : true ,
} ,
links : {
proxy : '/chronograf/v1/sources/1/services/1/proxy' ,
self : '/chronograf/v1/sources/1/services/1' ,
source : '/chronograf/v1/sources/1' ,
} ,
}
2018-05-02 17:09:26 +00:00
export const queryConfig : QueryConfig = {
database : 'telegraf' ,
measurement : 'cpu' ,
retentionPolicy : 'autogen' ,
fields : [
{
value : 'mean' ,
type : 'func' ,
alias : 'mean_usage_idle' ,
args : [
{
value : 'usage_idle' ,
type : 'field' ,
alias : '' ,
} ,
] ,
} ,
{
value : 'mean' ,
type : 'func' ,
alias : 'mean_usage_user' ,
args : [
{
value : 'usage_user' ,
type : 'field' ,
alias : '' ,
} ,
] ,
} ,
] ,
tags : { } ,
groupBy : {
time : 'auto' ,
tags : [ ] ,
} ,
areTagsAccepted : false ,
fill : 'null' ,
rawText : null ,
range : null ,
shifts : null ,
}
2018-05-01 22:15:15 +00:00
export const query : CellQuery = {
query :
'SELECT mean("usage_idle") AS "mean_usage_idle", mean("usage_user") AS "mean_usage_user" FROM "telegraf"."autogen"."cpu" WHERE time > :dashboardTime: GROUP BY time(:interval:) FILL(null)' ,
2018-05-02 20:51:42 +00:00
queryConfig ,
2018-05-21 22:58:19 +00:00
source : '' ,
2018-09-14 23:24:17 +00:00
type : QueryType . InfluxQL ,
2018-05-01 22:15:15 +00:00
}
export const axes : Axes = {
x : {
bounds : [ '' , '' ] ,
label : '' ,
prefix : '' ,
suffix : '' ,
base : '10' ,
scale : 'linear' ,
} ,
y : {
bounds : [ '' , '' ] ,
label : '' ,
prefix : '' ,
suffix : '' ,
base : '10' ,
scale : 'linear' ,
} ,
}
2018-05-10 18:36:50 +00:00
export const fieldOptions : FieldOption [ ] = [
2018-05-01 22:51:52 +00:00
{
internalName : 'time' ,
displayName : '' ,
visible : true ,
} ,
]
2018-05-01 22:15:15 +00:00
export const tableOptions : TableOptions = {
verticalTimeAxis : true ,
sortBy : {
internalName : 'time' ,
displayName : '' ,
visible : true ,
} ,
wrapping : 'truncate' ,
fixFirstColumn : true ,
}
2018-06-15 20:55:45 +00:00
export const lineColors : LineColor [ ] = [
2018-05-01 22:15:15 +00:00
{
id : '574fb0a3-0a26-44d7-8d71-d4981756acb1' ,
type : 'scale' ,
hex : '#31C0F6' ,
name : 'Nineteen Eighty Four' ,
value : '0' ,
} ,
{
id : '3b9750f9-d41d-4100-8ee6-bd2785237f35' ,
type : 'scale' ,
hex : '#A500A5' ,
name : 'Nineteen Eighty Four' ,
value : '0' ,
} ,
{
id : '8d39064f-8124-4967-ae22-ffe14e425781' ,
type : 'scale' ,
hex : '#FF7E27' ,
name : 'Nineteen Eighty Four' ,
value : '0' ,
} ,
]
2018-05-01 22:51:52 +00:00
export const decimalPlaces : DecimalPlaces = {
isEnforced : true ,
digits : 4 ,
}
2018-05-01 22:15:15 +00:00
export const cell : Cell = {
2018-06-08 22:04:24 +00:00
i : '67435af2-17bf-4caa-a5fc-0dd1ffb40dab' ,
2018-05-01 22:15:15 +00:00
x : 0 ,
y : 0 ,
w : 8 ,
h : 4 ,
2018-05-03 23:41:37 +00:00
name : 'Untitled Graph' ,
2018-05-01 22:15:15 +00:00
queries : [ query ] ,
2018-05-03 23:41:37 +00:00
axes ,
2018-05-11 20:46:50 +00:00
type : CellType . Line ,
2018-05-01 22:15:15 +00:00
colors : lineColors ,
legend : { } ,
2018-05-03 23:41:37 +00:00
tableOptions ,
fieldOptions ,
2018-05-01 22:51:52 +00:00
timeFormat : 'MM/DD/YYYY HH:mm:ss' ,
2018-05-03 23:41:37 +00:00
decimalPlaces ,
2018-05-01 22:15:15 +00:00
links : {
self :
'/chronograf/v1/dashboards/9/cells/67435af2-17bf-4caa-a5fc-0dd1ffb40dab' ,
} ,
2018-07-16 16:24:10 +00:00
inView : true ,
2018-08-23 21:41:40 +00:00
note : 'I am a note!' ,
2018-09-05 18:49:10 +00:00
noteVisibility : NoteVisibility.Default ,
2018-05-01 22:15:15 +00:00
}
export const fullTimeRange = {
dashboardID : 9 ,
defaultGroupBy : '10s' ,
seconds : 300 ,
inputValue : 'Past 5 minutes' ,
lower : 'now() - 5m' ,
upper : null ,
menuOption : 'Past 5 minutes' ,
format : 'influxql' ,
}
export const timeRange : TimeRange = {
lower : 'now() - 5m' ,
upper : null ,
}
export const userDefinedTemplateVariables : Template [ ] = [
{
tempVar : ':fields:' ,
2018-06-12 20:20:30 +00:00
type : TemplateType . FieldKeys ,
2018-05-11 23:08:38 +00:00
label : '' ,
2018-05-01 22:15:15 +00:00
values : [
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_guest' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_guest_nice' ,
} ,
{
selected : true ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_idle' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : true ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_iowait' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_irq' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_nice' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_softirq' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_steal' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_system' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . FieldKey ,
2018-05-01 22:15:15 +00:00
value : 'usage_user' ,
} ,
] ,
id : '2b8dca84-879c-4555-a7cf-97f2951f8643' ,
} ,
{
tempVar : ':measurements:' ,
2018-06-12 20:20:30 +00:00
type : TemplateType . Measurements ,
2018-05-11 23:08:38 +00:00
label : '' ,
2018-05-01 22:15:15 +00:00
values : [
{
selected : true ,
2018-07-02 20:42:50 +00:00
localSelected : true ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Measurement ,
2018-05-01 22:15:15 +00:00
value : 'cpu' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Measurement ,
2018-05-01 22:15:15 +00:00
value : 'disk' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Measurement ,
2018-05-01 22:15:15 +00:00
value : 'diskio' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Measurement ,
2018-05-01 22:15:15 +00:00
value : 'mem' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Measurement ,
2018-05-01 22:15:15 +00:00
value : 'processes' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Measurement ,
2018-05-01 22:15:15 +00:00
value : 'swap' ,
} ,
{
selected : false ,
2018-07-02 20:42:50 +00:00
localSelected : false ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Measurement ,
2018-05-01 22:15:15 +00:00
value : 'system' ,
} ,
] ,
id : '18855209-12db-4619-9834-1d7eb643ae6e' ,
} ,
]
2018-05-11 23:08:38 +00:00
const dashtimeTempVar : Template = {
id : 'dashtime' ,
tempVar : ':dashboardTime:' ,
2018-06-12 20:20:30 +00:00
type : TemplateType . Constant ,
2018-05-11 23:08:38 +00:00
values : [
{
value : 'now() - 5m' ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Constant ,
2018-05-11 23:08:38 +00:00
selected : true ,
2018-07-02 20:42:50 +00:00
localSelected : true ,
2018-05-11 23:08:38 +00:00
} ,
] ,
label : '' ,
}
const upperdashtimeTempVar : Template = {
id : 'upperdashtime' ,
tempVar : ':upperDashboardTime:' ,
2018-06-12 20:20:30 +00:00
type : TemplateType . Constant ,
2018-05-11 23:08:38 +00:00
values : [
{
value : 'now()' ,
2018-06-12 20:20:30 +00:00
type : TemplateValueType . Constant ,
2018-05-11 23:08:38 +00:00
selected : true ,
2018-07-02 20:42:50 +00:00
localSelected : true ,
2018-05-11 23:08:38 +00:00
} ,
] ,
label : '' ,
}
2018-05-01 22:15:15 +00:00
export const predefinedTemplateVariables : Template [ ] = [
2018-05-11 23:08:38 +00:00
{ . . . dashtimeTempVar } ,
{ . . . upperdashtimeTempVar } ,
{ . . . interval } ,
2018-05-01 22:15:15 +00:00
]
export const thresholdsListColors : ColorNumber [ ] = [
{
type : 'text' ,
hex : '#00C9FF' ,
id : 'base' ,
name : 'laser' ,
value : - 1000000000000000000 ,
} ,
]
export const gaugeColors : ColorNumber [ ] = [
{
type : 'min' ,
hex : '#00C9FF' ,
id : '0' ,
name : 'laser' ,
value : 0 ,
} ,
{
type : 'max' ,
hex : '#9394FF' ,
id : '1' ,
name : 'comet' ,
value : 100 ,
} ,
]
2018-06-26 21:48:23 +00:00
export const serverLogColumns : ServerColumn [ ] = [
{
name : 'severity' ,
position : 1 ,
encodings : [
{
type : 'visibility' ,
value : 'visible' ,
} ,
{
type : 'label' ,
value : 'icon' ,
} ,
{
type : 'label' ,
value : 'text' ,
} ,
2018-07-10 21:07:38 +00:00
{
type : 'color' ,
2018-07-12 17:58:09 +00:00
name : 'alert' ,
value : 'pearl' ,
2018-07-10 21:07:38 +00:00
} ,
{
type : 'color' ,
2018-07-12 17:58:09 +00:00
name : 'warning' ,
value : 'wolf' ,
2018-07-10 21:07:38 +00:00
} ,
2018-06-26 21:48:23 +00:00
] ,
} ,
{
name : 'timestamp' ,
position : 2 ,
encodings : [
{
type : 'visibility' ,
value : 'visible' ,
} ,
] ,
} ,
{
name : 'message' ,
position : 3 ,
encodings : [
{
type : 'visibility' ,
value : 'visible' ,
} ,
] ,
} ,
{
name : 'facility' ,
position : 4 ,
encodings : [
{
type : 'visibility' ,
value : 'visible' ,
} ,
] ,
} ,
{
name : 'time' ,
position : 0 ,
encodings : [
{
type : 'visibility' ,
value : 'hidden' ,
} ,
] ,
} ,
{
name : 'procid' ,
position : 5 ,
encodings : [
{
type : 'visibility' ,
value : 'visible' ,
} ,
{
type : 'displayName' ,
value : 'Proc ID' ,
} ,
] ,
} ,
{
name : 'host' ,
position : 7 ,
encodings : [
{
type : 'visibility' ,
value : 'visible' ,
} ,
] ,
} ,
{
name : 'appname' ,
position : 6 ,
encodings : [
{
type : 'visibility' ,
value : 'visible' ,
} ,
{
type : 'displayName' ,
value : 'Application' ,
} ,
] ,
} ,
]
export const serverLogConfig : ServerLogConfig = {
columns : serverLogColumns ,
}