Grafana dashboard: RARE/freeRouter - BMP metrics
Description: Display BMP metrics

`scope:local` to freeRouter node

freeRouter Prometheus configuration: (copy & paste in freeRouter CLI)
* Create hardware and software sensor
```
sensor bmp
path bmp/peer/peer
prefix freertr-bmp
key name bmp/peer
command sho bmp bmp
prepend bmp_
name 0 from=
addname 1 * rpeer=
replace \. _
replace \: _
column 2 name asn
column 3 name state
column 3 replace false 0
column 3 replace true 1
column 4 name flaps
.
exit

sensor bmp-rtr1vh
path bmp-rtr1vh/bmp-rtr1vh
prefix freertr-bmp-nodesum
key name bmp/bmp-rtr1vh
prepend bmp_nodesum
command sho bmp bmp 195.111.97.108 | include rep\s|\sin|\sout
name 0 data=
labels node="rtr1vh"
replace \s _
column 1 name val
.
exit

```
* freeRtr server Prometheus agent configuration

```
server prometheus pr
 sensor bmp
 sensor bmp-rtr1vh
 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": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Display BMP metrics",
  "editable": true,
  "gnetId": 13156,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1662386052788,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_PROMETHEUS}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [
            {
              "from": "",
              "id": 0,
              "text": "up",
              "to": "",
              "type": 1,
              "value": "-1"
            },
            {
              "from": "",
              "id": 1,
              "text": "down",
              "to": "",
              "type": 1,
              "value": "-2"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "black",
                "value": null
              },
              {
                "color": "dark-red",
                "value": -2
              },
              {
                "color": "dark-green",
                "value": -1
              },
              {
                "color": "black",
                "value": 0
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 6,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "maxPerRow": 12,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.2.0",
      "repeat": "remote_peer",
      "repeatDirection": "h",
      "targets": [
        {
          "expr": "bmp_state{node_name=\"$node_name\",from=\"$bmp_agent\",rpeer=\"$remote_peer\"}-2",
          "instant": true,
          "interval": "",
          "legendFormat": "{{met}}",
          "refId": "A"
        },
        {
          "expr": "bmp_asn{node_name=\"$node_name\",from=\"$bmp_agent\",rpeer=\"$remote_peer\"}",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "B"
        },
        {
          "expr": "bmp_flaps{node_name=\"$node_name\",from=\"$bmp_agent\",rpeer=\"$remote_peer\"}",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "C"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "${remote_peer}",
      "transformations": [],
      "type": "stat"
    }
  ],
  "schemaVersion": 26,
  "style": "dark",
  "tags": [
    "[scope:global]"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values({__name__=~\"bmp_.*\"},node_name)",
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "node_name",
        "options": [],
        "query": "label_values({__name__=~\"bmp_.*\"},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({from=~\".*\",node_name=\"$node_name\"},from)",
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "bmp_agent",
        "options": [],
        "query": "label_values({from=~\".*\",node_name=\"$node_name\"},from)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "bmp_asn{node_name=\"$node_name\",from=\"$bmp_agent\"}",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "agent_asn",
        "options": [],
        "query": "bmp_asn{node_name=\"$node_name\",from=\"$bmp_agent\"}",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values({from=\"$bmp_agent\",node_name=\"$node_name\"},rpeer)",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "remote_peer",
        "options": [],
        "query": "label_values({from=\"$bmp_agent\",node_name=\"$node_name\"},rpeer)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "RARE/freeRouter - BMP metrics",
  "uid": "vZWgBhcMks",
  "version": 5
}