Grafana dashboard: RARE/freeRouter - interfaces bytes
Description: Display interface bytes metrics

`scope:local` to freeRouter node

freeRouter Prometheus configuration: (copy & paste in freeRouter CLI)
* Create hardware and software sensor
```
sensor ifaces-hw
path interfaces-hw/interface/counter
prefix freertr-ifaces
key name interfaces-hw/interface
command sho inter hwsumm
prepend iface_hw_byte_
name 0 ifc=
replace \. _
column 1 name st
column 1 replace admin -1
column 1 replace down 0
column 1 replace up 1
column 2 name tx
column 3 name rx
column 4 name dr
.
exit

sensor ifaces-sw
path interfaces-sw/interface/counter
prefix freertr-ifaces
key name interfaces-sw/interface
command sho inter swsumm
prepend iface_sw_byte_
name 0 ifc=
replace \. _
column 1 name st
column 1 replace admin -1
column 1 replace down 0
column 1 replace up 1
column 2 name tx
column 3 name rx
column 4 name dr
.
exit
```
* freeRtr server Prometheus agent configuration

```
server prometheus pr
 sensor ifaces-hw
 sensor ifaces-sw
 vrf <PROMETHEUS_VRF>
 exit
```
* Prometheus server configuration (sample config with 2 nodes)
```
global:
  scrape_interval: 15s
  scrape_timeout: 10s
  evaluation_interval: 30s
alerting:
  alertmanagers:
  - static_configs:
    - targets: []
    scheme: http
    timeout: 10s
scrape_configs:
- job_name: router
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - <prometheus_agent_ip_1>:9001
    labels:
      node_name: <prometheus_agent_1_node_name>
  - targets:
    - <prometheus_agent_ip_2>:9001
    labels:
      node_name: <prometheus_agent_2_node_name>
```



{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.2.0"
    },
    {
      "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": "Display interface bytes metrics",
  "editable": true,
  "gnetId": 13153,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1662458396112,
  "links": [],
  "panels": [
    {
      "aliasColors": {
        "rx": "blue",
        "tx": "green"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": []
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 7,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 2,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "maxPerRow": 3,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.2.0",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "repeat": "node_name_iface",
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "rate(iface_${cntr_type}_byte_tx{ifc=\"$node_name_iface\",node_name=\"$node_name\"}[1m])*8",
          "hide": false,
          "interval": "",
          "legendFormat": "tx",
          "refId": "A"
        },
        {
          "expr": "rate(iface_${cntr_type}_byte_rx{ifc=\"$node_name_iface\",node_name=\"$node_name\"}[1m])*8",
          "hide": false,
          "interval": "",
          "legendFormat": "rx",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "${cntr_type}:${node_name_iface}",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:935",
          "format": "bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:936",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "5s",
  "schemaVersion": 26,
  "style": "dark",
  "tags": [
    "[scope:local]"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values({__name__=~\"^iface_.*\"},node_name)",
        "hide": 0,
        "includeAll": false,
        "label": "node name",
        "multi": false,
        "name": "node_name",
        "options": [],
        "query": "label_values({__name__=~\"^iface_.*\"},node_name)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(iface_${cntr_type}_byte_${dir}{node_name=\"$node_name\"},ifc)",
        "hide": 0,
        "includeAll": true,
        "label": "interface",
        "multi": true,
        "name": "node_name_iface",
        "options": [],
        "query": "label_values(iface_${cntr_type}_byte_${dir}{node_name=\"$node_name\"},ifc)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "selected": true,
          "text": "sw",
          "value": "sw"
        },
        "hide": 0,
        "includeAll": false,
        "label": "counter type",
        "multi": false,
        "name": "cntr_type",
        "options": [
          {
            "selected": false,
            "text": "hw",
            "value": "hw"
          },
          {
            "selected": true,
            "text": "sw",
            "value": "sw"
          }
        ],
        "query": "hw,sw",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {
          "selected": false,
          "text": "tx",
          "value": "tx"
        },
        "hide": 2,
        "includeAll": false,
        "label": "traffic direction",
        "multi": false,
        "name": "dir",
        "options": [
          {
            "selected": true,
            "text": "tx",
            "value": "tx"
          },
          {
            "selected": false,
            "text": "rx",
            "value": "rx"
          }
        ],
        "query": "tx,rx",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-30m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "RARE/freeRouter - interfaces bytes",
  "uid": "sqqgkzcGztest",
  "version": 31
}