Skip to content

Commit 9dccd4f

Browse files
author
Hirotaka Tagawa / wafuwafu13
authored
Merge pull request #127 from wafuwafu13/add-dashboard
Add Dashboard
2 parents efb72a8 + f4b5fdc commit 9dccd4f

9 files changed

+2207
-1
lines changed

docs/data-sources/dashboard.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
page_title: "Mackerel: mackerel_dashboard"
3+
subcategory: "Dashboard"
4+
description: |-
5+
---
6+
7+
# Data Source: mackerel_dashboard
8+
9+
Use this data source allows access to details of a specific dashboard.
10+
11+
## Example Usage
12+
13+
```terraform
14+
data "mackerel_dashboard" "this" {
15+
id = "example_id"
16+
}
17+
```
18+
19+
## Argument Reference
20+
21+
* `id` - (Required) The ID of dashboard.
22+
23+
## Attributes Reference
24+
25+
* `id` - The ID of dashboard.
26+
* `title` - The title of dashboard.
27+
* `memo` - The memo of dashboard.
28+
* `url_path` - The URL path of dashboard.
29+
* `created_at` - Creation time (epoch seconds).
30+
* `updated_at` - Last update time (epoch seconds).
31+
* `graph` - The graph widget.
32+
* `title` - The title of graph widget.
33+
* `host` - The host graph.
34+
* `host_id` - The ID of host.
35+
* `name` - The name of graph (e.g., "loadavg")
36+
* `role` - The role graph.
37+
* `role_fullname` - The service name and role name concatenated by `:`.
38+
* `name` - The name of graph (e.g., "loadav5").
39+
* `is_stacked` - Whether the graph is a stacked or line chart. If true, it will be a stacked graph.
40+
* `service` - The service graph.
41+
* `service_name` - The name of service.
42+
* `name` - The name of graph.
43+
* `expression` - The expression graph.
44+
* `expression` - The expression for graphs.
45+
* `range` - The display period for graphs. If unspecified, it will be variable and the display period can be changed from the controller displayed at the top of the dashboard.
46+
* `relative` - (The period from (current time + `offset` - `period`) to (current time + `offset`) is displayed. Negative values for `offset` can be used to display graphs for a specified period in the past.
47+
* `period` - Duration (seconds).
48+
* `offset` - Difference from the current time (seconds).
49+
* `absolute` - The period from start to end is displayed.
50+
* `start` - Start time (epoch seconds).
51+
* `end` - End time (epoch seconds).
52+
* `layout` - The coordinates are specified with the upper left corner of the widget display area as the origin (x = 0, y = 0), with the x axis in the right direction and the y axis in the down direction as the positive direction.
53+
* `x` - The x coordinate of widget.
54+
* `y` - The y coordinate of widget.
55+
* `width` - The width of widget.
56+
* `height` - The height of widget.
57+
* `value` - The value widget.
58+
* `title` - The title of value widget.
59+
* `metric` - The metric of value widget.
60+
* `host` - The host metric.
61+
* `host_id` - The ID of host.
62+
* `name` - The name of metric (e.g., "loadavg5").
63+
* `service` - The service metric.
64+
* `service_name` - The name of service.
65+
* `name` - The name of metric.
66+
* `expression` - The expression metric.
67+
* `expression` - The expression for metric.
68+
* `fraction_size` - Number of decimal places to display (0-16).
69+
* `suffix` - Units to be displayed after the numerical value.
70+
* `layout` - The coordinates are specified with the upper left corner of the widget display area as the origin (x = 0, y = 0), with the x axis in the right direction and they axis in the down direction as the positive direction.
71+
* `x` - The x coordinate of widget.
72+
* `y` - The y coordinate of widget.
73+
* `width` - The width of widget.
74+
* `height` - The height of widget.
75+
* `markdown` - The markdown widget.
76+
* `title` - The title of markdown widget.
77+
* `markdown` - String in Markdown format.
78+
* `layout` - The coordinates are specified with the upper left corner of the widget display area as the origin (x = 0, y = 0), with the x axis in the right direction and they axis in the down direction as the positive direction.
79+
* `x` - The x coordinate of widget.
80+
* `y` - The y coordinate of widget.
81+
* `width` - The width of widget.
82+
* `height` - The height of widget.
83+
* `alert_status` - The alertStatus widget.
84+
* `title` - The title of alertStatus widget.
85+
* `role_fullname` - The service name and role name concatenated by `:`.
86+
* `layout` - The coordinates are specified with the upper left corner of the widget display area as the origin (x = 0, y = 0), with the x axis in the right direction and they axis in the down direction as the positive direction.
87+
* `x` - The x coordinate of widget.
88+
* `y` - The y coordinate of widget.
89+
* `width` - The width of widget.
90+
* `height` - The height of widget.

docs/resources/dashboard.md

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
---
2+
page_title: "Mackerel: mackerel_dashboard"
3+
subcategory: "Dashboard"
4+
description: |-
5+
6+
---
7+
8+
# Resource: mackerel_dashboard
9+
10+
This resource allows creating and management of dashboard.
11+
12+
## Example Usage
13+
14+
### Graph Widget
15+
16+
```terraform
17+
resource "mackerel_service" "foo" {
18+
name = "tf-service-foo"
19+
}
20+
21+
resource "mackerel_role" "foo" {
22+
service = mackerel_service.foo.name
23+
name = "tf-role-foo"
24+
}
25+
26+
resource "mackerel_dashboard" "graph" {
27+
title = "foo"
28+
memo = "This dashboard is managed by Terraform."
29+
url_path = "bar"
30+
graph {
31+
title = "graph role"
32+
role {
33+
role_fullname = "${mackerel_service.foo.name}:${mackerel_role.foo.name}"
34+
name = "loadavg5"
35+
is_stacked = true
36+
}
37+
range {
38+
relative {
39+
period = 3600
40+
offset = 1800
41+
}
42+
}
43+
layout {
44+
x = 2
45+
y = 12
46+
width = 10
47+
height = 8
48+
}
49+
}
50+
}
51+
```
52+
53+
### Value Widget
54+
55+
```terraform
56+
resource "mackerel_service" "foo" {
57+
name = "tf-service-foo"
58+
}
59+
60+
resource "mackerel_role" "foo" {
61+
service = mackerel_service.foo.name
62+
name = "tf-role-foo"
63+
}
64+
65+
resource "mackerel_dashboard" "value" {
66+
title = "foo"
67+
memo = "This dashboard is managed by Terraform."
68+
url_path = "bar"
69+
value {
70+
title = "test value expression"
71+
metric {
72+
expression {
73+
expression = "role(${mackerel_service.foo.name}:${mackerel_role.foo.name}, loadavg5)"
74+
}
75+
}
76+
fraction_size = 5
77+
suffix = "test suffix"
78+
layout {
79+
x = 3
80+
y = 15
81+
width = 3
82+
height = 4
83+
}
84+
}
85+
}
86+
```
87+
88+
### Markdown Widget
89+
90+
```terraform
91+
resource "mackerel_dashboard" "markdown" {
92+
title = "foo"
93+
memo = "This dashboard is managed by Terraform."
94+
url_path = "bar"
95+
markdown {
96+
title = "test markdown"
97+
markdown = "# h1"
98+
layout {
99+
x = 1
100+
y = 2
101+
width = 3
102+
height = 4
103+
}
104+
}
105+
}
106+
```
107+
108+
### AlertStatus Widget
109+
110+
```terraform
111+
resource "mackerel_service" "foo" {
112+
name = "tf-service-foo"
113+
}
114+
115+
resource "mackerel_role" "foo" {
116+
service = mackerel_service.foo.name
117+
name = "tf-role-foo"
118+
}
119+
120+
resource "mackerel_dashboard" "alert_status" {
121+
title = "foo"
122+
memo = "This dashboard is managed by Terraform."
123+
url_path = "bar"
124+
alert_status {
125+
title = "test alertStatus"
126+
role_fullname = "${mackerel_service.foo.name}:${mackerel_role.foo.name}"
127+
layout {
128+
x = 1
129+
y = 2
130+
width = 3
131+
height = 4
132+
}
133+
}
134+
}
135+
```
136+
137+
## Argument Reference
138+
139+
* `title` - (Required) The title of dashboard.
140+
* `memo` - The memo of dashboard.
141+
* `url_path` - The URL path of dashboard.
142+
143+
### graph
144+
145+
* `title` - The title of graph widget.
146+
* `host` - The host graph.
147+
* `host_id` - (Required) The ID of host.
148+
* `name` - (Required) The name of graph (e.g., "loadavg")
149+
* `role` - The role graph.
150+
* `role_fullname` - (Required) The service name and role name concatenated by `:`.
151+
* `name` - (Required) The name of graph (e.g., "loadav5").
152+
* `is_stacked` - Whether the graph is a stacked or line chart. If true, it will be astacked graph.
153+
* `service` - The service graph.
154+
* `service_name` - (Required) The name of service.
155+
* `name` - (Required) The name of graph.
156+
* `expression` - The expression graph.
157+
* `expression` - (Required) The expression for graphs.
158+
* `range` - The display period for graphs. If unspecified, it will be variable and thedisplay period can be changed from the controller displayed at the top of the dashboard.
159+
* `relative` - (The period from (current time + `offset` - `period`) to (current time + `offset`) is displayed. Negative values for `offset` can be used to display graphs for a specified period in the past.
160+
* `period` - (Required) Duration (seconds).
161+
* `offset` - (Required) Difference from the current time (seconds).
162+
* `absolute` - The period from start to end is displayed.
163+
* `start` - (Required) Start time (epoch seconds).
164+
* `end` - (Required) End time (epoch seconds).
165+
* `layout` - (Required) The coordinates are specified with the upper left corner of the widget display area as the origin (x = 0, y = 0), with the x axis in the right direction and the y axis in the down direction as the positive direction.
166+
* `x` - (Required) The x coordinate of widget.
167+
* `y` - (Required) The y coordinate of widget.
168+
* `width` - (Required) The width of widget.
169+
* `height` - (Required) The height of widget.
170+
171+
### value
172+
173+
* `title` - The title of value widget.
174+
* `metric` - The metric of value widget.
175+
* `host` - The host metric.
176+
* `host_id` - (Required) The ID of host.
177+
* `name` - (Required) The name of metric (e.g., "loadavg5").
178+
* `service` - The service metric.
179+
* `service_name` - (Required) The name of service.
180+
* `name` - (Required) The name of metric.
181+
* `expression` - The expression metric.
182+
* `expression` - (Required) The expression for metric.
183+
* `fraction_size` - Number of decimal places to display (0-16).
184+
* `suffix` - Units to be displayed after the numerical value.
185+
* `layout` - (Required) The coordinates are specified with the upper left corner of the widget display area as the origin (x = 0, y = 0), with the x axis in the right direction and they axis in the down direction as the positive direction.
186+
* `x` - (Required) The x coordinate of widget.
187+
* `y` - (Required) The y coordinate of widget.
188+
* `width` - (Required) The width of widget.
189+
* `height` - (Required) The height of widget.
190+
191+
### markdown
192+
193+
* `title` - The title of markdown widget.
194+
* `markdown` - (Required) String in Markdown format.
195+
* `layout` - (Required) The coordinates are specified with the upper left corner of the widget display area as the origin (x = 0, y = 0), with the x axis in the right direction and they axis in the down direction as the positive direction.
196+
* `x` - (Required) The x coordinate of widget.
197+
* `y` - (Required) The y coordinate of widget.
198+
* `width` - (Required) The width of widget.
199+
* `height` - (Required) The height of widget.
200+
201+
### alert_status
202+
203+
* `title` - The title of alertStatus widget.
204+
* `role_fullname` - (Required) The service name and role name concatenated by `:`.
205+
* `layout` - (Required) The coordinates are specified with the upper left corner of the widget display area as the origin (x = 0, y = 0), with the x axis in the right direction and they axis in the down direction as the positive direction.
206+
* `x` - (Required) The x coordinate of widget.
207+
* `y` - (Required) The y coordinate of widget.
208+
* `width` - (Required) The width of widget.
209+
* `height` - (Required) The height of widget.

0 commit comments

Comments
 (0)