Grafana dashboard: Unifi - Unifi Protect InfluxDB
Description: Grafana Dashboard for Unifi Protect - InfluxDB

Grafana Dashboard for Unifi Protect - Using API to InfluxDB Script
===================

![alt tag](https://www.jorgedelacruz.es/wp-content/uploads/2021/02/unifi-protect-001.png)

This project consists in a Bash Shell script to retrieve the Unifi Protect information, directly from the API, about cameras, firmware, versions, CPU and RAM from the Protect Host, and much more. The information is being saved it into InfluxDB output directly into the InfluxDB database using curl, then in Grafana: a Dashboard is created to present all the information.

We use the Unifi Protect API to reduce the workload and increase the speed of script execution. 

----------

### Getting started
You can follow the steps on the next Blog Post - To be created

Or try with this simple steps:
* Download the unifi-protect.sh file and change the parameters under Configuration, like username/password, etc. with your real data
* Make the script executable with the command chmod +x unifi-protect.sh
* Run the unifi-protect.sh and check on Chronograf/Grafana that you can retrieve the information properly
* Schedule the script execution, for example every 1 minute using crontab
* Download the Grafana Dashboard for Unifi Protect JSON file and import it into your Grafana
* Enjoy :)

----------

### Additional Information
* Nothing to add as of today

### Known issues 
Would love to see some known issues and keep opening and closing as soon as I have feedback from you guys. Fork this project, use it and please provide feedback.


{
  "__inputs": [
    {
      "name": "DS_INFLUXDB",
      "label": "InfluxDB",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.3.5"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Grafana Dashboard for Unifi Protect - InfluxDB",
  "editable": true,
  "gnetId": 13835,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1612483390795,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_INFLUXDB}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 1,
        "x": 0,
        "y": 0
      },
      "id": 28,
      "options": {
        "content": "<img src=\"https://www.jorgedelacruz.es/wp-content/uploads/2021/02/unifiprotect.png\">\n\n",
        "mode": "html"
      },
      "pluginVersion": "7.3.5",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "transparent": true,
      "type": "text"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_INFLUXDB}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [
            {
              "$$hashKey": "object:901",
              "id": 0,
              "op": "=",
              "text": "N/A",
              "type": 1,
              "value": "null"
            }
          ],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-blue",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 23,
        "x": 1,
        "y": 0
      },
      "id": 21,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "name"
      },
      "pluginVersion": "7.3.5",
      "targets": [
        {
          "alias": "Name: $tag_protectname",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "protectname"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "temperature"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        },
        {
          "alias": "IP: $tag_protecthost",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "protecthost"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "temperature"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        },
        {
          "alias": "Mac: $tag_protectmac",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "protectmac"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "temperature"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        },
        {
          "alias": "Firmware: $tag_protectfirmware",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "protectfirmware"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "D",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "temperature"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        },
        {
          "alias": "Protect version: $tag_protectversion",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "protectversion"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "E",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "temperature"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        },
        {
          "alias": "Disk: $tag_storage_model/$tag_storage_type",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "storage_model"
              ],
              "type": "tag"
            },
            {
              "params": [
                "storage_type"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "F",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "temperature"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "type": "stat"
    },
    {
      "datasource": "${DS_INFLUXDB}",
      "description": "On this Panel, you can quickly know how much CPU your device is consuming.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-green",
                "value": null
              },
              {
                "color": "dark-orange",
                "value": 60
              },
              {
                "color": "dark-red",
                "value": 85
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "RAM Consumed"
            },
            "properties": [
              {
                "id": "displayName"
              },
              {
                "id": "unit",
                "value": "percent"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 2
      },
      "hideTimeOverride": false,
      "id": 41,
      "interval": "",
      "links": [],
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.5",
      "targets": [
        {
          "alias": "% CPU Consumption",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "cpuavg"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Current CPU Usage",
      "type": "stat"
    },
    {
      "aliasColors": {
        "% CPU Consumption": "dark-orange",
        "% RAM Consumption": "dark-purple",
        "RAM Consumed": "dark-purple",
        "unifi_protect_overview.last": "dark-green"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB}",
      "description": "On this Panel, you can quickly know how much CPU your device is consuming.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": [],
          "unit": "percent"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "RAM Consumed"
            },
            "properties": [
              {
                "id": "displayName"
              },
              {
                "id": "unit",
                "value": "percent"
              }
            ]
          }
        ]
      },
      "fill": 6,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 7,
        "x": 3,
        "y": 2
      },
      "hiddenSeries": false,
      "hideTimeOverride": false,
      "id": 19,
      "interval": "",
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "hideEmpty": true,
        "hideZero": true,
        "max": true,
        "min": true,
        "rightSide": false,
        "show": false,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.3.5",
      "pointradius": 1,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "% CPU Consumption",
          "groupBy": [
            {
              "params": [
                "$inter"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "cpuavg"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Historical CPU Consumption",
      "tooltip": {
        "shared": false,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:426",
          "decimals": 0,
          "format": "percent",
          "label": "% CPU Consumption",
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:427",
          "format": "percent",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "% CPU Consumption": "dark-orange",
        "% RAM Consumption": "dark-purple",
        "RAM Consumed": "dark-purple",
        "unifi_protect_overview.last": "dark-green"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB}",
      "description": "On this Panel, you can quickly know how much Ram your device has been using.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": [],
          "unit": "percent"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "RAM Consumed"
            },
            "properties": [
              {
                "id": "displayName"
              },
              {
                "id": "unit",
                "value": "percent"
              }
            ]
          }
        ]
      },
      "fill": 6,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 8,
        "x": 10,
        "y": 2
      },
      "hiddenSeries": false,
      "hideTimeOverride": false,
      "id": 39,
      "interval": "",
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "hideEmpty": true,
        "hideZero": true,
        "max": true,
        "min": true,
        "rightSide": false,
        "show": false,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.3.5",
      "pointradius": 1,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "% RAM Consumption",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT (last(\"mem_total\") - last(\"mem_available\")) * (100 / last(\"mem_total\")) FROM \"unifi_protect_overview\" WHERE (\"protectname\" =~ /^$NVRName$/) AND $timeFilter GROUP BY time($inter) fill(none)",
          "rawQuery": true,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "mem_free"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Historical RAM Consumption",
      "tooltip": {
        "shared": false,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:426",
          "decimals": 0,
          "format": "percent",
          "label": "% RAM Consumption",
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:427",
          "format": "percent",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "% CPU Consumption": "dark-orange",
        "% RAM Consumption": "dark-purple",
        "RAM Consumed": "dark-purple",
        "Temperature": "dark-green",
        "unifi_protect_overview.last": "dark-green"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB}",
      "description": "On this Panel, you can quickly know the temperature your device has been",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": [],
          "unit": "celsius"
        },
        "overrides": []
      },
      "fill": 6,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 18,
        "y": 2
      },
      "hiddenSeries": false,
      "hideTimeOverride": false,
      "id": 40,
      "interval": "",
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "hideEmpty": true,
        "hideZero": true,
        "max": true,
        "min": true,
        "rightSide": false,
        "show": false,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.3.5",
      "pointradius": 1,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Temperature",
          "groupBy": [
            {
              "params": [
                "$inter"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT (last(\"mem_total\") - last(\"mem_available\")) * (100 / last(\"mem_total\")) FROM \"unifi_protect_overview\" WHERE (\"protectname\" =~ /^$NVRName$/) AND $timeFilter GROUP BY time($__interval) fill(none)",
          "rawQuery": false,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "temperature"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        }
      ],
      "thresholds": [
        {
          "$$hashKey": "object:3519",
          "colorMode": "warning",
          "fill": true,
          "line": true,
          "op": "gt",
          "value": 60,
          "yaxis": "left"
        },
        {
          "$$hashKey": "object:3525",
          "colorMode": "critical",
          "fill": true,
          "line": true,
          "op": "gt",
          "value": 80,
          "yaxis": "left"
        }
      ],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Historical  Temperature",
      "tooltip": {
        "shared": false,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:426",
          "decimals": 0,
          "format": "celsius",
          "label": "Device Temperature in Celsius",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:427",
          "format": "percent",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "datasource": "${DS_INFLUXDB}",
      "description": "On this Panel, you can quickly know how much Ram your device has been using.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-green",
                "value": null
              },
              {
                "color": "dark-orange",
                "value": 60
              },
              {
                "color": "dark-red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 4
      },
      "hideTimeOverride": false,
      "id": 42,
      "interval": "",
      "links": [],
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.5",
      "targets": [
        {
          "alias": "% RAM Consumption",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT (last(\"mem_total\") - last(\"mem_available\")) * (100 / last(\"mem_total\")) FROM \"unifi_protect_overview\" WHERE (\"protectname\" =~ /^$NVRName$/) AND $timeFilter GROUP BY time($__interval) fill(none)",
          "rawQuery": true,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "mem_free"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Current RAM Usage",
      "type": "stat"
    },
    {
      "datasource": "${DS_INFLUXDB}",
      "description": "On this Panel, you can quickly know the temperature your device has been",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-blue",
                "value": null
              },
              {
                "color": "dark-orange",
                "value": 60
              },
              {
                "color": "dark-red",
                "value": 80
              }
            ]
          },
          "unit": "celsius"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 6
      },
      "hideTimeOverride": false,
      "id": 43,
      "interval": "",
      "links": [],
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.5",
      "targets": [
        {
          "alias": "Temperature",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "unifi_protect_overview",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT (last(\"mem_total\") - last(\"mem_available\")) * (100 / last(\"mem_total\")) FROM \"unifi_protect_overview\" WHERE (\"protectname\" =~ /^$NVRName$/) AND $timeFilter GROUP BY time($__interval) fill(none)",
          "rawQuery": false,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "temperature"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Current Temperature",
      "type": "stat"
    },
    {
      "collapsed": false,
      "datasource": "${DS_INFLUXDB}",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 8
      },
      "id": 36,
      "panels": [],
      "title": "Camera List ",
      "type": "row"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_INFLUXDB}",
      "description": "On this Panel, you can quickly list all your Unifi Cameras connected to $NVRName",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "rgb(67, 96, 176)",
            "mode": "fixed"
          },
          "custom": {
            "align": "center",
            "displayMode": "color-background",
            "filterable": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Status"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "🔴",
                    "to": "",
                    "type": 1,
                    "value": "1"
                  },
                  {
                    "from": "",
                    "id": 2,
                    "text": "🟢",
                    "to": "",
                    "type": 1,
                    "value": "2"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Last Seen"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeFromNow"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Link State"
            },
            "properties": [
              {
                "id": "unit",
                "value": "Mbits"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 9
      },
      "id": 34,
      "interval": "",
      "links": [],
      "options": {
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "7.3.5",
      "targets": [
        {
          "alias": "",
          "groupBy": [
            {
              "params": [
                "cameraType"
              ],
              "type": "tag"
            },
            {
              "params": [
                "cameraIP"
              ],
              "type": "tag"
            },
            {
              "params": [
                "cameraName"
              ],
              "type": "tag"
            },
            {
              "params": [
                "cameraMAC"
              ],
              "type": "tag"
            },
            {
              "params": [
                "camerafirmware"
              ],
              "type": "tag"
            },
            {
              "params": [
                "camerafwbuild"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "unifi_protect_cameras",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"VMSize\") AS \"VM  Size\" FROM \"veeam_azure_vm_unprotected\" WHERE (\"VMName\" =~ /^$VMName$/) AND $timeFilter GROUP BY \"VMName\", \"VMRegion\" ",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "camerastate"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "Status"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ],
          "tz": ""
        },
        {
          "alias": "",
          "groupBy": [
            {
              "params": [
                "cameraIP"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "unifi_protect_cameras",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"VMSize\") AS \"VM  Size\" FROM \"veeam_azure_vm_unprotected\" WHERE (\"VMName\" =~ /^$VMName$/) AND $timeFilter GROUP BY \"VMName\", \"VMRegion\" ",
          "rawQuery": false,
          "refId": "B",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "cameralastSeen"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "Last Seen"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ],
          "tz": ""
        },
        {
          "alias": "",
          "groupBy": [
            {
              "params": [
                "cameraIP"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "unifi_protect_cameras",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"VMSize\") AS \"VM  Size\" FROM \"veeam_azure_vm_unprotected\" WHERE (\"VMName\" =~ /^$VMName$/) AND $timeFilter GROUP BY \"VMName\", \"VMRegion\" ",
          "rawQuery": false,
          "refId": "C",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "cameraLAN"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  "Link State"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": [
            {
              "key": "protectname",
              "operator": "=~",
              "value": "/^$NVRName$/"
            }
          ],
          "tz": ""
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Unifi Protect Cameras",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "RDS  Size": true,
              "Time": true,
              "Unprotected": false,
              "cameraid": true,
              "vpcid": true
            },
            "indexByName": {
              "Status": 1,
              "Time": 0,
              "cameraIP": 4,
              "cameraMAC": 5,
              "cameraName": 2,
              "cameraType": 3,
              "camerafirmware": 6,
              "camerafwbuild": 7,
              "vpcid": 8
            },
            "renameByName": {
              "Last Seen": "",
              "RDS  Size": "",
              "Status": "Status",
              "Time": "",
              "cameraIP": "IP",
              "cameraMAC": "MAC Address",
              "cameraName": "Name",
              "cameraType": "Model",
              "camerafirmware": "Firmware",
              "camerafwbuild": "Firmware Build",
              "rdsclass": "Type",
              "rdsdns": "DNS",
              "rdsengine": "Engine",
              "rdsengineversion": "Engine Version",
              "rdsname": "Name",
              "rdsregion": "Region",
              "vpcid": "",
              "vpcregion": "Region"
            }
          }
        }
      ],
      "transparent": true,
      "type": "table"
    },
    {
      "datasource": "${DS_INFLUXDB}",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 5,
        "x": 19,
        "y": 15
      },
      "id": 10,
      "options": {
        "content": "<a href=\"https://www.jorgedelacruz.es\"><img src=\"https://www.jorgedelacruz.es/wp-content/uploads/2019/04/jorgedelacruz-banner_2efede4ef704c939e63a3763231f5961.png\"></a>\n\n\n\n",
        "mode": "html"
      },
      "pluginVersion": "7.3.5",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "transparent": true,
      "type": "text"
    }
  ],
  "refresh": false,
  "schemaVersion": 26,
  "style": "dark",
  "tags": [
    "unifi",
    "unifi protect",
    "protect"
  ],
  "templating": {
    "list": [
      {
        "auto": true,
        "auto_count": "100",
        "auto_min": "30s",
        "current": {
          "selected": false,
          "text": "auto",
          "value": "$__auto_interval_inter"
        },
        "error": null,
        "hide": 0,
        "label": "Sampling",
        "name": "inter",
        "options": [
          {
            "selected": true,
            "text": "auto",
            "value": "$__auto_interval_inter"
          },
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          },
          {
            "selected": false,
            "text": "6h",
            "value": "6h"
          },
          {
            "selected": false,
            "text": "12h",
            "value": "12h"
          },
          {
            "selected": false,
            "text": "1d",
            "value": "1d"
          },
          {
            "selected": false,
            "text": "7d",
            "value": "7d"
          },
          {
            "selected": false,
            "text": "14d",
            "value": "14d"
          },
          {
            "selected": false,
            "text": "30d",
            "value": "30d"
          }
        ],
        "query": "1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
        "queryValue": "",
        "refresh": 2,
        "skipUrlSync": false,
        "type": "interval"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_INFLUXDB}",
        "definition": "",
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Unifi Protect Host",
        "multi": true,
        "name": "NVRName",
        "options": [],
        "query": "SHOW TAG VALUES FROM unifi_protect_overview WITH KEY=protectname",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-3h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Unifi - Unifi Protect InfluxDB",
  "uid": "hBnl7_LGk",
  "version": 15
}