{ "annotations": {"list": [{"builtIn": 1,"datasource": {"type": "datasource","uid": "grafana"},"enable": true,"hide": true,"iconColor": "rgba(0, 211, 255, 1)","name": "Annotations & Alerts","type": "dashboard"}]}, "description": "BGP peer session health, uptime, and flap analysis. Teaches session stability and how to diagnose flapping peers.", "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, "id": null, "links": [], "panels": [ { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "description": "Learn: A healthy BGP mesh shows all peers UP continuously. Any gap in the UP state represents a session flap — investigate the reset reason.", "fieldConfig": { "defaults": { "color": {"mode": "thresholds"}, "custom": {"fillOpacity": 70,"lineWidth": 0,"spanNulls": false}, "mappings": [{"options": {"down": {"color": "red","index": 1,"text": "DOWN"},"up": {"color": "green","index": 0,"text": "UP"}},"type": "value"}], "thresholds": {"mode": "absolute","steps": [{"color": "red","value": null},{"color": "green","value": 1}]} } }, "gridPos": {"h": 8,"w": 24,"x": 0,"y": 0}, "id": 1, "options": {"alignValue": "left","legend": {"displayMode": "list","placement": "bottom"},"mergeValues": true,"rowHeight": 0.9,"showValue": "auto","tooltip": {"mode": "single"}}, "targets": [ { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "format": "time_series", "rawSql": "SELECT\n $__timeGroupAlias(e.timestamp,'1m'),\n COALESCE(p.name, p.peer_addr::text) AS metric,\n CASE WHEN e.state = 'up' THEN 1 ELSE 0 END AS \"value\"\nFROM peer_event_log e\nJOIN bgp_peers p ON p.hash_id = e.peer_hash_id\nWHERE $__timeFilter(e.timestamp)\nORDER BY 1, 2", "refId": "A" } ], "title": "Peer Session State Timeline", "type": "state-timeline" }, { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "description": "Current state of all BGP peers. Learn: 'bmp_reason' tells you why BMP reporting stopped. 'bgp_err_code' shows BGP NOTIFICATION error codes.", "fieldConfig": { "defaults": {"custom": {"align": "auto","displayMode": "auto"}}, "overrides": [ {"matcher": {"id": "byName","options": "State"},"properties": [{"id": "custom.displayMode","value": "color-background"},{"id": "mappings","value": [{"options": {"down": {"color": "red","index": 1,"text": "DOWN"},"up": {"color": "green","index": 0,"text": "UP"}},"type": "value"}]}]}, {"matcher": {"id": "byName","options": "Peer"},"properties": [{"id": "custom.width","value": 200}]}, {"matcher": {"id": "byName","options": "AS"},"properties": [{"id": "custom.width","value": 80}]} ] }, "gridPos": {"h": 12,"w": 24,"x": 0,"y": 8}, "id": 2, "options": {"footer": {"fields": "","reducer": ["sum"],"show": false},"showHeader": true,"sortBy": [{"desc": false,"displayName": "State"}]}, "targets": [ { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "format": "table", "rawSql": "SELECT\n COALESCE(p.name, p.peer_addr::text) AS \"Peer\",\n p.peer_addr AS \"Address\",\n p.peer_as AS \"AS\",\n p.state AS \"State\",\n p.timestamp AS \"Last State Change\",\n p.error_text AS \"Last Error\",\n p.local_hold_time AS \"Hold Time\"\nFROM bgp_peers p\nWHERE p.isprepolicy = true\nORDER BY p.state, p.peer_addr", "refId": "A" } ], "title": "Current Peer State", "type": "table" }, { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "description": "Learn: Flap count = number of times a peer went from UP to DOWN. A peer flapping more than 2 times per hour needs investigation.", "fieldConfig": { "defaults": {"custom": {"align": "auto","displayMode": "auto"}}, "overrides": [ {"matcher": {"id": "byName","options": "Flap Count"},"properties": [{"id": "custom.displayMode","value": "color-background"},{"id": "thresholds","value": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "yellow","value": 1},{"color": "red","value": 5}]}}]} ] }, "gridPos": {"h": 10,"w": 24,"x": 0,"y": 20}, "id": 3, "options": {"footer": {"fields": "","reducer": ["sum"],"show": false},"showHeader": true,"sortBy": [{"desc": true,"displayName": "Flap Count"}]}, "targets": [ { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "format": "table", "rawSql": "SELECT\n COALESCE(p.name, p.peer_addr::text) AS \"Peer\",\n p.peer_addr AS \"Address\",\n p.peer_as AS \"AS\",\n COUNT(CASE WHEN e.state = 'down' THEN 1 END) AS \"Flap Count\",\n MIN(e.timestamp) AS \"First Event\",\n MAX(e.timestamp) AS \"Last Event\"\nFROM peer_event_log e\nJOIN bgp_peers p ON p.hash_id = e.peer_hash_id\nWHERE $__timeFilter(e.timestamp)\nGROUP BY p.name, p.peer_addr, p.peer_as\nORDER BY \"Flap Count\" DESC", "refId": "A" } ], "title": "Peer Flap Analysis", "type": "table" }, { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"thresholds": {"mode": "absolute","steps": [{"color": "red","value": null},{"color": "yellow","value": 50},{"color": "green","value": 90}]},"unit": "percent","max": 100,"min": 0}}, "gridPos": {"h": 8,"w": 8,"x": 0,"y": 30}, "id": 4, "options": {"orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"showThresholdLabels": false,"showThresholdMarkers": true,"text": {}}, "targets": [ { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "format": "time_series", "rawSql": "SELECT NOW() AS time,\n ROUND(100.0 * SUM(CASE WHEN state = 'up' THEN 1 ELSE 0 END) / NULLIF(COUNT(*),0), 1) AS \"Mesh Health %\"\nFROM bgp_peers WHERE isprepolicy = true", "refId": "A" } ], "title": "Overall Peer Mesh Health", "type": "gauge" }, { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"thresholds": {"mode": "absolute","steps": [{"color": "red","value": null},{"color": "green","value": 1}]},"unit": "short","mappings": [{"options": {"0": {"color": "red","index": 0,"text": "DOWN"}},"type": "value"}]}}, "gridPos": {"h": 8,"w": 8,"x": 8,"y": 30}, "id": 5, "options": {"colorMode": "background","graphMode": "none","justifyMode": "auto","orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"text": {}}, "targets": [ { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "format": "time_series", "rawSql": "SELECT NOW() AS time,\n SUM(CASE WHEN state = 'up' THEN 1 ELSE 0 END) AS \"Peers UP\"\nFROM bgp_peers WHERE isprepolicy = true", "refId": "A" } ], "title": "Peers Currently UP", "type": "stat" }, { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "yellow","value": 1},{"color": "red","value": 5}]},"unit": "short"}}, "gridPos": {"h": 8,"w": 8,"x": 16,"y": 30}, "id": 6, "options": {"colorMode": "background","graphMode": "none","justifyMode": "auto","orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"text": {}}, "targets": [ { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "format": "time_series", "rawSql": "SELECT NOW() AS time,\n COUNT(CASE WHEN state = 'down' THEN 1 END) AS \"Flap Events (24h)\"\nFROM peer_event_log\nWHERE timestamp > NOW() - INTERVAL '24 hours' AND state = 'down'", "refId": "A" } ], "title": "Flap Events (24h)", "type": "stat" } ], "schemaVersion": 36, "style": "dark", "tags": ["obmp","learning","bgp","peers","flap"], "time": {"from": "now-24h","to": "now"}, "timepicker": {}, "timezone": "browser", "title": "Peer Session Health & Flap Analysis", "uid": "obmp-learn-02", "version": 1 }