Grafana dashboard: Device Status


{
  "__inputs": [
    {
      "name": "DS_INFINITYHTTPDATASOURCE",
      "label": "InfinityHTTPDataSource",
      "description": "",
      "type": "datasource",
      "pluginId": "yesoreyeram-infinity-datasource",
      "pluginName": "Infinity"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.2.2"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "yesoreyeram-boomtheme-panel",
      "name": "Boom Theme",
      "version": "0.1.1"
    },
    {
      "type": "datasource",
      "id": "yesoreyeram-infinity-datasource",
      "name": "Infinity",
      "version": "0.7.8"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "gnetId": 15381,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1643770813061,
  "links": [
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": false,
      "tags": [
        "Interval"
      ],
      "targetBlank": false,
      "title": "Interval Data:",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "datasource": "-- Dashboard --",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [
            {
              "options": {
                "Unknown": {
                  "color": "red",
                  "index": 0,
                  "text": "No Signal"
                }
              },
              "type": "value"
            }
          ],
          "noValue": "Input API Key"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "No Signal"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "red",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "poor"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "yellow",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "good"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 0,
        "y": 0
      },
      "id": 13,
      "options": {
        "displayLabels": [
          "value",
          "name"
        ],
        "legend": {
          "displayMode": "hidden",
          "placement": "bottom"
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "pluginVersion": "8.1.2",
      "targets": [
        {
          "panelId": 2,
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "Device Last Recorded Signal Strength",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "notEqual",
                  "options": {
                    "value": "gateway"
                  }
                },
                "fieldName": "device_type"
              }
            ],
            "match": "all",
            "type": "include"
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "account_id": {
                "aggregations": [
                  "max"
                ],
                "operation": null
              },
              "device_id": {
                "aggregations": [
                  "count"
                ],
                "operation": "aggregate"
              },
              "last_heard": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": null
              },
              "signal_strength": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "rowsToFields",
          "options": {}
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "Unknown",
            "renamePattern": "No Signal"
          }
        }
      ],
      "type": "piechart"
    },
    {
      "datasource": "-- Dashboard --",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "noValue": "Input API Key",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 5,
        "y": 0
      },
      "id": 17,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "count"
          ],
          "fields": "/^last_heard_seconds$/",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.2.2",
      "targets": [
        {
          "panelId": 2,
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "Devices Offline (last heard >24h)",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "notEqual",
                  "options": {
                    "value": "gateway"
                  }
                },
                "fieldName": "device_type"
              }
            ],
            "match": "all",
            "type": "include"
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 86000
                  }
                },
                "fieldName": "last_heard_seconds"
              },
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "Never"
                  }
                },
                "fieldName": "last_heard"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": "-- Dashboard --",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 10,
        "y": 0
      },
      "id": 10,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "count"
          ],
          "fields": "/^last_heard_seconds$/",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.2.2",
      "targets": [
        {
          "panelId": 2,
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "Gateway Connection Issues",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "gateway"
                  }
                },
                "fieldName": "device_type"
              },
              {
                "config": {
                  "id": "notEqual",
                  "options": {
                    "value": "No Issues"
                  }
                },
                "fieldName": "signal_strength"
              }
            ],
            "match": "all",
            "type": "include"
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": "-- Dashboard --",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 15,
        "y": 0
      },
      "id": 14,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "count"
          ],
          "fields": "/^last_heard_seconds$/",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.2.2",
      "targets": [
        {
          "panelId": 2,
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "Gateways Online",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "gateway"
                  }
                },
                "fieldName": "device_type"
              },
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "No Issues"
                  }
                },
                "fieldName": "signal_strength"
              }
            ],
            "match": "all",
            "type": "include"
          }
        }
      ],
      "type": "stat"
    },
    {
      "activeThemeId": 0,
      "datasource": null,
      "description": "",
      "disableThemePicker": true,
      "gridPos": {
        "h": 1,
        "w": 1,
        "x": 20,
        "y": 0
      },
      "id": 16,
      "targets": [
        {
          "columns": [],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "",
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "queryType": "randomWalk",
          "refId": "A",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://jsonplaceholder.typicode.com/users",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "themes": [
        {
          "name": "Night Theme",
          "styles": [
            {
              "props": {
                "theme": "default"
              },
              "type": "basetheme"
            },
            {
              "props": {
                "text": "#ApiKey {\n  font-family: 'text-security-disc';\n}"
              },
              "type": "style"
            },
            {
              "props": {
                "url": "https://noppa.github.io/assets/text-security/text-security.css"
              },
              "type": "url"
            }
          ]
        }
      ],
      "transparent": true,
      "type": "yesoreyeram-boomtheme-panel"
    },
    {
      "collapsed": false,
      "datasource": null,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 6
      },
      "id": 8,
      "panels": [],
      "title": "Device Status",
      "type": "row"
    },
    {
      "datasource": "${DS_INFINITYHTTPDATASOURCE}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": true
          },
          "links": [
            {
              "title": "View Interval Data",
              "url": "/d/ujYaV3S7k?var-ApiKey=$ApiKey&var-DeviceID=${__data.fields.device_id}﻿﻿﻿&from=now-24h&to=now"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "signal_strength"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "No Issues": {
                        "color": "green",
                        "index": 1
                      },
                      "Unknown": {
                        "color": "#87878b",
                        "index": 2
                      },
                      "fair": {
                        "color": "yellow",
                        "index": 3
                      },
                      "good": {
                        "color": "green",
                        "index": 0
                      }
                    },
                    "type": "value"
                  }
                ]
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "red",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Last Heard (Minutes)"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "basic"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 720
                    },
                    {
                      "color": "red",
                      "value": 1440
                    }
                  ]
                }
              },
              {
                "id": "max",
                "value": 1440
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 13,
        "w": 23,
        "x": 0,
        "y": 7
      },
      "id": 2,
      "options": {
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.2.2",
      "targets": [
        {
          "columns": [],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "",
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "queryType": "randomWalk",
          "refId": "A",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://api.infisense.com/network/device/status",
          "url_options": {
            "data": "",
            "headers": [
              {
                "key": "X-API-KEY",
                "value": "$ApiKey"
              }
            ],
            "method": "GET"
          }
        },
        {
          "columns": [],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "",
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "json_options": {
            "columnar": false,
            "root_is_not_array": false
          },
          "refId": "B",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://api.infisense.com/device/?keys=user_context&partial=true&include_gateways=true&return_type=json-object",
          "url_options": {
            "data": "",
            "headers": [
              {
                "key": "X-API-KEY",
                "value": "$ApiKey"
              }
            ],
            "method": "GET",
            "params": []
          }
        }
      ],
      "title": "Device Status",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Last Heard (Minutes)",
            "binary": {
              "left": "last_heard_seconds",
              "operator": "/",
              "reducer": "sum",
              "right": "60"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": false
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "_configuration": true,
              "account_id": true,
              "app_eui": true,
              "battery_level_volts": false,
              "configuration": true,
              "created_at": true,
              "device_status": true,
              "device_version": true,
              "last_heard": true,
              "last_heard_seconds": true,
              "network": true,
              "project_id": true,
              "serial_number": true,
              "status": true,
              "type": true
            },
            "indexByName": {
              "Customer_Address": 11,
              "Customer_Gateway_ID": 12,
              "Customer_Name": 10,
              "Last Heard (Minutes)": 5,
              "_configuration": 13,
              "account_id": 8,
              "battery_level_volts": 7,
              "device_id": 0,
              "device_status": 3,
              "device_type": 1,
              "last_heard": 4,
              "last_heard_seconds": 9,
              "network": 2,
              "signal_strength": 6
            },
            "renameByName": {
              "signal_strength": "Device Signal Strength / Gateway Connectivity"
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "Last Heard (Minutes)"
              }
            ]
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": "",
  "schemaVersion": 31,
  "style": "dark",
  "tags": [
    "Status",
    "Demo"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "description": "Paste API Key Here",
        "error": null,
        "hide": 0,
        "label": "Api Key",
        "name": "ApiKey",
        "options": [
          {
            "selected": true,
            "text": "",
            "value": ""
          }
        ],
        "query": "",
        "skipUrlSync": false,
        "type": "textbox"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {
    "hidden": true
  },
  "timezone": "",
  "title": "Device Status",
  "uid": "tzZbhoTnz",
  "version": 11
}