Grafana dashboard: sFlow-RT Countries and Networks
Description: Trend network traffic by source and destination countries and networks

sFlow-RT Countries and Networks
---
This dashboard trends network traffic by country and network reported by  [sFlow-RT](https://sflow-rt.com) analyzer. The sFlow-RT analysis software collects streaming telemetry from industry standard [sFlow Agents](https://sflow-rt.com/agents.php) embedded in network devices.

Use the [sflow/prometheus](https://hub.docker.com/r/sflow/prometheus) image to run sFlow-RT using Docker:
```console
docker run -d -p 6343:6343/udp -p 8008:8008 sflow/prometheus
```
To enable SNMP to retrieve network device interface and system names, add the following option:
```console
docker run -d -p 6343:6343/udp -p 8008:8008 sflow/prometheus -Dsnmp.ifname=yes
```
Use the following [Prometheus](https://prometheus.io/) scrape configuration to collect the metrics from sFlow-RT:
```console
scrape_configs:
  - job_name: 'sflow-rt-analyzer'
    metrics_path: /prometheus/analyzer/txt
    static_configs:
      - targets: ['sflow-rt.mysite.org:8008']
  - job_name: 'sflow-rt-metrics'
    metrics_path: /prometheus/metrics/ALL/ALL/txt
    static_configs:
      - targets: ['sflow-rt.mysite.org:8008']
    metric_relabel_configs:
      - source_labels: ['agent', 'datasource']
        separator: ':'
        target_label: instance
  - job_name: 'sflow-rt-countries'
    metrics_path: /app/prometheus/scripts/export.js/flows/ALL/txt
    static_configs:
      - targets: ['sflow-rt.mysite.org:8008']
    params:
      metric: ['sflow_country_bps']
      key: ['null:[country:ipsource:both]:unknown','null:[country:ipdestination:both]:unknown']
      label: ['src','dst']
      value: ['bytes']
      scale: ['8']
      aggMode: ['sum']
      minValue: ['1000']
      maxFlows: ['100']
  - job_name: 'sflow-rt-asns'
    metrics_path: /app/prometheus/scripts/export.js/flows/ALL/txt
    static_configs:
      - targets: ['sflow-rt.mysite.org:8008']
    params:
      metric: ['sflow_asn_bps']
      key: ['null:[asn:ipsource:both]:unknown','null:[asn:ipdestination:both]:unknown']
      label: ['src','dst']
      value: ['bytes']
      scale: ['8']
      aggMode: ['sum']
      minValue: ['1000']
      maxFlows: ['100']
```

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.4.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Trend network traffic by source and destination countries and networks",
  "editable": true,
  "gnetId": 11146,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1573239850632,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 8,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum(avg_over_time(sflow_asn_bps{src=~\"$SRCASN\"}[$__interval])) by (src)",
          "legendFormat": "{{src}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Network Sending",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 6,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum(avg_over_time(sflow_asn_bps{dst=~\"$DSTASN\"}[$__interval])) by (dst)",
          "legendFormat": "{{dst}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Network Receiving",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 10
      },
      "id": 2,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum(avg_over_time(sflow_country_bps{src=~\"$SRCCOUNTRY\"}[$__interval])) by (src)",
          "legendFormat": "{{src}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Country Sending",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 10
      },
      "id": 4,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum(avg_over_time(sflow_country_bps{dst=~\"$DSTCOUNTRY\"}[$__interval])) by (dst)",
          "legendFormat": "{{dst}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Country Receiving",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "1m",
  "schemaVersion": 20,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {
          "tags": [],
          "text": "20",
          "value": "20"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Top N",
        "multi": false,
        "name": "K",
        "options": [
          {
            "selected": false,
            "text": "5",
            "value": "5"
          },
          {
            "selected": false,
            "text": "10",
            "value": "10"
          },
          {
            "selected": false,
            "text": "15",
            "value": "15"
          },
          {
            "selected": true,
            "text": "20",
            "value": "20"
          }
        ],
        "query": "5,10,15,20",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "query_result(topk($K,sum(max_over_time(sflow_country_bps{src!=\"unknown\"}[${__range_s}s])) by (src)))",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "SRCCOUNTRY",
        "options": [],
        "query": "query_result(topk($K,sum(max_over_time(sflow_country_bps{src!=\"unknown\"}[${__range_s}s])) by (src)))",
        "refresh": 2,
        "regex": ".*src=\"([^\"]+)\".*",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "query_result(topk($K,sum(max_over_time(sflow_country_bps{dst!=\"unknown\"}[${__range_s}s])) by (dst)))",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "DSTCOUNTRY",
        "options": [],
        "query": "query_result(topk($K,sum(max_over_time(sflow_country_bps{dst!=\"unknown\"}[${__range_s}s])) by (dst)))",
        "refresh": 2,
        "regex": ".*dst=\"([^\"]+)\".*",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "query_result(topk($K,sum(max_over_time(sflow_asn_bps{src!=\"unknown\"}[${__range_s}s])) by (src)))",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "SRCASN",
        "options": [],
        "query": "query_result(topk($K,sum(max_over_time(sflow_asn_bps{src!=\"unknown\"}[${__range_s}s])) by (src)))",
        "refresh": 2,
        "regex": ".*src=\"([^\"]+)\".*",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "query_result(topk($K,sum(max_over_time(sflow_asn_bps{dst!=\"unknown\"}[${__range_s}s])) by (dst)))",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "DSTASN",
        "options": [],
        "query": "query_result(topk($K,sum(max_over_time(sflow_asn_bps{dst!=\"unknown\"}[${__range_s}s])) by (dst)))",
        "refresh": 2,
        "regex": ".*dst=\"([^\"]+)\".*",
        "skipUrlSync": false,
        "sort": 1,
        "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": "sFlow-RT Countries and Networks",
  "uid": "8008K41Wk",
  "version": 5
}