Add ylabels and yranges to layouts
parent
f6c20592bf
commit
28bccfdcb2
|
@ -115,12 +115,15 @@ func MarshalLayout(l chronograf.Layout) ([]byte, error) {
|
|||
Wheres: q.Wheres,
|
||||
}
|
||||
}
|
||||
|
||||
cells[i] = &Cell{
|
||||
X: c.X,
|
||||
Y: c.Y,
|
||||
W: c.W,
|
||||
H: c.H,
|
||||
I: c.I,
|
||||
Yranges: c.YRanges,
|
||||
Ylabels: c.YLabels,
|
||||
Name: c.Name,
|
||||
Queries: queries,
|
||||
}
|
||||
|
@ -157,12 +160,15 @@ func UnmarshalLayout(data []byte, l *chronograf.Layout) error {
|
|||
Wheres: q.Wheres,
|
||||
}
|
||||
}
|
||||
|
||||
cells[i] = chronograf.Cell{
|
||||
X: c.X,
|
||||
Y: c.Y,
|
||||
W: c.W,
|
||||
H: c.H,
|
||||
I: c.I,
|
||||
YRanges: c.Yranges,
|
||||
YLabels: c.Ylabels,
|
||||
Name: c.Name,
|
||||
Queries: queries,
|
||||
}
|
||||
|
|
|
@ -108,6 +108,8 @@ type Cell struct {
|
|||
Queries []*Query `protobuf:"bytes,5,rep,name=queries" json:"queries,omitempty"`
|
||||
I string `protobuf:"bytes,6,opt,name=i,proto3" json:"i,omitempty"`
|
||||
Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Yranges []int64 `protobuf:"varint,8,rep,name=yranges" json:"yranges,omitempty"`
|
||||
Ylabels []string `protobuf:"bytes,9,rep,name=ylabels" json:"ylabels,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Cell) Reset() { *m = Cell{} }
|
||||
|
@ -171,40 +173,42 @@ func init() {
|
|||
func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) }
|
||||
|
||||
var fileDescriptorInternal = []byte{
|
||||
// 555 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x8e, 0xd3, 0x4a,
|
||||
0x10, 0xc6, 0xd5, 0xb1, 0x9d, 0xc4, 0x35, 0x4f, 0x79, 0xa8, 0x35, 0x42, 0x16, 0x62, 0x11, 0x59,
|
||||
0x2c, 0x82, 0x84, 0x66, 0x01, 0x27, 0x48, 0xe2, 0x11, 0x0a, 0x0c, 0x43, 0xe8, 0x4c, 0xc4, 0x8a,
|
||||
0x45, 0x93, 0x54, 0x88, 0x25, 0xc7, 0x36, 0xed, 0x36, 0x89, 0xcf, 0x00, 0x67, 0xe0, 0x12, 0x5c,
|
||||
0x80, 0xa3, 0xa1, 0x6a, 0xb7, 0x1d, 0x4b, 0xfc, 0xd1, 0xec, 0xea, 0xab, 0xaa, 0xae, 0xfc, 0xfa,
|
||||
0xab, 0x8e, 0x61, 0x14, 0xa7, 0x1a, 0x55, 0x2a, 0x93, 0xab, 0x5c, 0x65, 0x3a, 0xe3, 0xc3, 0x46,
|
||||
0x87, 0x3f, 0x18, 0x5c, 0x5c, 0x9f, 0xf2, 0x24, 0x53, 0x52, 0xc7, 0x59, 0xca, 0x47, 0xd0, 0x5b,
|
||||
0x44, 0x01, 0x1b, 0xb3, 0x89, 0x23, 0x7a, 0x8b, 0x88, 0x73, 0x70, 0x6f, 0xe5, 0x01, 0x83, 0xde,
|
||||
0x98, 0x4d, 0x7c, 0x61, 0x62, 0xfe, 0x10, 0xfa, 0xeb, 0x02, 0xd5, 0x22, 0x0a, 0x1c, 0xd3, 0x67,
|
||||
0x15, 0xf5, 0x46, 0x52, 0xcb, 0xc0, 0xad, 0x7b, 0x29, 0xe6, 0x8f, 0xc1, 0x9f, 0x2b, 0x94, 0x1a,
|
||||
0xb7, 0x53, 0x1d, 0x78, 0xa6, 0xfd, 0x9c, 0xa0, 0xea, 0x3a, 0xdf, 0xda, 0x6a, 0xbf, 0xae, 0xb6,
|
||||
0x09, 0x1e, 0xc0, 0x20, 0xc2, 0x9d, 0x2c, 0x13, 0x1d, 0x0c, 0xc6, 0x6c, 0x32, 0x14, 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9b, 0x6f, 0xc9, 0x8b, 0x5f, 0x01, 0x00,
|
||||
0x00, 0xff, 0xff, 0x92, 0xf3, 0x5a, 0x42, 0x5d, 0x04, 0x00, 0x00,
|
||||
// 583 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x94, 0x5f, 0x6e, 0xd3, 0x4e,
|
||||
0x10, 0xc7, 0xb5, 0xb1, 0x9d, 0xc4, 0xd3, 0x9f, 0xfa, 0x43, 0xab, 0x0a, 0xad, 0x10, 0x0f, 0x96,
|
||||
0xc5, 0x83, 0x91, 0x50, 0x1f, 0xe0, 0x04, 0x69, 0x5d, 0xa1, 0x40, 0x29, 0x65, 0xdb, 0x8a, 0x27,
|
||||
0x1e, 0xb6, 0xcd, 0xb4, 0xb5, 0xb4, 0xb1, 0xcd, 0xda, 0x26, 0xf1, 0x1d, 0x38, 0x03, 0x97, 0xe0,
|
||||
0x00, 0x70, 0x34, 0x34, 0xeb, 0xb5, 0x63, 0x89, 0x3f, 0xea, 0xdb, 0x7c, 0x67, 0x26, 0xb3, 0x9f,
|
||||
0xfd, 0xee, 0xc4, 0xb0, 0x9f, 0xe5, 0x35, 0x9a, 0x5c, 0xe9, 0xc3, 0xd2, 0x14, 0x75, 0xc1, 0xe7,
|
||||
0xbd, 0x8e, 0xbf, 0x33, 0xd8, 0x3b, 0xd9, 0x96, 0xba, 0x30, 0xaa, 0xce, 0x8a, 0x9c, 0xef, 0xc3,
|
||||
0x64, 0x99, 0x0a, 0x16, 0xb1, 0xc4, 0x93, 0x93, 0x65, 0xca, 0x39, 0xf8, 0x67, 0x6a, 0x8d, 0x62,
|
||||
0x12, 0xb1, 0x24, 0x94, 0x36, 0xe6, 0x8f, 0x61, 0x7a, 0x55, 0xa1, 0x59, 0xa6, 0xc2, 0xb3, 0x7d,
|
||||
0x4e, 0x51, 0x6f, 0xaa, 0x6a, 0x25, 0xfc, 0xae, 0x97, 0x62, 0xfe, 0x14, 0xc2, 0x63, 0x83, 0xaa,
|
||||
0xc6, 0xd5, 0xa2, 0x16, 0x81, 0x6d, 0xdf, 0x25, 0xa8, 0x7a, 0x55, 0xae, 0x5c, 0x75, 0xda, 0x55,
|
||||
0x87, 0x04, 0x17, 0x30, 0x4b, 0xf1, 0x56, 0x35, 0xba, 0x16, 0xb3, 0x88, 0x25, 0x73, 0xd9, 0xcb,
|
||||
0xf8, 0x27, 0x83, 0xe9, 0x45, 0xd1, 0x98, 0x1b, 0x7c, 0x10, 0x30, 0x07, 0xff, 0xb2, 0x2d, 0xd1,
|
||||
0xe2, 0x86, 0xd2, 0xc6, 0xfc, 0x09, 0xcc, 0x09, 0x3b, 0xa7, 0xde, 0x0e, 0x78, 0xd0, 0x54, 0x3b,
|
||||
0x57, 0x55, 0xb5, 0x29, 0xcc, 0xca, 0x32, 0x87, 0x72, 0xd0, 0xfc, 0x11, 0x78, 0x57, 0xf2, 0xd4,
|
||||
0xc2, 0x86, 0x92, 0xc2, 0xbf, 0x63, 0xd2, 0x9c, 0x4b, 0xd4, 0x78, 0x67, 0xd4, 0xad, 0x98, 0x77,
|
||||
0x73, 0x7a, 0x1d, 0x7f, 0xa5, 0x2b, 0xa0, 0xf9, 0x82, 0xe6, 0x41, 0x57, 0x18, 0xe3, 0x7a, 0xff,
|
||||
0xc0, 0xf5, 0xff, 0x8c, 0x1b, 0xec, 0x70, 0x0f, 0x20, 0xb8, 0x30, 0x37, 0xcb, 0xd4, 0xf9, 0xdd,
|
||||
0x89, 0xf8, 0x1b, 0x83, 0xe9, 0xa9, 0x6a, 0x8b, 0xa6, 0x1e, 0xe1, 0x84, 0x16, 0x27, 0x82, 0xbd,
|
||||
0x45, 0x59, 0xea, 0xec, 0xc6, 0x6e, 0x88, 0xa3, 0x1a, 0xa7, 0xa8, 0xe3, 0x1d, 0xaa, 0xaa, 0x31,
|
||||
0xb8, 0xc6, 0xbc, 0x76, 0x7c, 0xe3, 0x14, 0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, 0xf7, 0x68, 0xdc, 0xf5, 0x42, 0xe9, 0x54, 0xfc, 0x09, 0xc2, 0x85, 0x46,
|
||||
0x53, 0xcb, 0x46, 0xe3, 0x6f, 0x6f, 0xcb, 0xc1, 0x7f, 0x73, 0xf1, 0xfe, 0xac, 0x5f, 0x35, 0x8a,
|
||||
0x77, 0x0b, 0xe2, 0x8d, 0x16, 0x84, 0xc6, 0xbf, 0x55, 0xa5, 0x5a, 0xa6, 0xd6, 0x51, 0x4f, 0x3a,
|
||||
0x15, 0xbf, 0x00, 0x9f, 0x16, 0x71, 0x34, 0xd9, 0xb7, 0x93, 0x0f, 0x20, 0x38, 0x59, 0xab, 0x4c,
|
||||
0xbb, 0xd1, 0x9d, 0xb8, 0x9e, 0xda, 0xef, 0xcf, 0xab, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x47,
|
||||
0x4e, 0x32, 0xc9, 0x91, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ message Cell {
|
|||
repeated Query queries = 5; // Time-series data queries for Cell.
|
||||
string i = 6; // Unique identifier for the cell
|
||||
string name = 7; // User-facing name for this cell
|
||||
repeated int64 yranges = 8; // Limits of the y-axes
|
||||
repeated string ylabels = 9; // Labels of the y-axes
|
||||
}
|
||||
|
||||
message Query {
|
||||
|
|
|
@ -71,3 +71,43 @@ func TestMarshalServer(t *testing.T) {
|
|||
t.Fatalf("source protobuf copy error: got %#v, expected %#v", vv, v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshalLayout(t *testing.T) {
|
||||
layout := chronograf.Layout{
|
||||
ID: "id",
|
||||
Measurement: "measurement",
|
||||
Application: "app",
|
||||
Cells: []chronograf.Cell{
|
||||
{
|
||||
X: 1,
|
||||
Y: 1,
|
||||
W: 4,
|
||||
H: 4,
|
||||
I: "anotherid",
|
||||
YRanges: []int64{1, 2},
|
||||
YLabels: []string{"y1", "y2"},
|
||||
Name: "cell1",
|
||||
Queries: []chronograf.Query{
|
||||
{
|
||||
Command: "select mean(usage_user) as usage_user from cpu",
|
||||
Wheres: []string{
|
||||
`"host"="myhost"`,
|
||||
},
|
||||
GroupBys: []string{
|
||||
`"cpu"`,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var vv chronograf.Layout
|
||||
if buf, err := internal.MarshalLayout(layout); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if err := internal.UnmarshalLayout(buf, &vv); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if !reflect.DeepEqual(layout, vv) {
|
||||
t.Fatalf("source protobuf copy error: got %#v, expected %#v", vv, layout)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,13 +245,15 @@ type ExplorationStore interface {
|
|||
|
||||
// Cell is a rectangle and multiple time series queries to visualize.
|
||||
type Cell struct {
|
||||
X int32 `json:"x"`
|
||||
Y int32 `json:"y"`
|
||||
W int32 `json:"w"`
|
||||
H int32 `json:"h"`
|
||||
I string `json:"i"`
|
||||
Name string `json:"name"`
|
||||
Queries []Query `json:"queries"`
|
||||
X int32 `json:"x"`
|
||||
Y int32 `json:"y"`
|
||||
W int32 `json:"w"`
|
||||
H int32 `json:"h"`
|
||||
I string `json:"i"`
|
||||
YRanges []int64 `json:"yranges"` // YRanges are the initial limits of the y-axes
|
||||
YLabels []string `json:"ylabels"` // YLabels are the labels of the y-axes (possible to have more than one)
|
||||
Name string `json:"name"`
|
||||
Queries []Query `json:"queries"`
|
||||
}
|
||||
|
||||
// Layout is a collection of Cells for visualization
|
||||
|
|
|
@ -49,6 +49,8 @@ The meaning of the fields are as follows:
|
|||
* cell - An array of graphs
|
||||
* x - Not currently used
|
||||
* y - Not currently used
|
||||
* yranges - Optional key specifying the default y-axes ranges (must come in pairs)
|
||||
* ylabels - Optional key specifying the user-facing names of the y-axes. Indices in ylabels correspond with yrange pairs
|
||||
* w - The width of the graph, for the initial release set to 4 to make everything line up properly.
|
||||
* h - The height of the graph, for the initial release set to 4 to make everything line up properly
|
||||
* i - A unique ID for the graph
|
||||
|
|
|
@ -18,7 +18,14 @@ func newLayoutResponse(layout chronograf.Layout) layoutResponse {
|
|||
httpAPILayouts := "/chronograf/v1/layouts"
|
||||
href := fmt.Sprintf("%s/%s", httpAPILayouts, layout.ID)
|
||||
rel := "self"
|
||||
|
||||
for i, c := range layout.Cells {
|
||||
if c.YLabels == nil {
|
||||
layout.Cells[i].YLabels = make([]string, 0)
|
||||
}
|
||||
if c.YRanges == nil {
|
||||
layout.Cells[i].YRanges = make([]int64, 0)
|
||||
}
|
||||
}
|
||||
return layoutResponse{
|
||||
Layout: layout,
|
||||
Link: link{
|
||||
|
@ -172,6 +179,10 @@ func ValidLayoutRequest(l chronograf.Layout) error {
|
|||
if c.W == 0 || c.H == 0 {
|
||||
return fmt.Errorf("w, and h required")
|
||||
}
|
||||
// Y-Range must come in pairs (I'm leaving the option open for multiple y-axes)
|
||||
if len(c.YRanges)%2 != 0 {
|
||||
return fmt.Errorf("Incorrect length of yrange: %d", len(c.YRanges))
|
||||
}
|
||||
for _, q := range c.Queries {
|
||||
if q.Command == "" {
|
||||
return fmt.Errorf("query required")
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": ["routes"],
|
||||
"summary": "Lists all the endpoints",
|
||||
"description": "List of the endpoints.",
|
||||
"responses": {
|
||||
|
@ -38,6 +39,7 @@
|
|||
},
|
||||
"/sources": {
|
||||
"get": {
|
||||
"tags": ["sources"],
|
||||
"summary": "Configured data sources",
|
||||
"description": "These data sources store time series data.",
|
||||
"responses": {
|
||||
|
@ -56,6 +58,7 @@
|
|||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": ["sources"],
|
||||
"summary": "Create new data source",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -92,6 +95,7 @@
|
|||
},
|
||||
"/sources/{id}": {
|
||||
"get": {
|
||||
"tags": ["sources"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -125,6 +129,7 @@
|
|||
}
|
||||
},
|
||||
"patch": {
|
||||
"tags": ["sources"],
|
||||
"summary": "Update data source configuration",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -166,6 +171,7 @@
|
|||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": ["sources"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -197,6 +203,7 @@
|
|||
},
|
||||
"/sources/{id}/proxy": {
|
||||
"post": {
|
||||
"tags": ["sources", "proxy"],
|
||||
"description": "Query the backend time series data source and return the response according to `format`",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -252,6 +259,7 @@
|
|||
},
|
||||
"/users": {
|
||||
"get": {
|
||||
"tags": ["users"],
|
||||
"summary": "List of all users on this data source",
|
||||
"responses": {
|
||||
"200": {
|
||||
|
@ -269,6 +277,7 @@
|
|||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": ["users"],
|
||||
"summary": "Create new user for this data source",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -305,6 +314,7 @@
|
|||
},
|
||||
"/users/{user_id}": {
|
||||
"get": {
|
||||
"tags": ["users"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "user_id",
|
||||
|
@ -338,6 +348,7 @@
|
|||
}
|
||||
},
|
||||
"patch": {
|
||||
"tags": ["users"],
|
||||
"summary": "Update user configuration",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -379,6 +390,7 @@
|
|||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": ["users"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "user_id",
|
||||
|
@ -410,6 +422,8 @@
|
|||
},
|
||||
"/users/{user_id}/explorations": {
|
||||
"get": {
|
||||
"tags": ["users", "explorations"],
|
||||
"summary": "Returns all explorations for specified user",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "user_id",
|
||||
|
@ -441,6 +455,7 @@
|
|||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": ["users", "explorations"],
|
||||
"summary": "Create new named exploration for this user",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -490,6 +505,7 @@
|
|||
},
|
||||
"/users/{user_id}/explorations/{exploration_id}": {
|
||||
"get": {
|
||||
"tags": ["users", "explorations"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "user_id",
|
||||
|
@ -530,6 +546,7 @@
|
|||
}
|
||||
},
|
||||
"patch": {
|
||||
"tags": ["users", "explorations"],
|
||||
"summary": "Update exploration configuration",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -578,6 +595,7 @@
|
|||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": ["users", "explorations"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "user_id",
|
||||
|
@ -616,6 +634,7 @@
|
|||
},
|
||||
"/sources/{id}/kapacitors": {
|
||||
"get": {
|
||||
"tags": ["sources", "kapacitors"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -642,6 +661,7 @@
|
|||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": ["sources", "kapacitors"],
|
||||
"summary": "Create new kapacitor backend",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -685,6 +705,7 @@
|
|||
},
|
||||
"/sources/{id}/kapacitors/{kapa_id}": {
|
||||
"get": {
|
||||
"tags": ["sources", "kapacitors"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -725,6 +746,7 @@
|
|||
}
|
||||
},
|
||||
"patch": {
|
||||
"tags": ["sources", "kapacitors"],
|
||||
"summary": "Update kapacitor configuration",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -773,6 +795,7 @@
|
|||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": ["sources", "kapacitors"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -809,30 +832,28 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/sources/{id}/kapacitors/{kapa_id}/tasks": {
|
||||
"/sources/{id}/kapacitors/{kapa_id}/rules": {
|
||||
"get": {
|
||||
"description": "Get all defined alert tasks.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the source",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "kapa_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the kapacitor backend.",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"tags": ["sources", "kapacitors", "rules"],
|
||||
"description": "Get all defined alert rules.",
|
||||
"parameters": [{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the source",
|
||||
"required": true
|
||||
}, {
|
||||
"name": "kapa_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the kapacitor backend.",
|
||||
"required": true
|
||||
}],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "All alert tasks for this specific kapacitor are returned",
|
||||
"description": "All alert rules for this specific kapacitor are returned",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Tasks"
|
||||
"$ref": "#/definitions/Rules"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
|
@ -850,54 +871,57 @@
|
|||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "Create kapacitor alert task",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the source",
|
||||
"required": true
|
||||
"tags": ["sources", "kapacitors", "rules"],
|
||||
"description": "Create kapacitor alert rule",
|
||||
"parameters": [{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the source",
|
||||
"required": true
|
||||
}, {
|
||||
"name": "kapa_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the kapacitor backend.",
|
||||
"required": true
|
||||
}, {
|
||||
"name": "rule",
|
||||
"in": "body",
|
||||
"description": "Rule to generate alert rule",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Rule"
|
||||
},
|
||||
{
|
||||
"name": "kapa_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the kapacitor backend.",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "task",
|
||||
"in": "body",
|
||||
"description": "Rule to generate alert task",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Task"
|
||||
},
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"required": true
|
||||
}],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Successfully created new kapacitor alert task",
|
||||
"description": "Successfully created new kapacitor alert rule",
|
||||
"headers": {
|
||||
"Location": {
|
||||
"type": "string",
|
||||
"format": "url",
|
||||
"description": "Location of the newly created kapacitor task resource."
|
||||
"description": "Location of the newly created kapacitor rule resource."
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Task"
|
||||
"$ref": "#/definitions/Rule"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Kapacitor ID does not exist.",
|
||||
"description": "Source ID or Kapacitor ID does not exist.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Error"
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Source ID , Kapacitor ID or alert are unprocessable",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Error"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Internal server error",
|
||||
"description": "Internal server error; generally a problem creating alert in kapacitor",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Error"
|
||||
}
|
||||
|
@ -905,42 +929,39 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/sources/{id}/kapacitors/{kapa_id}/tasks/{task_id}": {
|
||||
"/sources/{id}/kapacitors/{kapa_id}/rules/{rule_id}": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the source",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "kapa_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the kapacitor",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "task_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the task",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"summary": "Specific kapacitor alert task",
|
||||
"description": "Alerting task for kapacitor",
|
||||
"tags": ["sources", "kapacitors", "rules"],
|
||||
"parameters": [{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the source",
|
||||
"required": true
|
||||
}, {
|
||||
"name": "kapa_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the kapacitor",
|
||||
"required": true
|
||||
}, {
|
||||
"name": "rule_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the rule",
|
||||
"required": true
|
||||
}],
|
||||
"summary": "Specific kapacitor alert rule",
|
||||
"description": "Alerting rule for kapacitor",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Alert exists and has a specific TICKscript",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Task"
|
||||
"$ref": "#/definitions/Rule"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Unknown data source, kapacitor id, or task id",
|
||||
"description": "Unknown data source, kapacitor id, or rule id",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Error"
|
||||
}
|
||||
|
@ -954,9 +975,9 @@
|
|||
}
|
||||
},
|
||||
"put": {
|
||||
"summary": "Update rule alert task configuration",
|
||||
"parameters": [
|
||||
{
|
||||
"tags": ["sources", "kapacitors", "rules"],
|
||||
"summary": "Update rule alert rule configuration",
|
||||
"parameters": [{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
|
@ -969,20 +990,19 @@
|
|||
"type": "string",
|
||||
"description": "ID of a kapacitor backend",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "task_id",
|
||||
}, {
|
||||
"name": "rule_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of a task",
|
||||
"description": "ID of a rule",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "task",
|
||||
"name": "rule",
|
||||
"in": "body",
|
||||
"description": "Task update",
|
||||
"description": "Rule update",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Task"
|
||||
"$ref": "#/definitions/Rule"
|
||||
},
|
||||
"required": true
|
||||
}
|
||||
|
@ -991,11 +1011,11 @@
|
|||
"200": {
|
||||
"description": "Alert configuration was changed",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Task"
|
||||
"$ref": "#/definitions/Rule"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Happens when trying to access a non-existent data source, kapacitor, or task.",
|
||||
"description": "Happens when trying to access a non-existent data source, kapacitor, or rule.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Error"
|
||||
}
|
||||
|
@ -1009,6 +1029,7 @@
|
|||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": ["sources", "kapacitors", "rules"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -1023,22 +1044,21 @@
|
|||
"type": "string",
|
||||
"description": "ID of the kapacitor",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "task_id",
|
||||
}, {
|
||||
"name": "rule_id",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "ID of the task",
|
||||
"description": "ID of the rule",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"summary": "This specific alert task will be removed.",
|
||||
"summary": "This specific alert rule will be removed.",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "Alert task has been removed."
|
||||
"description": "Alert rule has been removed."
|
||||
},
|
||||
"404": {
|
||||
"description": "Unknown Data source, Kapacitor id, or alert task",
|
||||
"description": "Unknown Data source, Kapacitor id, or alert rule",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Error"
|
||||
}
|
||||
|
@ -1054,6 +1074,7 @@
|
|||
},
|
||||
"/sources/{id}/kapacitors/{kapa_id}/proxy": {
|
||||
"get": {
|
||||
"tags": ["sources", "kapacitors", "proxy"],
|
||||
"description": "GET to `path` of kapacitor. The response and status code from kapacitor is directly returned.",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -1097,6 +1118,7 @@
|
|||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": ["sources", "kapacitors", "proxy"],
|
||||
"description": "DELETE to `path` of kapacitor. The response and status code from kapacitor is directly returned.",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -1140,6 +1162,7 @@
|
|||
}
|
||||
},
|
||||
"patch": {
|
||||
"tags": ["sources", "kapacitors", "proxy"],
|
||||
"description": "PATCH body directly to configured kapacitor. The response and status code from kapacitor is directly returned.",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -1192,6 +1215,7 @@
|
|||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": ["sources", "kapacitors", "proxy"],
|
||||
"description": "POST body directly to configured kapacitor. The response and status code from kapacitor is directly returned.",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -1246,6 +1270,7 @@
|
|||
},
|
||||
"/mappings": {
|
||||
"get": {
|
||||
"tags": ["layouts", "mappings"],
|
||||
"summary": "Mappings between app names and measurements",
|
||||
"description": "Mappings provide a means to alias measurement names found within a telegraf database and application layouts found within Chronograf\n",
|
||||
"responses": {
|
||||
|
@ -1266,6 +1291,7 @@
|
|||
},
|
||||
"/layouts": {
|
||||
"get": {
|
||||
"tags": ["layouts"],
|
||||
"summary": "Pre-configured layouts",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -1308,6 +1334,7 @@
|
|||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": ["layouts"],
|
||||
"summary": "Create new layout",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -1344,6 +1371,7 @@
|
|||
},
|
||||
"/layouts/{id}": {
|
||||
"get": {
|
||||
"tags": ["layouts"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -1377,6 +1405,7 @@
|
|||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": ["layouts"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -1406,6 +1435,7 @@
|
|||
}
|
||||
},
|
||||
"put": {
|
||||
"tags": ["layouts"],
|
||||
"summary": "Replace layout configuration.",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -1505,9 +1535,9 @@
|
|||
"description": "URL location of proxy endpoint for this kapacitor",
|
||||
"format": "url"
|
||||
},
|
||||
"tasks": {
|
||||
"rules": {
|
||||
"type": "string",
|
||||
"description": "URL location of tasks endpoint for this kapacitor",
|
||||
"description": "URL location of rules endpoint for this kapacitor",
|
||||
"format": "url"
|
||||
}
|
||||
}
|
||||
|
@ -1522,6 +1552,103 @@
|
|||
"description": "Entire response from the kapacitor backend.",
|
||||
"type": "object"
|
||||
},
|
||||
"Rules": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"rules"
|
||||
],
|
||||
"properties": {
|
||||
"rules": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Rule"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Rule": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"every",
|
||||
"trigger"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "ID for this rule; the ID is shared with kapacitor"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "User facing name of the alerting rule"
|
||||
},
|
||||
"every" : {
|
||||
"type": "string",
|
||||
"description": "Golang duration string specifying how often the alert condition is checked"
|
||||
},
|
||||
"alerts": {
|
||||
"type": "array",
|
||||
"description": "Array of alerting services to warn if the alert is triggered",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"hipchat",
|
||||
"opsgenie",
|
||||
"pagerduty",
|
||||
"victorops",
|
||||
"smtp",
|
||||
"email",
|
||||
"sensu",
|
||||
"slack",
|
||||
"talk",
|
||||
"telegram"
|
||||
]
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": "Message to send when alert occurs."
|
||||
},
|
||||
"trigger": {
|
||||
"type": "string",
|
||||
"description": "Trigger defines the alerting structure; deadman alert if no data are received for the specified time range; relative alert if the data change relative to the data in a different time range; threshold alert if the data cross a boundary",
|
||||
"enum": [
|
||||
"deadman",
|
||||
"relative",
|
||||
"threshold"
|
||||
]
|
||||
},
|
||||
"tickscript": {
|
||||
"type": "string",
|
||||
"description": "TICKscript representing this rule"
|
||||
},
|
||||
"links": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"self",
|
||||
"kapacitor"
|
||||
],
|
||||
"properties": {
|
||||
"self": {
|
||||
"description": "Self link pointing to this rule resource",
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"kapacitor": {
|
||||
"description": "Link pointing to the kapacitor proxy for this rule including the path query parameter.",
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"output": {
|
||||
"description": "Link pointing to the kapacitor httpOut node of the tickscript; includes the path query argument",
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"Sources": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
@ -1690,12 +1817,12 @@
|
|||
"User": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"username"
|
||||
"email"
|
||||
],
|
||||
"properties": {
|
||||
"username": {
|
||||
"email": {
|
||||
"type": "string",
|
||||
"maxLength": 64
|
||||
"maxLength": 254
|
||||
},
|
||||
"link": {
|
||||
"$ref": "#/definitions/Link"
|
||||
|
@ -1782,12 +1909,18 @@
|
|||
"Cell": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"i",
|
||||
"x",
|
||||
"y",
|
||||
"w",
|
||||
"h"
|
||||
],
|
||||
"properties": {
|
||||
"i": {
|
||||
"description": "Unique ID of Cell",
|
||||
"type": "string",
|
||||
"format": "uuid4"
|
||||
},
|
||||
"x": {
|
||||
"description": "X-coordinate of Cell in the Layout",
|
||||
"type": "integer",
|
||||
|
@ -1814,7 +1947,22 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/LayoutQuery"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ylabels": {
|
||||
"description": "Optional Y-axis user-facing label",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"yranges": {
|
||||
"description": "Optional default range of the Y-axis; Must come in pairs.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"LayoutQuery": {
|
||||
|
@ -1850,6 +1998,11 @@
|
|||
"type": "string",
|
||||
"format": "url"
|
||||
},
|
||||
"me": {
|
||||
"description": "Location of the me endpoint.",
|
||||
"type": "string",
|
||||
"format": "url"
|
||||
},
|
||||
"layouts": {
|
||||
"description": "Location of the layouts endpoint",
|
||||
"type": "string",
|
||||
|
@ -1909,4 +2062,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue