Grafana dashboard: Endlessh
Description: Dashboard for endlessh (Update variables on time range changes)

Endlessh traps SSH brute-force attackers.

This dashboard reads metrics from the [Golang implementation of endlessh](https://github.com/shizunge/endlessh-go), and visualize the sources of attacks for the selected time range.

See the [repository](https://github.com/shizunge/endlessh-go) on GitHub for more details.

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "panel",
      "id": "geomap",
      "name": "Geomap",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.6"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "Dashboard for endlessh (Update variables on time range changes)",
  "editable": false,
  "fiscalYearStartMonth": 0,
  "gnetId": 15156,
  "graphTooltip": 0,
  "id": null,
  "links": [
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": false,
      "keepTime": false,
      "tags": [],
      "targetBlank": true,
      "title": "GitHub",
      "tooltip": "GitHub",
      "type": "link",
      "url": "https://github.com/shizunge/endlessh-go"
    },
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": false,
      "keepTime": false,
      "tags": [],
      "targetBlank": true,
      "title": "Grafana",
      "tooltip": "Grafana Dashboard",
      "type": "link",
      "url": "https://grafana.com/grafana/dashboards/15156"
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 36,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^Total number connections that endlessh trapped$/",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 49,
          "refId": "A"
        }
      ],
      "title": "Connections",
      "transformations": [
        {
          "id": "filterByRefId",
          "options": {
            "include": "Seen"
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #Seen"
              }
            ],
            "match": "any",
            "type": "include"
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value #Seen": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "ip": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "reduce",
          "options": {
            "includeTimeField": false,
            "labelsToFields": false,
            "mode": "reduceFields",
            "reducers": [
              "sum"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value #Seen (sum)": "Total number connections that endlessh trapped"
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 4,
        "y": 0
      },
      "id": 42,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^Time spent on endlessh$/",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 49,
          "refId": "A"
        }
      ],
      "title": "Trapped Time",
      "transformations": [
        {
          "id": "filterByRefId",
          "options": {
            "include": "Trapped"
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #Trapped"
              }
            ],
            "match": "all",
            "type": "include"
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value #Trapped": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "ip": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "reduce",
          "options": {
            "includeTimeField": false,
            "labelsToFields": false,
            "mode": "reduceFields",
            "reducers": [
              "sum"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Total": "Seconds spent on endlessh",
              "Value #Trapped (sum)": "Time spent on endlessh"
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 8,
        "y": 0
      },
      "id": 18,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "sum(increase(endlessh_sent_bytes_total{instance=~\"$host\",job=~\"$job\"}[$__range]))",
          "hide": false,
          "interval": "",
          "legendFormat": "Bytes sent by endlessh",
          "refId": "sent_bytes"
        }
      ],
      "title": "Sent Bytes",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 12,
        "y": 0
      },
      "id": 38,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^Unique IPs connected$/",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 49,
          "refId": "A"
        }
      ],
      "title": "Unique IPs",
      "transformations": [
        {
          "id": "filterByRefId",
          "options": {
            "include": "Seen"
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value #Seen": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "ip": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "reduce",
          "options": {
            "includeTimeField": false,
            "labelsToFields": false,
            "mode": "reduceFields",
            "reducers": [
              "count"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value #Seen (sum)": "Unique IPs connected",
              "ip": ""
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "links": [
            {
              "targetBlank": true,
              "title": "whois",
              "url": "https://search.arin.net/rdap/?query=${__value.text}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 16,
        "y": 0
      },
      "id": 45,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^Client IP of the latest connection$/",
          "values": false
        },
        "text": {},
        "textMode": "value"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 49,
          "refId": "A"
        }
      ],
      "title": "Latest Connection",
      "transformations": [
        {
          "id": "filterByRefId",
          "options": {
            "include": "Seen"
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #Seen"
              }
            ],
            "match": "any",
            "type": "include"
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Time": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "Value #Seen": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "ip": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "field": "Time (lastNotNull)"
              }
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "instance": true,
              "job": true
            },
            "indexByName": {},
            "renameByName": {
              "Time (lastNotNull)": "Time",
              "Value #Seen (sum)": "Count",
              "ip": "Client IP of the latest connection"
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 10
              },
              {
                "color": "red",
                "value": 20
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 20,
        "y": 0
      },
      "id": 20,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "sum((endlessh_client_open_count_total{instance=~\"$host\",job=~\"$job\"}) - (endlessh_client_closed_count_total{instance=~\"$host\",job=~\"$job\"} offset $__interval  or endlessh_client_open_count_total{instance=~\"$host\",job=~\"$job\"} * 0))",
          "instant": false,
          "interval": "",
          "legendFormat": "Open Connections",
          "refId": "current_open"
        }
      ],
      "title": "Current Connections",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "stepAfter",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "min": -0.01,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 12,
        "x": 0,
        "y": 3
      },
      "id": 30,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 20,
          "refId": "A"
        }
      ],
      "title": "Concurrent Connections",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 3
      },
      "id": 32,
      "options": {
        "displayLabels": [],
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value",
            "percent"
          ]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 49,
          "refId": "A"
        }
      ],
      "title": "Connections by country",
      "transformations": [
        {
          "id": "filterByRefId",
          "options": {
            "include": "Seen"
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #Seen"
              }
            ],
            "match": "any",
            "type": "include"
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value #Seen": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "country": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "ip": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value #Seen (sum)": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "country (last)": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "rowsToFields",
          "options": {}
        }
      ],
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-GrYlRd"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#96D98D",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 12,
        "x": 0,
        "y": 7
      },
      "id": 48,
      "links": [],
      "options": {
        "basemap": {
          "config": {},
          "name": "Layer 0",
          "type": "default"
        },
        "controls": {
          "mouseWheelZoom": false,
          "showAttribution": false,
          "showDebug": false,
          "showMeasure": false,
          "showScale": false,
          "showZoom": true
        },
        "layers": [
          {
            "config": {
              "color": {
                "field": "Connections",
                "fixed": "dark-green"
              },
              "fillOpacity": 0.4,
              "shape": "circle",
              "showLegend": false,
              "size": {
                "field": "Connections",
                "fixed": 5,
                "max": 10,
                "min": 2
              },
              "style": {
                "color": {
                  "field": "Connections",
                  "fixed": "dark-green"
                },
                "size": {
                  "field": "Connections",
                  "fixed": 5,
                  "max": 9,
                  "min": 2
                },
                "text": {
                  "field": "location (lastNotNull) (lastNotNull)",
                  "fixed": "",
                  "mode": "fixed"
                }
              }
            },
            "location": {
              "geohash": "Geohash",
              "mode": "geohash"
            },
            "name": "Layer 1",
            "type": "markers"
          }
        ],
        "tooltip": {
          "mode": "details"
        },
        "view": {
          "allLayers": true,
          "id": "zero",
          "lat": 0,
          "lon": 0,
          "zoom": 1
        }
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 49,
          "refId": "A"
        }
      ],
      "title": "Locations",
      "transformations": [
        {
          "id": "filterByRefId",
          "options": {
            "include": "Seen"
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #Seen"
              }
            ],
            "match": "any",
            "type": "include"
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value #Seen": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "geohash": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "groupby"
              },
              "location": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              }
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {
              "Value #geo (lastNotNull) (sum)": 2,
              "geohash (lastNotNull)": 0,
              "location (lastNotNull) (lastNotNull)": 1
            },
            "renameByName": {
              "Value #Seen (sum)": "Connections",
              "geohash": "Geohash",
              "location (lastNotNull)": "Location"
            }
          }
        }
      ],
      "type": "geomap"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": true,
            "inspect": false,
            "minWidth": 50
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Last Connection"
            },
            "properties": [
              {
                "id": "custom.minWidth",
                "value": 150
              },
              {
                "id": "unit",
                "value": "dateTimeAsIso"
              },
              {
                "id": "custom.align",
                "value": "left"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "IP"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "targetBlank": true,
                    "title": "search ARIN",
                    "url": "https://search.arin.net/rdap/?query=${__data.fields.IP}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Trapped Time"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 11
      },
      "id": 49,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Last Connection"
          }
        ]
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "(endlessh_client_open_count{instance=~\"$host\",job=~\"$job\"} - endlessh_client_open_count{instance=~\"$host\",job=~\"$job\"} offset $__interval) > 0 or (endlessh_client_open_count{instance=~\"$host\",job=~\"$job\"}!=0 unless endlessh_client_open_count{instance=~\"$host\",job=~\"$job\"} offset $__interval)",
          "format": "table",
          "hide": false,
          "interval": "",
          "legendFormat": "Seen {{ip}}",
          "refId": "Seen"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "(endlessh_client_trapped_time_seconds{instance=~\"$host\",job=~\"$job\"} - endlessh_client_trapped_time_seconds{instance=~\"$host\",job=~\"$job\"} offset $__interval) > 0 or (endlessh_client_trapped_time_seconds{instance=~\"$host\",job=~\"$job\"}!=0 unless endlessh_client_trapped_time_seconds{instance=~\"$host\",job=~\"$job\"} offset $__interval)",
          "format": "table",
          "hide": false,
          "interval": "",
          "legendFormat": "Trapped {{ip}}",
          "refId": "Trapped"
        }
      ],
      "title": "Clients",
      "transformations": [
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #Seen"
              },
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #Trapped"
              }
            ],
            "match": "any",
            "type": "include"
          }
        },
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Seen",
            "mode": "reduceRow",
            "reduce": {
              "include": [
                "Value #Seen"
              ],
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Trapped",
            "mode": "reduceRow",
            "reduce": {
              "include": [
                "Value #Trapped"
              ],
              "reducer": "sum"
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Seen"
              },
              {
                "config": {
                  "id": "greaterOrEqual",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Trapped"
              }
            ],
            "match": "all",
            "type": "include"
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Seen": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "Time": {
                "aggregations": [
                  "max"
                ],
                "operation": "aggregate"
              },
              "Trapped": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "country": {
                "aggregations": [
                  "lastNotNull"
                ],
                "operation": "aggregate"
              },
              "ip": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "isNull",
                  "options": {}
                },
                "fieldName": "ip"
              }
            ],
            "match": "any",
            "type": "exclude"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {
              "Seen (sum)": 3,
              "Time (max)": 0,
              "Trapped (sum)": 4,
              "country (lastNotNull)": 2,
              "ip": 1
            },
            "renameByName": {
              "Seen (sum)": "Connections",
              "Time (max)": "Last Connection",
              "Trapped (sum)": "Trapped Time",
              "country (lastNotNull)": "Country",
              "ip": "IP"
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": "",
  "schemaVersion": 37,
  "style": "dark",
  "tags": [
    "prometheus"
  ],
  "templating": {
    "list": [
      {
        "allValue": ".*",
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(endlessh_client_open_count_total, job)",
        "hide": 0,
        "includeAll": true,
        "label": "Job",
        "multi": true,
        "name": "job",
        "options": [],
        "query": {
          "query": "label_values(endlessh_client_open_count_total, job)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(endlessh_client_open_count_total{job=~\"$job\"}, instance)",
        "hide": 0,
        "includeAll": true,
        "label": "Host",
        "multi": true,
        "name": "host",
        "options": [],
        "query": {
          "query": "label_values(endlessh_client_open_count_total{job=~\"$job\"}, instance)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Endlessh",
  "uid": "ATIxYkO7k",
  "version": 10,
  "weekStart": ""
}