Grafana dashboard: nginx geo metricreporter (Default nginx log format)
Description: dashboard for nginx geo metricreporter (Default nginx log format)


# [Nginx Geo MetricsReporter](https://github.com/Mtt6300/nginx-geo-metricsreporter)
Simple metrcis reporter with Python for track visitors' location and where connected to [Nginx]("https://www.nginx.com/") webservice.

## How it works
Nginx-parser, parsing Nginx `access.log` line by line, after recognizing any change in log file, a post request will be sent with some data like `$remote_addr` and `$host` to the Metricsreporter Webservice. Metricsreporter will grab information from `Geo dataset` with previous step data and make that a metrics for `Proemtheus` on `/metrics`.

### for more information about that collector, visit collector [github page](https://github.com/Mtt6300/nginx-geo-metricsreporter)


{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.1.0"
    },
    {
      "type": "panel",
      "id": "grafana-piechart-panel",
      "name": "Pie Chart",
      "version": "1.5.0"
    },
    {
      "type": "panel",
      "id": "grafana-worldmap-panel",
      "name": "Worldmap Panel",
      "version": "0.2.1"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "dashboard for nginx geo metricreporter (Default nginx log format)\r\n",
  "editable": true,
  "gnetId": 12733,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1596206019582,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "expr": "sum(nginx_remote_addr_info_total{continentName=~\"^$Content.*$\",countryName=~\"^$Country.*$\",cityName=~\"^$City.*\"})",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Total count",
      "transparent": true,
      "type": "stat"
    },
    {
      "circleMaxSize": "10",
      "circleMinSize": "3",
      "colors": [
        "#56A64B",
        "#56A64B"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "decimals": null,
      "esGeoPoint": "geohash",
      "esLocationName": "cityName",
      "esMetric": "Value",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "gridPos": {
        "h": 13,
        "w": 20,
        "x": 4,
        "y": 0
      },
      "hideEmpty": false,
      "hideZero": false,
      "id": 2,
      "initialZoom": "2",
      "locationData": "table",
      "mapCenter": "(0°, 0°)",
      "mapCenterLatitude": 0,
      "mapCenterLongitude": 0,
      "maxDataPoints": 1,
      "mouseWheelZoom": true,
      "showLegend": true,
      "stickyLabels": true,
      "tableQueryOptions": {
        "geohashField": "geohash",
        "labelField": "cityName",
        "latitudeField": "cityLant",
        "longitudeField": "cityLong",
        "metricField": "Value",
        "queryType": "coordinates"
      },
      "targets": [
        {
          "expr": "nginx_remote_addr_info_total",
          "format": "table",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "World",
      "transparent": true,
      "type": "grafana-worldmap-panel",
      "unitPlural": "",
      "unitSingle": "",
      "unitSingular": "",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "25%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 12,
        "w": 4,
        "x": 0,
        "y": 4
      },
      "id": 14,
      "interval": null,
      "legend": {
        "percentage": false,
        "show": true,
        "sort": "current",
        "sortDesc": true,
        "values": true
      },
      "legendType": "Under graph",
      "links": [],
      "maxDataPoints": 1,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": "1",
      "targets": [
        {
          "expr": "sum(nginx_remote_addr_info_total) by (continentName)",
          "instant": true,
          "interval": "",
          "legendFormat": "{{continentName}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Total Continent",
      "transformations": [],
      "transparent": true,
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 20,
        "x": 4,
        "y": 13
      },
      "id": 4,
      "interval": "",
      "maxDataPoints": 40,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "expr": "sum(increase(nginx_remote_addr_info_total [$__range]))",
          "format": "time_series",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Count",
      "transparent": true,
      "type": "stat"
    },
    {
      "aliasColors": {},
      "breakPoint": "25%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 15,
        "w": 4,
        "x": 0,
        "y": 16
      },
      "id": 20,
      "interval": null,
      "legend": {
        "percentage": false,
        "show": true,
        "sort": "current",
        "sortDesc": true,
        "values": true
      },
      "legendType": "Under graph",
      "links": [],
      "maxDataPoints": 1,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": "1",
      "targets": [
        {
          "expr": "sum(nginx_remote_addr_info_total) by (countryName)",
          "instant": true,
          "interval": "",
          "legendFormat": "{{countryName}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Total Country",
      "transformations": [],
      "transparent": true,
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "breakPoint": "25%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 4,
        "y": 16
      },
      "id": 22,
      "interval": "",
      "legend": {
        "percentage": true,
        "percentageDecimals": null,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "values": false
      },
      "legendType": "Under graph",
      "links": [],
      "maxDataPoints": 1,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": "1",
      "targets": [
        {
          "expr": "sum(increase(nginx_remote_addr_info_total{continentName=~\"^$Content.*$\"}[$__range])) by (continentName)",
          "instant": true,
          "interval": "",
          "legendFormat": "{{continentName}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Continent",
      "transformations": [],
      "transparent": true,
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "breakPoint": "25%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 11,
        "y": 16
      },
      "id": 23,
      "interval": null,
      "legend": {
        "percentage": false,
        "show": false,
        "sort": "current",
        "sortDesc": false,
        "values": false
      },
      "legendType": "Under graph",
      "links": [],
      "maxDataPoints": 1,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": "1",
      "targets": [
        {
          "expr": "sum(increase(nginx_remote_addr_info_total{continentName=~\"^$Content.*$\",countryName=~\"^$Country.*$\"}[$__range])) by (countryName)",
          "instant": true,
          "interval": "",
          "legendFormat": "{{countryName}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Country",
      "transformations": [],
      "transparent": true,
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "breakPoint": "25%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 17,
        "y": 16
      },
      "id": 24,
      "interval": null,
      "legend": {
        "percentage": false,
        "show": false,
        "sort": "current",
        "sortDesc": false,
        "values": false
      },
      "legendType": "Under graph",
      "links": [],
      "maxDataPoints": 1,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": "1",
      "targets": [
        {
          "expr": "sum(increase(nginx_remote_addr_info_total{continentName=~\"^$Content.*$\",countryName=~\"^$Country.*$\",cityName=~\"^$City.*\"}[$__range])) by (countryName,cityName)",
          "instant": true,
          "interval": "",
          "legendFormat": "{{cityName}} - ({{countryName}})",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "City",
      "transformations": [],
      "transparent": true,
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "displayMode": "auto"
          },
          "decimals": 0,
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Last (not null)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Count"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 11,
        "w": 6,
        "x": 4,
        "y": 22
      },
      "id": 12,
      "interval": null,
      "links": [],
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Count"
          }
        ]
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "expr": "sum(increase(nginx_remote_addr_info_total{continentName=~\"^$Content.*$\"}[$__range])) by (continentName)",
          "format": "time_series",
          "hide": false,
          "instant": false,
          "interval": "",
          "legendFormat": "{{continentName}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Request Continent Table",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "reducers": [
              "lastNotNull"
            ]
          }
        }
      ],
      "transparent": true,
      "type": "table"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "displayMode": "auto"
          },
          "decimals": 0,
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Last (not null)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Count"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 11,
        "w": 6,
        "x": 10,
        "y": 22
      },
      "id": 15,
      "interval": null,
      "links": [],
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Count"
          }
        ]
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "expr": "sum(increase(nginx_remote_addr_info_total{continentName=~\"^$Content.*$\",countryName=~\"^$Country.*$\"}[$__range])) by (countryName)",
          "format": "time_series",
          "instant": false,
          "interval": "",
          "legendFormat": "{{countryName}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Request Country Table",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "reducers": [
              "lastNotNull"
            ]
          }
        }
      ],
      "transparent": true,
      "type": "table"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "displayMode": "auto"
          },
          "decimals": 0,
          "mappings": [],
          "min": 0,
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Last (not null)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Count"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 11,
        "w": 8,
        "x": 16,
        "y": 22
      },
      "id": 18,
      "interval": null,
      "links": [],
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Count"
          }
        ]
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "expr": "sum(increase(nginx_remote_addr_info_total{continentName=~\"^$Content.*$\",countryName=~\"^$Country.*$\",cityName=~\"^$City.*\"}[$__range])) by (countryName,cityName)",
          "format": "time_series",
          "instant": false,
          "interval": "",
          "legendFormat": "{{cityName}} - ({{countryName}})",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Request City Table",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "reducers": [
              "lastNotNull"
            ]
          }
        }
      ],
      "transparent": true,
      "type": "table"
    }
  ],
  "refresh": "10s",
  "schemaVersion": 26,
  "style": "dark",
  "tags": [
    "nginx",
    "proemhteus",
    "kubernetes"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(continentName)",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "Content",
        "options": [],
        "query": "label_values(continentName)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(nginx_remote_addr_info_total{continentName=~\"^$Content\"},countryName)",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": false,
        "name": "Country",
        "options": [],
        "query": "label_values(nginx_remote_addr_info_total{continentName=~\"^$Content\"},countryName)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(nginx_remote_addr_info_total{continentName=~\"^$Content\",countryName=~\"^$Country\"},cityName)",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": false,
        "name": "City",
        "options": [],
        "query": "label_values(nginx_remote_addr_info_total{continentName=~\"^$Content\",countryName=~\"^$Country\"},cityName)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "nowDelay": "",
    "refresh_intervals": [
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "nginx geo metricreporter (Default nginx log format)",
  "uid": "0c71VznMk",
  "version": 15
}