apiVersion: influxdata.com/v2alpha1 kind: Label metadata: name: flamboyant-leakey-f37001 spec: color: '#67d74e' name: airquality --- apiVersion: influxdata.com/v2alpha1 kind: Variable metadata: name: ridiculous-keller-caf001 spec: associations: - kind: Label name: flamboyant-leakey-f37001 language: flux name: bucket query: |- buckets() |> filter(fn: (r) => r.name !~ /^_/) |> rename(columns: {name: "_value"}) |> keep(columns: ["_value"]) type: query --- apiVersion: influxdata.com/v2alpha1 kind: Bucket metadata: name: musing-grothendieck-f37005 spec: associations: - kind: Label name: flamboyant-leakey-f37001 name: airquality retentionRules: - everySeconds: 2.592e+06 type: expire --- apiVersion: influxdata.com/v2alpha1 kind: Dashboard metadata: name: serene-yonath-337001 spec: associations: - kind: Label name: flamboyant-leakey-f37001 charts: - colors: - hex: '#7CE490' id: "0" name: honeydew type: min - hex: '#FFD255' id: 32aeb4df-7946-405e-bd74-ec9336d1b26a name: thunder type: threshold value: 51 - hex: '#F48D38' id: 91f149f0-3060-4ac1-91c1-66c38139b9aa name: tiger type: threshold value: 101 - hex: '#F95F53' id: 63cc456e-8de9-4954-b9a1-3d35ae1e72a3 name: curacao type: threshold value: 151 - hex: '#513CC6' id: 6ff114b1-61d3-480e-b9d5-0319c847df6e name: planet type: threshold value: 201 - hex: '#BF3D5E' id: ed566b2f-9cf5-4d32-a94b-bcfc4defd011 name: ruby type: threshold value: 301 - hex: '#BF3D5E' id: "1" name: ruby type: max value: 500 decimalPlaces: 2 height: 4 kind: Gauge name: Current PM2.5 Gauge queries: - query: |- from(bucket: v.bucket) |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["ParameterName"] == "PM2.5") |> filter(fn: (r) => r["_field"] == "AQI") |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false) |> yield(name: "last") width: 4 - axes: - base: "10" name: x scale: linear - base: "10" name: y scale: linear colors: - hex: '#31C0F6' id: 9a009419-c2b6-47ce-bc5e-bec960ccc1c9 name: Nineteen Eighty Four type: scale - hex: '#A500A5' id: 4696c34e-fc79-4ba1-a6a1-2c93b864f47e name: Nineteen Eighty Four type: scale - hex: '#FF7E27' id: 9664276e-2f02-4749-af44-113ca213def0 name: Nineteen Eighty Four type: scale geom: line height: 4 hoverDimension: auto kind: Xy legendOpacity: 1 legendOrientationThreshold: 10 name: Air Quality Trends position: overlaid queries: - query: |- from(bucket: v.bucket) |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["ParameterName"] == "O3" or r["ParameterName"] == "PM2.5") |> filter(fn: (r) => r["_field"] == "AQI") |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false) |> yield(name: "last") width: 8 xCol: _time yCol: _value yPos: 4 - colors: - hex: '#4ED8A0' id: "0" name: rainforest type: min - hex: '#FFD255' id: 901cb28f-0c21-4dd8-a946-860cc23bb589 name: thunder type: threshold value: 51 - hex: '#F48D38' id: 056816bd-08d4-4882-b667-772f050c8b63 name: tiger type: threshold value: 101 - hex: '#F95F53' id: 91f149f0-3060-4ac1-91c1-66c38139b9aa name: curacao type: threshold value: 151 - hex: '#513CC6' id: 63cc456e-8de9-4954-b9a1-3d35ae1e72a3 name: planet type: threshold value: 201 - hex: '#BF3D5E' id: 6ff114b1-61d3-480e-b9d5-0319c847df6e name: ruby type: threshold value: 301 - hex: '#BF3D5E' id: "1" name: ruby type: max value: 500 decimalPlaces: 2 height: 4 kind: Gauge name: Current Ozone Quality queries: - query: |- from(bucket: v.bucket) |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["ParameterName"] == "O3") |> filter(fn: (r) => r["_field"] == "AQI") |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false) |> yield(name: "last") width: 5 xPos: 4 name: Air Quality --- apiVersion: influxdata.com/v2alpha1 kind: Telegraf metadata: name: airquality-telegraf spec: associations: - kind: Label name: flamboyant-leakey-f37001 name: airquality-telegraf-config config: | [[outputs.influxdb_v2]] ## The URLs of the InfluxDB cluster nodes. urls = ["$INFLUX_HOST"] ## Token for authentication. token = "$INFLUX_TOKEN" ## Organization is the name of the organization you wish to write to; must exist. organization = "$INFLUX_ORG" ## Destination bucket to write into. Default should be set to 'airquality' bucket = "airquality" # interval at which the API is called. air quality is only updated 1-2 times per day [agent] interval = "12h" # Read formatted metrics from one or more HTTP endpoints [[inputs.http]] ## One or more URLs from which to read formatted metrics urls = ["$INFLUX_AIRQUAL_URL"] ## HTTP method method = "GET" ## List of success status codes success_status_codes = [200] ## Data format to consume. data_format = "json" json_time_key = ["DateForecast"] json_time_format = "2006 01 02 " tag_keys = ["Category_Name", "ParameterName", "Latitude", "Longitude", "ReportingArea"] json_string_fields = ["ActionDay"]