This guide won’t go into detail on how every setting in Grafana works, mainly because I don’t really know 🙂 This will mostly be about adding UPS stats to Grafana and calculating the cost of running your server 24/7.

Installation

Install the containers and follow the instructions.

InfluxDB

Note: A database called telegraf is created when you start the container for the first time. I will be using that for this guide.

EDIT: 
I recommend not using the telegraf database and creating a new database purely for UPS data. Read more here

You can check existing databases with SSH.

docker exec -it Influxdb bash
influx -execute 'SHOW DATABASES'

> SHOW DATABASES
name: databases
name
----
_internal
telegraf

Telegraf

Note: You don’t really need Telegraf for this guide as the script writes directly to the InfluxDB telegraf database, but if this is the first time you’re setting everything up you might as well install and configure Telegraf.

Edit telegraf.conf and add the influxdb ip. It’s on line 92 and 93 in the telegraf.conf file.

urls = ["http://192.168.1.34:8086"] # required
 ## The target database for metrics (telegraf will create it if not exists).
 database = "telegraf" # required

User Scripts

To be able to have Grafana read the UPS metrics we need to send them to the telegraf database in InfluxDB.
I’m doing that using this awesome script by Viaduct on the Unraid forums.

https://lime-technology.com/forums/topic/50495-scripts-for-server-monitoring-using-influx-db-and-grafana-without-telegraf-agent/?tab=comments#comment-496966

#!/usr/bin/php
<?php

$command = "apcaccess";
$args = "status";
$tagsArray = array(
"LOADPCT", 
"ITEMP", 
"TIMELEFT", 
"TONBATT", 
"BCHARGE"
);

//do system call

$call = $command." ".$args;
$output = shell_exec($call);

//parse output for tag and value

foreach ($tagsArray as $tag) {

preg_match("/".$tag."\s*:\s([\d|\.]+)/si", $output, $match);

//send measurement, tag and value to influx

sendDB($match[1], $tag);

}
//end system call


//send to influxdb

function sendDB($val, $tagname) {

$curl = "curl -i -XPOST 'http://influxDBIP:8086/write?db=telegraf' --data-binary 'APC,host=Tower,region=us-west "
.$tagname."=".$val."'";
$execsr = exec($curl);

}

?>

By using the User Scripts plugin you can easily set up a cronjob every minute.
Click on Add New Script → Enter the name → Click on the name of the script and then Edit Script

Copy the script and add your ip address to InfluxDB, which database to write to, name of the data table, host name and region.

$curl = "curl -i -XPOST 'http://192.168.1.34:8086/write?db=telegraf' --data-binary 'APC,host=Nostromo,region=eu-west-3 "

http://192.168.1.34:8086: is the IP to InfluxDB
db=telegraf: is the name of the database in InfluxDB.
APC: is the name of the data table
host: is the name of your host. In my case Nostromo.
region: is the region you live in.
Click Save Changes when you’re done.

 

Set the schedule to custom and add * * * * * for it to run every minute.

Click Run In Background and then Apply

The downside of using crontab is that it’s limited to only run every 1 minute. If you know of a smarter solution that will run the script more often please tell me in the comments!

Grafana

Go to “Configuration” and click + Add data source.
Set it to type InfluxDB
Add your URL to InfluxDB
And add the database telegraf
Click Save & Test

Create a new dashboard and add your panels.

This is how I have setup my dashboard. Here you can copy the Panel JSON and edit it to your host name.

https://grafana.technicalramblings.com/d/QTY-HKGiz/ups?refresh=5s&orgId=1

Tip! Copy the JSON code from each panel in the link above!

Final Notes

The reason yearly and or monthly/weekly (depending on when you read this) costs are the same is it hasn’t been a week/month/year yet after I set this up. These numbers will grow and stop depending on the time frame of the stats.

To be able to get the Last Month Power Consumptions/Cost panel to display correctly I have set the dashboard to previous month. And added a custom time range to the other panels.

math

For it to show correct Wattage for your UPS you need to edit the math part.
For example on the Current UPS Load panel.

SELECT sum("LOADPCT") /100*865 FROM "APC" WHERE ("host" = 'Nostromo') AND $timeFilter GROUP BY time(1m) fill(null)

The number 865 is my UPS max capacity of watt output.  So to calculate the watt load you take the load percentage and divide it with 100(%) and multiply it with the max output (865W)

If you want to show kWh load you divide that by 1000

Total X Cost panel

When it comes to cost you need to multiply the kWh with hour and cost per kWh.

Note: For some reason if I didn’t divide that by 1000 it would show the cost  in the thousands, for example: kr1.28K and not kr1.28

SELECT sum("LOADPCT") /100*865/1000*24*0.65/1000 FROM "APC" WHERE ("host" = 'Nostromo') AND $timeFilter GROUP BY time(1d) fill(none)

24 is the number of hours. 0.65 is the cost of 1 kWh in kr. Change 0.65 to your cost per kWh
And remember to change the currency!

If you have any comments on how I can do this smarter/better please do share!
Here is the complete JSON if my grafana site is down.  

{
  "annotations": {
    "list": [
      {
        "$$hashKey": "object:325",
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "https://technicalramblings.com/blog/setting-grafana-influxdb-telegraf-ups-monitoring-unraid/",
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": 6,
  "links": [
    {
      "icon": "external link",
      "tags": [],
      "title": "Setting up Grafana and InfluxDB for UPS monitoring on unRAID",
      "type": "link",
      "url": "https://technicalramblings.com/blog/setting-grafana-influxdb-telegraf-ups-monitoring-unraid/"
    }
  ],
  "panels": [
    {
      "aliasColors": {
        "APC.mean": "rgb(0, 218, 255)",
        "UPS Load": "#70dbed"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": null,
      "decimals": null,
      "fill": 4,
      "gridPos": {
        "h": 6,
        "w": 11,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "legend": {
        "alignAsTable": false,
        "avg": true,
        "current": false,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": true,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "connected",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": null,
      "seriesOverrides": [
        {
          "alias": "Watts",
          "yaxis": 2
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "UPS Load",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "linear"
              ],
              "type": "fill"
            }
          ],
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        },
        {
          "alias": "Watts",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  " / 100*865"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "UPS Load %",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transparent": false,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "percent",
          "label": "Percent",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "watt",
          "label": "Watts",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#d44a3a",
        "rgba(237, 129, 40, 0.89)",
        "#299c46"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": null,
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": true,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 11,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 4,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "repeat": null,
      "sparkline": {
        "fillColor": "rgba(5, 43, 81, 0.2)",
        "full": true,
        "lineColor": "rgb(31, 120, 193)",
        "show": true
      },
      "tableColumn": "mean",
      "targets": [
        {
          "alias": "Percent",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "BCHARGE"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "slimit": "",
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            },
            {
              "condition": "AND",
              "key": "region",
              "operator": "=",
              "value": "eu-west-3"
            }
          ]
        }
      ],
      "thresholds": "20,50,",
      "timeFrom": "30m",
      "title": "UPS Battery Charge",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#d44a3a",
        "rgba(237, 129, 40, 0.89)",
        "#299c46"
      ],
      "datasource": null,
      "format": "m",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 5,
        "x": 15,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 6,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "utes left!",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "mean",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "TIMELEFT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            },
            {
              "condition": "AND",
              "key": "region",
              "operator": "=",
              "value": "eu-west-3"
            }
          ]
        }
      ],
      "thresholds": "10,30,60",
      "timeFrom": "1m",
      "title": "UPS Runtime",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "description": "",
      "format": "watth",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 20,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 14,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "1d"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": "now/d",
      "title": "Total Daily Usage kWh",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "description": "",
      "format": "watt",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 5,
        "x": 15,
        "y": 2
      },
      "id": 10,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "1m"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "title": "Current UPS Load",
      "type": "singlestat",
      "valueFontSize": "110%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": true,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "description": "",
      "format": "currencyNOK",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 20,
        "y": 2
      },
      "hideTimeOverride": true,
      "id": 22,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "100%",
      "prefix": "",
      "prefixFontSize": "100%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": true,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "alias": "Costs",
          "groupBy": [
            {
              "params": [
                "1d"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": "now/d",
      "title": "Total Daily Cost NOK",
      "type": "singlestat",
      "valueFontSize": "100%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": null,
      "description": "",
      "format": "kwatth",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 5,
        "x": 15,
        "y": 4
      },
      "id": 12,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "1m"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "title": "Current Load kWh",
      "type": "singlestat",
      "valueFontSize": "110%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "description": "",
      "format": "watth",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 20,
        "y": 4
      },
      "hideTimeOverride": true,
      "id": 16,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": "now/w",
      "timeShift": null,
      "title": "This Weeks Usage kWh",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "aliasColors": {
        "Costs": "#7eb26d",
        "kWh": "#eab839"
      },
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {},
      "gridPos": {
        "h": 6,
        "w": 11,
        "x": 0,
        "y": 6
      },
      "hideTimeOverride": false,
      "id": 33,
      "interval": "1d",
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": true,
        "values": true
      },
      "lines": false,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "Costs",
          "yaxis": 2
        }
      ],
      "spaceLength": 10,
      "span": 12,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Costs",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") *0.22/1000 FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        },
        {
          "alias": "kWh",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": "now/M",
      "timeShift": null,
      "title": "This Month Consumption/Costs",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "transparent": false,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "watth",
          "label": "Load",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "decimals": 2,
          "format": "currencyNOK",
          "label": "Cost",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "Costs": "#7eb26d",
        "kWh": "#eab839"
      },
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {},
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 11,
        "y": 6
      },
      "hideTimeOverride": false,
      "id": 32,
      "interval": "1d",
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": true,
        "values": true
      },
      "lines": false,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "Costs",
          "yaxis": 2
        }
      ],
      "spaceLength": 10,
      "span": 12,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Costs",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") *0.22/1000 FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        },
        {
          "alias": "kWh",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": "now/w",
      "timeShift": null,
      "title": "This Week Consumption/Costs",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "transparent": false,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 2,
          "format": "watth",
          "label": "Load",
          "logBase": 2,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "decimals": 2,
          "format": "currencyNOK",
          "label": "Cost",
          "logBase": 2,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": true,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "description": "",
      "format": "currencyNOK",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 20,
        "y": 6
      },
      "hideTimeOverride": true,
      "id": 24,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "100%",
      "prefix": "",
      "prefixFontSize": "100%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": "now/w",
      "timeShift": null,
      "title": "This Weeks Cost NOK",
      "type": "singlestat",
      "valueFontSize": "100%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "description": "",
      "format": "watth",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 20,
        "y": 8
      },
      "hideTimeOverride": true,
      "id": 18,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "alias": "kWh",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": "now/M",
      "title": "This Months Usage kWh",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": true,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "description": "",
      "format": "currencyNOK",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 20,
        "y": 10
      },
      "hideTimeOverride": true,
      "id": 26,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "100%",
      "prefix": "",
      "prefixFontSize": "100%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": "now/M",
      "title": "This Months Cost NOK",
      "type": "singlestat",
      "valueFontSize": "100%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "aliasColors": {
        "Costs": "#7eb26d",
        "kWh": "#eab839"
      },
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {},
      "gridPos": {
        "h": 6,
        "w": 11,
        "x": 0,
        "y": 12
      },
      "hideTimeOverride": false,
      "id": 30,
      "interval": "1d",
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": true,
        "values": true
      },
      "lines": false,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "Costs",
          "yaxis": 2
        }
      ],
      "spaceLength": 10,
      "span": 12,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Costs",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") *0.22/1000 FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        },
        {
          "alias": "kWh",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": "31d",
      "timeShift": null,
      "title": "Last 30 Day Power Consumption/Costs",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "watth",
          "label": "Load",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "decimals": 2,
          "format": "currencyNOK",
          "label": "Cost",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {},
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 11,
        "y": 12
      },
      "hideTimeOverride": false,
      "id": 31,
      "interval": "1d",
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": true,
        "values": true
      },
      "lines": false,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "Costs",
          "yaxis": 2
        }
      ],
      "spaceLength": 10,
      "span": 12,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Costs",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") *0.22/1000 FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        },
        {
          "alias": "kWh",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": "7d",
      "timeShift": null,
      "title": "Last 7 Day Power Consumption/Costs",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "transparent": false,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "watth",
          "label": "Load",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "decimals": 2,
          "format": "currencyNOK",
          "label": "Cost",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "description": "",
      "format": "watth",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 20,
        "y": 12
      },
      "hideTimeOverride": true,
      "id": 20,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "alias": "kWh",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": "now/y",
      "title": "This Years Usage kWh",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#d44a3a",
        "rgba(237, 129, 40, 0.89)",
        "#299c46"
      ],
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "description": "",
      "format": "currencyNOK",
      "gauge": {
        "maxValue": 150,
        "minValue": null,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 20,
        "y": 15
      },
      "hideTimeOverride": true,
      "id": 28,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "100%",
      "prefix": "",
      "prefixFontSize": "100%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "sum",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"LOADPCT\") / 100 * 865 FROM \"APC\" WHERE \"LOADPCT\" = 'loadpercent' AND $timeFilter GROUP BY time(30s) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": "now/y",
      "title": "This Years  Cost NOK",
      "type": "singlestat",
      "valueFontSize": "100%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Influxdb Docker Container",
      "decimals": 2,
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {},
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 18
      },
      "hideTimeOverride": false,
      "id": 34,
      "interval": "1d",
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": true,
        "values": true
      },
      "lines": false,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "Costs",
          "yaxis": 2
        }
      ],
      "spaceLength": 10,
      "span": 12,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Costs",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") *0.22/1000 FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24*0.65/1000"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        },
        {
          "alias": "kWh",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "APC",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"value\") FROM \"power\" WHERE \"host\" = 'mainpower' AND $timeFilter GROUP BY time(1d) fill(null)",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "LOADPCT"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "/100*865/1000*24"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "Nostromo"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": "now/y",
      "timeShift": null,
      "title": "This Years Consumption/Costs",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "transparent": false,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "watth",
          "label": "Load",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "decimals": 2,
          "format": "currencyNOK",
          "label": "Cost",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "5s",
  "schemaVersion": 16,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now/w",
    "to": "now/w"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "browser",
  "title": "UPS",
  "uid": "QTY-HKGiz",
  "version": 115
}

Sources:

https://lime-technology.com/forums/topic/50495-scripts-for-server-monitoring-using-influx-db-and-grafana-without-telegraf-agent/

https://www.reddit.com/r/homelab/comments/65yn4p/calculating_power_consumption_costs_in_grafana/

https://fablab.dyn.nerd2nerd.org/grafana/dashboard/db/fablab-power?refresh=1m&orgId=1

https://docs.influxdata.com/influxdb/v1.5/tools/shell/

https://www.reddit.com/r/unRAID/comments/7c2l2w/howto_monitor_unraid_with_grafana_influxdb_and/