github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/circonus/r/graph.html.markdown (about) 1 --- 2 layout: "circonus" 3 page_title: "Circonus: circonus_graph" 4 sidebar_current: "docs-circonus-resource-circonus_graph" 5 description: |- 6 Manages a Circonus graph. 7 --- 8 9 # circonus\_graph 10 11 The ``circonus_graph`` resource creates and manages a 12 [Circonus Graph](https://login.circonus.com/user/docs/Visualization/Graph/Create). 13 14 https://login.circonus.com/resources/api/calls/graph). 15 16 ## Usage 17 18 ```hcl 19 variable "myapp-tags" { 20 type = "list" 21 default = [ "app:myapp", "owner:myteam" ] 22 } 23 24 resource "circonus_graph" "latency-graph" { 25 name = "Latency Graph" 26 description = "A sample graph showing off two data points" 27 notes = "Misc notes about this graph" 28 graph_style = "line" 29 line_style = "stepped" 30 31 metric { 32 check = "${circonus_check.api_latency.checks[0]}" 33 metric_name = "maximum" 34 metric_type = "numeric" 35 name = "Maximum Latency" 36 axis = "left" 37 color = "#657aa6" 38 } 39 40 metric { 41 check = "${circonus_check.api_latency.checks[0]}" 42 metric_name = "minimum" 43 metric_type = "numeric" 44 name = "Minimum Latency" 45 axis = "right" 46 color = "#0000ff" 47 } 48 49 tags = [ "${var.myapp-tags}" ] 50 } 51 ``` 52 53 ## Argument Reference 54 55 * `description` - (Optional) Description of what the graph is for. 56 57 * `graph_style` - (Optional) How the graph should be rendered. Valid options 58 are `area` or `line` (default). 59 60 * `left` - (Optional) A map of graph left axis options. Valid values in `left` 61 include: `logarithmic` can be set to `0` (default) or `1`; `min` is the `min` 62 Y axis value on the left; and `max` is the Y axis max value on the left. 63 64 * `line_style` - (Optional) How the line should change between points. Can be 65 either `stepped` (default) or `interpolated`. 66 67 * `name` - (Required) The title of the graph. 68 69 * `notes` - (Optional) A place for storing notes about this graph. 70 71 * `right` - (Optional) A map of graph right axis options. Valid values in 72 `right` include: `logarithmic` can be set to `0` (default) or `1`; `min` is 73 the `min` Y axis value on the right; and `max` is the Y axis max value on the 74 right. 75 76 * `metric` - (Optional) A list of metric streams to graph. See below for 77 options. 78 79 * `metric_cluster` - (Optional) A metric cluster to graph. See below for options. 80 81 * `tags` - (Optional) A list of tags assigned to this graph. 82 83 ## `metric` Configuration 84 85 An individual metric stream is the underlying source of data points used for 86 visualization in a graph. Either a `caql` attribute is required or a `check` and 87 `metric` must be set. The `metric` attribute can have the following options 88 set. 89 90 * `active` - (Optional) A boolean if the metric stream is enabled or not. 91 92 * `alpha` - (Optional) A floating point number between 0 and 1. 93 94 * `axis` - (Optional) The axis that the metric stream will use. Valid options 95 are `left` (default) or `right`. 96 97 * `caql` - (Optional) A CAQL formula. Conflicts with the `check` and `metric` 98 attributes. 99 100 * `check` - (Optional) The check that this metric stream belongs to. 101 102 * `color` - (Optional) A hex-encoded color of the line / area on the graph. 103 104 * `formula` - (Optional) Formula that should be aplied to both the values in the 105 graph and the legend. 106 107 * `legend_formula` - (Optional) Formula that should be applied to values in the 108 legend. 109 110 * `function` - (Optional) What derivative value, if any, should be used. Valid 111 values are: `gauge` (default), `derive`, and `counter (_stddev)` 112 113 * `metric_type` - (Required) The type of the metric. Valid values are: 114 `numeric`, `text`, `histogram`, `composite`, or `caql`. 115 116 * `name` - (Optional) A name which will appear in the graph legend. 117 118 * `metric_name` - (Optional) The name of the metric stream within the check to 119 graph. 120 121 * `stack` - (Optional) If this metric is to be stacked, which stack set does it 122 belong to (starting at `0`). 123 124 ## `metric_cluster` Configuration 125 126 A metric cluster selects multiple metric streams together dynamically using a 127 query language and returns the set of matching metric streams as a single result 128 set to the graph rendering engine. 129 130 * `active` - (Optional) A boolean if the metric cluster is enabled or not. 131 132 * `aggregate` - (Optional) The aggregate function to apply across this metric 133 cluster to create a single value. Valid values are: `none` (default), `min`, 134 `max`, `sum`, `mean`, or `geometric_mean`. 135 136 * `axis` - (Optional) The axis that the metric cluster will use. Valid options 137 are `left` (default) or `right`. 138 139 * `color` - (Optional) A hex-encoded color of the line / area on the graph. 140 This is a required attribute when `aggregate` is specified. 141 142 * `group` - (Optional) The `metric_cluster` that will provide datapoints for this 143 graph. 144 145 * `name` - (Optional) A name which will appear in the graph legend for this 146 metric cluster. 147 148 ## Import Example 149 150 `circonus_graph` supports importing resources. Supposing the following 151 Terraform (and that the referenced [`circonus_metric`](metric.html) 152 and [`circonus_check`](check.html) have already been imported): 153 154 ```text 155 resource "circonus_graph" "icmp-graph" { 156 name = "Test graph" 157 graph_style = "line" 158 line_style = "stepped" 159 160 metric { 161 check = "${circonus_check.api_latency.checks[0]}" 162 metric_name = "maximum" 163 metric_type = "numeric" 164 name = "Maximum Latency" 165 axis = "left" 166 } 167 } 168 ``` 169 170 It is possible to import a `circonus_graph` resource with the following command: 171 172 ``` 173 $ terraform import circonus_graph.usage ID 174 ``` 175 176 Where `ID` is the `_cid` or Circonus ID of the graph 177 (e.g. `/graph/bd72aabc-90b9-4039-cc30-c9ab838c18f5`) and 178 `circonus_graph.icmp-graph` is the name of the resource whose state will be 179 populated as a result of the command.