|
| 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