Grafana dashboard: RARE/freeRouter  - Link State IGP peers / reachability & neighbor count summary
Description: Display link state IGP peer reachability and neighbor count metrics

`scope:local` to freeRouter node

freeRouter Prometheus configuration: (copy & paste in freeRouter CLI)
* Create hardware and software sensor
```
sensor lsigp4int
 path lsigp4int/peer/peer
 prefix freertr-lsigp4int
 prepend lsigp4_iface_
 command sho ipv4 ospf 1 interface
 name 0 proto="ospf1",ifc=
 key name lsigp4int/peer
 replace \. _
 column 1 name neighbors
 exit
sensor lsigp4peer
 path lsigp4peer/peer/peer
 prefix freertr-lsigp4peer
 prepend lsigp4_peers_
 command sho ipv4 ospf 1 topology 0 | inc reach
 name 0 proto="ospf1",node=
 key name lsigp4peer/peer
 replace \. _
 column 2 name reachable
 column 2 replace false 0
 column 2 replace true 1
 column 3 name neighbors
 exit
sensor lsigp4perf
 path lsigp4perf/peer/peer
 prefix freertr-lsigp4perf
 prepend lsigp4_perf_
 command sho ipv4 ospf 1 spf 0 | inc reachable|fill|calc|run
 key name lsigp4perf/peer
 labels proto="ospf1"
 skip 0
 column 1 name val
 exit
sensor lsigp6int
 path lsigp6int/peer/peer
 prefix freertr-lsigp6int
 prepend lsigp6_iface_
 command sho ipv6 ospf 1 interface
 name 0 proto="ospf1",ifc=
 key name lsigp6int/peer
 replace \. _
 column 1 name neighbors
 exit              
sensor lsigp6peer
 path lsigp6peer/peer/peer
 prefix freertr-lsigp6peer
 prepend lsigp6_peers_
 command sho ipv6 ospf 1 topology 0 | inc reach
 name 0 proto="ospf1",node=
 key name lsigp6peer/peer
 replace \. _
 replace \/ _
 column 2 name reachable
 column 2 replace false 0
 column 2 replace true 1
 column 3 name neighbors
 exit
sensor lsigp6perf
 path lsigp6perf/peer/peer
 prefix freertr-lsigp6perf
 prepend lsigp6_perf_
 command sho ipv6 ospf 1 spf 0 | inc reachable|fill|calc|run
 key name lsigp6perf/peer
 labels proto="ospf1"
 skip 0
 column 1 name val
 exit
```
* freeRtr server Prometheus agent configuration

```
server prometheus pr
 sensor lsigp4int
 sensor lsigp4peer
 sensor lsigp4perf
 sensor lsigp6int
 sensor lsigp6peer
 sensor lsigp6perf
 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>
```
!test
!test with grafana support team


{
  "__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 link state IGP peer reachability and neighbor count metrics",
  "editable": true,
  "gnetId": 13163,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1662367790825,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [
            {
              "from": "",
              "id": 0,
              "text": "up",
              "to": "",
              "type": 1,
              "value": "0"
            },
            {
              "from": "",
              "id": 1,
              "text": "down",
              "to": "",
              "type": 1,
              "value": "-1"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#000000",
                "value": null
              },
              {
                "color": "dark-red",
                "value": -1
              },
              {
                "color": "dark-green",
                "value": 0
              },
              {
                "color": "#000000",
                "value": 0.1
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "maxPerRow": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.2.0",
      "repeat": "igp_peer",
      "repeatDirection": "h",
      "targets": [
        {
          "expr": "${igp_type}_peers_reachable{node_name=\"$node_name\",proto=\"$protocol\",node=\"$igp_peer\"}-1",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        },
        {
          "expr": "${igp_type}_peers_neighbors{node_name=\"$node_name\",proto=\"$protocol\",node=\"$igp_peer\"}",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "B"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "${protocol}:${igp_peer}",
      "transformations": [],
      "type": "stat"
    }
  ],
  "refresh": "5s",
  "schemaVersion": 26,
  "style": "dark",
  "tags": [
    "[scope:global]"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values({__name__=~\"^lsigp.*\"},node_name)",
        "hide": 0,
        "includeAll": false,
        "label": "node name",
        "multi": false,
        "name": "node_name",
        "options": [],
        "query": "label_values({__name__=~\"^lsigp.*\"},node_name)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "selected": true,
          "text": "lsigp4",
          "value": "lsigp4"
        },
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "igp_type",
        "options": [
          {
            "selected": true,
            "text": "lsigp4",
            "value": "lsigp4"
          },
          {
            "selected": false,
            "text": "lsigp6",
            "value": "lsigp6"
          }
        ],
        "query": "lsigp4,lsigp6",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(${igp_type}_peers_neighbors{node_name=\"$node_name\"},proto)",
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "protocol",
        "options": [],
        "query": "label_values(${igp_type}_peers_neighbors{node_name=\"$node_name\"},proto)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(${igp_type}_peers_neighbors{node_name=\"$node_name\"},node)",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "igp_peer",
        "options": [],
        "query": "label_values(${igp_type}_peers_neighbors{node_name=\"$node_name\"},node)",
        "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  - Link State IGP peers / reachability & neighbor count summary",
  "uid": "LGmFlW5Gz",
  "version": 5
}