{
  "__inputs": [
    {
      "name": "DS_INFLUXDB2",
      "label": "InfluxDB2",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.2"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "InfluxDB2",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "A Flux-based modification of the InfluxQL-based dashboard from https://grafana.com/grafana/dashboards/12625 - thank you, jenniferhatches.  Modifications pertain to layout (less emphasis on power consumption costs), colour thresholds for UPS Runtime, and the addition of power factor calculated based on maximum load/real power (watts) and maximum apparent power (volt-amps) supported by the UPS, as well as correct representation of the calculated load and total UPS consumption as a function of load percentage. You will need to manually alter the load power figures for the \"maxwatt\" variable, in accordance with APC's official specifications for your UPS unit(s). \"maxvoltamp\" variable will continue to automatically extract its value from the model name, as per the previous author's design.\n\nNotes for Revision 2: Completely revamped the calculation for kWh graphs, which were so far away from accuracy I'm embarrassed I overlooked them when interpreting the code from InfluxQL to Flux. Correctly using integral function for gathering kWh consumption in both 24hr and 1M periods.",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "gnetId": 15010,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "BOOST ONLINE": {
                  "color": "light-yellow",
                  "index": 2,
                  "text": "BOOST"
                },
                "COMMLOST": {
                  "color": "light-purple",
                  "index": 4,
                  "text": "NO COMMS"
                },
                "ONBATT": {
                  "color": "semi-dark-red",
                  "index": 3,
                  "text": "ON BATTERY"
                },
                "ONLINE": {
                  "color": "semi-dark-green",
                  "index": 1,
                  "text": "ONLINE"
                },
                "ONLINE LOWBATT": {
                  "color": "semi-dark-red",
                  "index": 5,
                  "text": "ONLINE (Check batteries)"
                }
              },
              "type": "value"
            },
            {
              "options": {
                "match": "null",
                "result": {
                  "index": 0,
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              }
            ]
          },
          "unit": "string"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "_value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 0,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 42,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/.*/",
          "values": true
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Volts",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> keep(columns: [\"status\"])\r\n  |> group()\r\n  |> distinct(column: \"status\")\r\n  |> last()\r\n  ",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_voltage"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "now-1m",
      "title": "Status",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-green",
                "value": null
              },
              {
                "color": "light-yellow",
                "value": 25
              },
              {
                "color": "semi-dark-orange",
                "value": 50
              },
              {
                "color": "dark-red",
                "value": 75
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 5,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 55,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true,
        "text": {}
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Percent",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"load_percent\")\r\n  |> group()\r\n  |> yield(name: \"last\")\r\n",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_charge_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "slimit": "",
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "1h",
      "title": "Load Power",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " "
            }
          }
        }
      ],
      "type": "gauge"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#d44a3a",
                "value": null
              },
              {
                "color": "rgba(237, 129, 40, 0.89)",
                "value": 20
              },
              {
                "color": "#299c46",
                "value": 50
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 9,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 4,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true,
        "text": {}
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Percent",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"battery_charge_percent\")\r\n  |> group()\r\n  |> yield(name: \"last\")\r\n",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_charge_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "slimit": "",
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "1h",
      "title": "Battery Charge",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " "
            }
          }
        }
      ],
      "type": "gauge"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#d44a3a",
                "value": null
              },
              {
                "color": "rgba(237, 129, 40, 0.89)",
                "value": 2700000000000
              },
              {
                "color": "#299c46",
                "value": 3600000000000
              }
            ]
          },
          "unit": "ns"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "time_left_ns"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${__field.labels.ups_name}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 13,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 6,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "background",
        "fieldOptions": {
          "calcs": [
            "mean"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"time_left_ns\")\r\n  |> last()\r\n  |> yield(name: \"last\")\r\n",
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "time_left_ns"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "1m",
      "title": "Runtime Remaining",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " "
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "0": {
                  "index": 1,
                  "text": "Not on battery"
                }
              },
              "type": "value"
            },
            {
              "options": {
                "match": "null",
                "result": {
                  "index": 0,
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-blue",
                "value": null
              },
              {
                "color": "rgba(237, 129, 40, 0.89)",
                "value": 2700000000000
              },
              {
                "color": "semi-dark-red",
                "value": 3600000000000
              }
            ]
          },
          "unit": "ns"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "time_left_ns"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${__field.labels.ups_name}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 17,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 56,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "background",
        "fieldOptions": {
          "calcs": [
            "mean"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"time_on_battery_ns\")\r\n  |> last()\r\n  |> yield(name: \"last\")\r\n",
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "time_left_ns"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "1m",
      "title": "Time on Battery",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " "
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "yellow",
                "value": 12
              },
              {
                "color": "green",
                "value": 13
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 21,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 54,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Volts",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"battery_voltage\")\r\n  |> last()\r\n  |> yield(name: \"last\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_voltage"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "now-1m",
      "title": "Battery Voltage",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " ",
              "battery_voltage {host=\"ubuntu-magnum-20\", model=\"Smart-UPS 1000 XL\", serial=\"AS0539232598\", status=\"ONLINE\", ups_name=\"UPSTower\"}": " ",
              "battery_voltage {host=\"ubuntu-magnum-20\", model=\"Smart-UPS 1500 RM\", serial=\"AS0633131078\", status=\"ONLINE\", ups_name=\"UPS Rack\"}": " "
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": "InfluxDB2",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 375
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "_value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          },
          {
            "matcher": {
              "id": "byFrameRefID",
              "options": "Real"
            },
            "properties": [
              {
                "id": "unit",
                "value": "watt"
              },
              {
                "id": "displayName",
                "value": "Real"
              }
            ]
          },
          {
            "matcher": {
              "id": "byFrameRefID",
              "options": "Apparent"
            },
            "properties": [
              {
                "id": "unit",
                "value": "voltamp"
              },
              {
                "id": "displayName",
                "value": "Apparent"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 21,
        "y": 3
      },
      "hideTimeOverride": true,
      "id": 10,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {
          "valueSize": 32
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Watts",
          "datasource": "InfluxDB2",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\" and r._field == \"load_percent\")\r\n  |> keep(columns: [\"_time\",\"_value\"])\r\n  |> map(fn: (r) => ({ r with _value: (r._value / 100.0) * float(v: ${maxwatt})}))\r\n  |> yield(name: \"last\")\r\n",
          "rawQuery": false,
          "refId": "Real",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "load_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              },
              {
                "params": [
                  " / 100*$maxwatt"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        },
        {
          "datasource": "InfluxDB2",
          "hide": false,
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\" and r._field == \"load_percent\")\r\n  |> keep(columns: [\"_time\",\"_value\"])\r\n  |> map(fn: (r) => ({ r with _value: (r._value / 100.0) * float(v: ${maxvoltamp})}))\r\n  |> keep(columns: [\"_value\"])\r\n  |> yield(name: \"last\")\r\n",
          "refId": "Apparent"
        }
      ],
      "timeFrom": "now-1m",
      "title": "Current UPS Load",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " ",
              "load_percent {host=\"ubuntu-magnum-20\", model=\"Smart-UPS 1000 XL\", serial=\"AS0539232598\", status=\"ONLINE\", ups_name=\"UPSTower\"}": " ",
              "load_percent {host=\"ubuntu-magnum-20\", model=\"Smart-UPS 1500 RM\", serial=\"AS0633131078\", status=\"ONLINE\", ups_name=\"UPS Rack\"}": " "
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 40,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "ns"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "APC.mean"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "rgb(0, 218, 255)",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "UPS Load"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#70dbed",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Minutes"
            },
            "properties": [
              {
                "id": "unit",
                "value": "watt"
              },
              {
                "id": "custom.axisPlacement",
                "value": "hidden"
              },
              {
                "id": "custom.axisLabel",
                "value": "Watts"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 11,
        "x": 0,
        "y": 6
      },
      "hideTimeOverride": false,
      "id": 49,
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.3",
      "targets": [
        {
          "alias": "Runtime Remaining",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"time_left_ns\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"battery_charge_percent\",\"upsname\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "time_left_ns"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "title": "Runtime Remaining",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds",
            "seriesBy": "last"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 40,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 200
              },
              {
                "color": "green",
                "value": 220
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 10,
        "x": 11,
        "y": 6
      },
      "id": 50,
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.3",
      "targets": [
        {
          "alias": "Battery Charge",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"input_voltage\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"input_voltage\",\"upsname\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_charge_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "title": "Input Voltage",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "yellow",
                "value": 12
              },
              {
                "color": "green",
                "value": 13
              }
            ]
          },
          "unit": "hertz"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "input_frequency"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${__field.labels.ups_name}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 21,
        "y": 6
      },
      "hideTimeOverride": true,
      "id": 44,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Hz",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"input_frequency\")\r\n  |> last()\r\n  |> yield(name: \"last\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "input_frequency"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "now-1m",
      "title": "Input Frequency",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " "
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "yellow",
                "value": 200
              },
              {
                "color": "green",
                "value": 220
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "input_voltage"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${__field.labels.ups_name}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 21,
        "y": 9
      },
      "hideTimeOverride": true,
      "id": 43,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Volts",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"input_voltage\")\r\n  |> last()\r\n  |> yield(name: \"last\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "input_voltage"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "now-1m",
      "title": "Input Voltage",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 40,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "max": 100,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "APC.mean"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "rgb(0, 218, 255)",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "UPS Load"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#70dbed",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Watts"
            },
            "properties": [
              {
                "id": "unit",
                "value": "watt"
              },
              {
                "id": "custom.axisPlacement",
                "value": "hidden"
              },
              {
                "id": "custom.axisLabel",
                "value": "Watts"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 11,
        "x": 0,
        "y": 13
      },
      "id": 48,
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.3",
      "targets": [
        {
          "alias": "Battery Charge",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"battery_charge_percent\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"battery_charge_percent\",\"upsname\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_charge_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "title": "Battery Charge %",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": "InfluxDB2",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 40,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "APC.mean"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "rgb(0, 218, 255)",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "UPS Load"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#70dbed",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Watts"
            },
            "properties": [
              {
                "id": "unit",
                "value": "watt"
              },
              {
                "id": "custom.axisPlacement",
                "value": "hidden"
              },
              {
                "id": "custom.axisLabel",
                "value": "Watts"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 10,
        "x": 11,
        "y": 13
      },
      "id": 2,
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.3",
      "targets": [
        {
          "alias": "UPS Load",
          "datasource": "InfluxDB2",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"load_percent\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"battery_charge_percent\",\"upsname\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "load_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "title": "UPS Load %",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "yellow",
                "value": 200
              },
              {
                "color": "green",
                "value": 220
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "output_voltage"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${__field.labels.ups_name}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 21,
        "y": 13
      },
      "hideTimeOverride": true,
      "id": 45,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Volts",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"output_voltage\")\r\n  |> last()\r\n  |> yield(name: \"last\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "output_voltage"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "now-1m",
      "title": "Output Voltage",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " "
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 35
              },
              {
                "color": "semi-dark-red",
                "value": 45
              }
            ]
          },
          "unit": "celsius"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "internal_temp"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${__field.labels.ups_name}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 21,
        "y": 17
      },
      "hideTimeOverride": true,
      "id": 46,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "C",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"internal_temp\")\r\n  |> last()\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "internal_temp"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "now-1m",
      "title": "Internal Temp",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " "
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 40,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              },
              {
                "color": "red",
                "value": 22
              },
              {
                "color": "#EAB839",
                "value": 23
              },
              {
                "color": "light-green",
                "value": 24
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 11,
        "x": 0,
        "y": 20
      },
      "id": 52,
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.3",
      "targets": [
        {
          "alias": "Battery Charge",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"battery_voltage\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"battery_voltage\",\"upsname\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_charge_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "title": "Battery Voltage",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 40,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "max": 60,
          "min": 40,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              },
              {
                "color": "red",
                "value": 190
              },
              {
                "color": "#EAB839",
                "value": 219
              },
              {
                "color": "light-green",
                "value": 220
              }
            ]
          },
          "unit": "hertz"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 10,
        "x": 11,
        "y": 20
      },
      "id": 57,
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.3",
      "targets": [
        {
          "alias": "Battery Charge",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"input_frequency\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"input_frequency\",\"upsname\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_charge_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "title": "Input Frequency",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "decimals": 2,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "kwatth"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 21,
        "y": 20
      },
      "hideTimeOverride": true,
      "id": 41,
      "interval": "1h",
      "links": [],
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "sum"
          ]
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\" and r._field == \"load_percent\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"load_percent\"])\r\n  |> map(fn: (r) => ({ r with _value: ((r._value / 100.0) * float(v: ${maxvoltamp}) / 1000.0)}))\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "load_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              },
              {
                "params": [
                  "/100*$maxwatt/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "1d",
      "title": "Past Day's Usage",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value": " "
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "decimals": 2,
          "displayName": "$currency",
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": ""
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 21,
        "y": 24
      },
      "hideTimeOverride": true,
      "id": 22,
      "interval": "1h",
      "links": [],
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "sum"
          ]
        },
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "alias": "Costs",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\" and r._field == \"load_percent\")\r\n  |> keep(columns: [\"_time\",\"_value\"])\r\n  |> map(fn: (r) => ({ r with _value: ((r._value / 100.0) * float(v: ${maxvoltamp}) / 1000.0) * ${kwhprice}}))\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "load_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              },
              {
                "params": [
                  "/100*$maxwatt/1000*$kwhprice"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "1d",
      "title": "Past Day's Cost",
      "type": "stat"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 40,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [
            {
              "options": {
                "0": {
                  "index": 0,
                  "text": "Not on battery"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              },
              {
                "color": "red",
                "value": 22
              },
              {
                "color": "#EAB839",
                "value": 23
              },
              {
                "color": "light-green",
                "value": 24
              }
            ]
          },
          "unit": "ns"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 11,
        "x": 0,
        "y": 27
      },
      "id": 53,
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.3",
      "targets": [
        {
          "alias": "Battery Charge",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"time_on_battery_ns\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"time_on_battery_ns\",\"upsname\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_charge_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "title": "Time on Battery",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 40,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red"
              },
              {
                "color": "#EAB839",
                "value": 200
              },
              {
                "color": "green",
                "value": 220
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 10,
        "x": 11,
        "y": 27
      },
      "id": 51,
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.3",
      "targets": [
        {
          "alias": "Battery Charge",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> filter(fn: (r) => r._field == \"output_voltage\")\r\n  |> keep(columns: [\"_time\",\"_value\",\"output_voltage\",\"upsname\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n  |> yield(name: \"mean\")\r\n",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "battery_charge_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "title": "Output Voltage",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 100,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "decimals": 1,
          "links": [],
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              }
            ]
          },
          "unit": "kwatth"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "semi-dark-yellow",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 11,
        "x": 0,
        "y": 34
      },
      "hideTimeOverride": false,
      "id": 34,
      "interval": "1M",
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "lastNotNull",
            "max",
            "sum"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.2",
      "targets": [
        {
          "alias": "kWh",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\" and r._field == \"load_percent\")\r\n  |> aggregateWindow(\r\n    every: 1h,\r\n    fn: (tables=<-, column) =>\r\n        tables\r\n            |> integral(unit: 1h)\r\n            |> map(fn: (r) => ({ r with _value: ((r._value / 100.0) * float(v: ${maxvoltamp}) / 1000.0)})))\r\n  |> keep(columns: [\"_time\",\"_value\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: sum, createEmpty: false)",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "load_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              },
              {
                "params": [
                  "/100*$maxwatt/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "1y",
      "title": "Power Consumption",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "$upsdatasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "left",
            "barAlignment": 1,
            "drawStyle": "bars",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 5,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "decimals": 1,
          "links": [],
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              }
            ]
          },
          "unit": "kwatth"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "${upsname}"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "semi-dark-yellow",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 10,
        "x": 11,
        "y": 34
      },
      "hideTimeOverride": false,
      "id": 33,
      "interval": "1d",
      "links": [],
      "options": {
        "legend": {
          "calcs": [
            "min",
            "mean",
            "max"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.1.2",
      "targets": [
        {
          "alias": "kWh",
          "datasource": {
            "uid": "$upsdatasource"
          },
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "apcupsd",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\" and r._field == \"load_percent\")\r\n  |> aggregateWindow(\r\n    every: 1h,\r\n    fn: (tables=<-, column) =>\r\n        tables\r\n            |> integral(unit: 1h)\r\n            |> map(fn: (r) => ({ r with _value: ((r._value / 100.0) * float(v: ${maxvoltamp}) / 1000.0)})))\r\n  |> keep(columns: [\"_time\",\"_value\"])\r\n  |> aggregateWindow(every: v.windowPeriod, fn: sum, createEmpty: false)\r\n//  |> keep(columns: [\"_time\",\"_value\",\"upsname\"])\r\n//  |> map(fn: (r) => ({ r with _value: ((r._value / 100.0) * float(v: ${maxvoltamp}) / 1000.0 * 24.0)}))\r\n//  |> keep(columns: [\"_time\",\"_value\"])\r\n//  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n//  |> yield(name: \"mean\")\r\n",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "load_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              },
              {
                "params": [
                  "/100*$maxwatt/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "ups_name",
              "operator": "=~",
              "value": "/^$upsname$/"
            }
          ]
        }
      ],
      "timeFrom": "1M",
      "title": "Power Consumption",
      "transformations": [],
      "type": "timeseries"
    }
  ],
  "refresh": "30s",
  "schemaVersion": 37,
  "style": "dark",
  "tags": [
    "apcupsd"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "InfluxDB2",
          "value": "InfluxDB2"
        },
        "hide": 0,
        "includeAll": false,
        "label": "UPS Datasource",
        "multi": false,
        "name": "upsdatasource",
        "options": [],
        "query": "influxdb",
        "queryValue": "",
        "refresh": 1,
        "regex": "/^InfluxDB2/",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {},
        "datasource": "InfluxDB2",
        "definition": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\")\r\n  |> keep(columns: [\"ups_name\"])\r\n  |> group()\r\n  |> distinct(column: \"ups_name\")\r\n\r\n  ",
        "hide": 0,
        "includeAll": false,
        "label": "UPS Name",
        "multi": false,
        "name": "upsname",
        "options": [],
        "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\")\r\n  |> keep(columns: [\"ups_name\"])\r\n  |> group()\r\n  |> distinct(column: \"ups_name\")\r\n\r\n  ",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "datasource": "InfluxDB2",
        "definition": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> keep(columns: [\"model\"])\r\n  |> group()\r\n  |> distinct(column: \"model\")\r\n\r\n",
        "hide": 0,
        "includeAll": false,
        "label": "UPS Max Output Power Capacity (VA)",
        "multi": false,
        "name": "maxvoltamp",
        "options": [],
        "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> keep(columns: [\"model\"])\r\n  |> group()\r\n  |> distinct(column: \"model\")\r\n\r\n",
        "refresh": 1,
        "regex": "/.*(\\d{4,4})/",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {},
        "datasource": "InfluxDB2",
        "definition": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\" and r._field == \"nominal_power\")\r\n  |> keep(columns: [\"_time\",\"ups_name\"])\r\n  |> map(fn: (r) => ({ r with _value: if \"${upsname}\" == \"UPSTower\" then 800 else 980}))\r\n  |> yield(name: \"last\")\r\n",
        "hide": 0,
        "includeAll": false,
        "label": "UPS Max Output Power Capacity (W)",
        "multi": false,
        "name": "maxwatt",
        "options": [],
        "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\" and r._field == \"nominal_power\")\r\n  |> keep(columns: [\"_time\",\"ups_name\"])\r\n  |> map(fn: (r) => ({ r with _value: if \"${upsname}\" == \"UPSTower\" then 800 else 980}))\r\n  |> yield(name: \"last\")\r\n",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "datasource": "InfluxDB2",
        "definition": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> keep(columns: [\"_time\",\"ups_name\"])\r\n  |> map(fn: (r) => ({ r with _value: if \"${upsname}\" == \"UPSTower\" then float(v: ${maxwatt})/float(v: ${maxvoltamp}) else float(v: ${maxwatt})/float(v: ${maxvoltamp})}))\r\n  |> yield(name: \"last\")\r\n",
        "hide": 0,
        "includeAll": false,
        "label": "Power Factor",
        "multi": false,
        "name": "powerfactor",
        "options": [],
        "query": "from(bucket: \"telegraf\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r._measurement == \"apcupsd\" and r.ups_name == \"${upsname}\")\r\n  |> keep(columns: [\"_time\",\"ups_name\"])\r\n  |> map(fn: (r) => ({ r with _value: if \"${upsname}\" == \"UPSTower\" then float(v: ${maxwatt})/float(v: ${maxvoltamp}) else float(v: ${maxwatt})/float(v: ${maxvoltamp})}))\r\n  |> yield(name: \"last\")\r\n",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": ".15",
          "value": ".15"
        },
        "hide": 0,
        "label": "kWh Price",
        "name": "kwhprice",
        "options": [
          {
            "selected": true,
            "text": ".15",
            "value": ".15"
          }
        ],
        "query": ".15",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "current": {
          "selected": false,
          "text": "$",
          "value": "$"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Currency",
        "multi": false,
        "name": "currency",
        "options": [
          {
            "selected": true,
            "text": "$",
            "value": "$"
          },
          {
            "selected": false,
            "text": "€",
            "value": "€"
          },
          {
            "selected": false,
            "text": "£",
            "value": "£"
          },
          {
            "selected": false,
            "text": "C$",
            "value": "C$"
          },
          {
            "selected": false,
            "text": "kr",
            "value": "kr"
          },
          {
            "selected": false,
            "text": "₽",
            "value": "₽"
          },
          {
            "selected": false,
            "text": "¥",
            "value": "¥"
          },
          {
            "selected": false,
            "text": "R",
            "value": "R"
          }
        ],
        "query": "$,€,£,C$,kr,₽,¥,R",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-3h",
    "to": "now"
  },
  "timepicker": {
    "hidden": false,
    "refresh_intervals": [
      "30s",
      "1m",
      "15m",
      "30m",
      "1h"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "APC UPS Detailed Summary",
  "uid": "RwSBnsS7z",
  "version": 5,
  "weekStart": ""
}