Import an SNMP Dashboard for InfluxDB and Telegraf
Video Lecture
Description
Now that we have several local and external SNMP devices we can query, we can install a dashboard to view SNMP stats.
Open Dashboards --> Manage and then paste the JSON below into the Import via panel json text box and press load.
{ "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "description": "A sample template from https://sbcode.net/grafana/import-snmp-influxdb-telegraf-dashboard/", "editable": true, "gnetId": 10488, "graphTooltip": 1, "id": 27, "iteration": 1599729118325, "links": [ { "icon": "external link", "tags": [], "title": "SBCODE Grafana", "tooltip": "", "type": "link", "url": "https://sbcode.net/grafana/" }, { "icon": "external link", "tags": [], "title": "Course Coupons", "tooltip": "", "type": "link", "url": "https://sbcode.net/coupons" } ], "panels": [ { "cacheTimeout": null, "columns": [], "datasource": "InfluxDB", "description": "", "fieldConfig": { "defaults": { "custom": {} }, "overrides": [] }, "fontSize": "100%", "gridPos": { "h": 4, "w": 24, "x": 0, "y": 0 }, "id": 145, "links": [], "pageSize": null, "pluginVersion": "6.1.6", "scroll": true, "showHeader": true, "sort": { "col": 5, "desc": false }, "styles": [ { "alias": "Time", "align": "auto", "dateFormat": "YYYY-MM-DD HH:mm:ss", "link": false, "pattern": "Time", "type": "hidden" }, { "alias": "UP/DOWN", "align": "auto", "colorMode": "cell", "colors": [ "#37872D", "#37872D", "#C4162A" ], "decimals": 2, "mappingType": 1, "pattern": "ifOperStatus", "thresholds": [ "1", "2" ], "type": "string", "unit": "short", "valueMaps": [ { "text": "UP", "value": "1" }, { "text": "DOWN", "value": "2" } ] }, { "alias": "Link Speed", "align": "auto", "colorMode": null, "colors": [ "rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], "dateFormat": "YYYY-MM-DD HH:mm:ss", "decimals": 0, "mappingType": 1, "pattern": "ifSpeed", "thresholds": [], "type": "number", "unit": "bps", "valueMaps": [ { "text": "100 MB", "value": "10000000" }, { "text": "1 GB", "value": "100000000" }, { "text": "10 GB", "value": "1000000000" } ] } ], "targets": [ { "alias": "", "groupBy": [ { "params": [ "ifDescr" ], "type": "tag" } ], "limit": "1", "measurement": "interface", "orderByTime": "ASC", "policy": "autogen", "query": "SELECT last(\"ifOperStatus\") AS \"ifOperStatus\", \"ifInDiscards\", \"ifInErrors\", \"ifInOctets\", \"ifInUcastPkts\", \"ifMtu\", \"ifOutErrors\", \"ifOutDiscards\", \"ifSpeed\", \"ifPhysAddress\", \"ifLastChange\" FROM \"autogen\".\"interface\" WHERE (\"hostname\" =~ /^$hostname$/) AND $timeFilter GROUP BY \"ifDescr\" LIMIT 1", "rawQuery": true, "refId": "A", "resultFormat": "table", "select": [ [ { "params": [ "ifOperStatus" ], "type": "field" }, { "params": [], "type": "last" }, { "params": [ "ifOperStatus" ], "type": "alias" } ], [ { "params": [ "ifInDiscards" ], "type": "field" } ], [ { "params": [ "ifInErrors" ], "type": "field" } ], [ { "params": [ "ifInOctets" ], "type": "field" } ], [ { "params": [ "ifInUcastPkts" ], "type": "field" } ], [ { "params": [ "ifMtu" ], "type": "field" } ], [ { "params": [ "ifOutErrors" ], "type": "field" } ], [ { "params": [ "ifOutDiscards" ], "type": "field" } ], [ { "params": [ "ifSpeed" ], "type": "field" } ], [ { "params": [ "ifPhysAddress" ], "type": "field" } ], [ { "params": [ "ifLastChange" ], "type": "field" } ] ], "tags": [ { "key": "hostname", "operator": "=~", "value": "/^$hostname$/" } ] } ], "timeFrom": null, "timeShift": null, "title": "Interface Stats", "transform": "table", "transparent": true, "type": "table-old" }, { "collapsed": false, "datasource": null, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 4 }, "id": 2, "panels": [], "repeat": null, "title": "Throughput $interface", "type": "row" }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {} }, "overrides": [] }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 5 }, "hiddenSeries": false, "id": 14, "legend": { "alignAsTable": true, "avg": true, "current": true, "max": true, "min": false, "rightSide": false, "show": true, "total": false, "values": true }, "lines": true, "linewidth": 1, "links": [], "maxPerRow": 4, "nullPointMode": "null", "percentage": false, "pluginVersion": "7.1.5", "pointradius": 2, "points": false, "renderer": "flot", "repeat": "interface", "repeatDirection": "h", "scopedVars": { "interface": { "selected": false, "text": "lo", "value": "lo" } }, "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "$interface $col", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "measurement": "interface", "orderByTime": "ASC", "policy": "autogen", "query": "SELECT non_negative_derivative(mean(\"ifHCInOctets\"), 1s) AS \"in\", non_negative_derivative(mean(\"ifHCOutOctets\"), 1s) AS \"out\" FROM \"autogen\".\"interface\" WHERE (\"hostname\" =~ /^$hostname$/ AND \"ifDescr\" =~ /^$interface$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "ifHCInOctets" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "1s" ], "type": "non_negative_derivative" }, { "params": [ "*8" ], "type": "math" }, { "params": [ "in" ], "type": "alias" } ], [ { "params": [ "ifHCOutOctets" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "1s" ], "type": "non_negative_derivative" }, { "params": [ "*8" ], "type": "math" }, { "params": [ "out" ], "type": "alias" } ] ], "tags": [ { "key": "hostname", "operator": "=~", "value": "/^$hostname$/" }, { "condition": "AND", "key": "ifDescr", "operator": "=~", "value": "/^$interface$/" } ] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Throughput $interface", "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": null, "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": "InfluxDB", "fieldConfig": { "defaults": { "custom": {} }, "overrides": [] }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 5 }, "hiddenSeries": false, "id": 148, "legend": { "alignAsTable": true, "avg": true, "current": true, "max": true, "min": false, "rightSide": false, "show": true, "total": false, "values": true }, "lines": true, "linewidth": 1, "links": [], "maxPerRow": 4, "nullPointMode": "null", "percentage": false, "pluginVersion": "7.1.5", "pointradius": 2, "points": false, "renderer": "flot", "repeat": null, "repeatDirection": "h", "repeatIteration": 1599729118325, "repeatPanelId": 14, "scopedVars": { "interface": { "selected": false, "text": "Red Hat, Inc. Device 0001", "value": "Red Hat, Inc. Device 0001" } }, "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "$interface $col", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "measurement": "interface", "orderByTime": "ASC", "policy": "autogen", "query": "SELECT non_negative_derivative(mean(\"ifHCInOctets\"), 1s) *8 AS \"in\", non_negative_derivative(mean(\"ifHCOutOctets\"), 1s) *8 AS \"out\" FROM \"autogen\".\"interface\" WHERE (\"hostname\" =~ /^$hostname$/ AND \"ifDescr\" =~ /^$interface$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "ifHCInOctets" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "1s" ], "type": "non_negative_derivative" }, { "params": [ "*8" ], "type": "math" }, { "params": [ "in" ], "type": "alias" } ], [ { "params": [ "ifHCOutOctets" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "1s" ], "type": "non_negative_derivative" }, { "params": [ "*8" ], "type": "math" }, { "params": [ "out" ], "type": "alias" } ] ], "tags": [ { "key": "hostname", "operator": "=~", "value": "/^$hostname$/" }, { "condition": "AND", "key": "ifDescr", "operator": "=~", "value": "/^$interface$/" } ] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Throughput $interface", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "bytes", "label": null, "logBase": 1, "max": null, "min": null, "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": "InfluxDB", "fieldConfig": { "defaults": { "custom": {} }, "overrides": [] }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 12 }, "hiddenSeries": false, "id": 147, "legend": { "alignAsTable": true, "avg": true, "current": true, "max": true, "min": false, "rightSide": false, "show": true, "total": false, "values": true }, "lines": true, "linewidth": 1, "links": [], "maxPerRow": 4, "nullPointMode": "null", "percentage": false, "pluginVersion": "7.1.5", "pointradius": 2, "points": false, "renderer": "flot", "repeat": "interface", "repeatDirection": "h", "scopedVars": { "interface": { "selected": false, "text": "lo", "value": "lo" } }, "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "$interface $col", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "measurement": "interface", "orderByTime": "ASC", "policy": "autogen", "query": "SELECT count(\"ifInDiscards\") AS \"Discards\", count(\"ifInErrors\") AS \"Errors\" FROM \"interface\" WHERE (\"hostname\" =~ /^$hostname$/ AND \"ifDescr\" =~ /^$interface$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "ifInDiscards" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "1s" ], "type": "non_negative_derivative" }, { "params": [ "*8" ], "type": "math" }, { "params": [ "Discards" ], "type": "alias" } ], [ { "params": [ "ifInErrors" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "1s" ], "type": "non_negative_derivative" }, { "params": [ "*8" ], "type": "math" }, { "params": [ "Errors" ], "type": "alias" } ] ], "tags": [ { "key": "hostname", "operator": "=~", "value": "/^$hostname$/" }, { "condition": "AND", "key": "ifDescr", "operator": "=~", "value": "/^$interface$/" } ] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Discards/Errors $interface", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "none", "label": null, "logBase": 1, "max": null, "min": null, "show": true }, { "format": "short", "label": null, "logBase": 1, "max": null, "min": null, "show": false } ], "yaxis": { "align": false, "alignLevel": null } }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "InfluxDB", "fieldConfig": { "defaults": { "custom": {} }, "overrides": [] }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 12 }, "hiddenSeries": false, "id": 149, "legend": { "alignAsTable": true, "avg": true, "current": true, "max": true, "min": false, "rightSide": false, "show": true, "total": false, "values": true }, "lines": true, "linewidth": 1, "links": [], "maxPerRow": 4, "nullPointMode": "null", "percentage": false, "pluginVersion": "7.1.5", "pointradius": 2, "points": false, "renderer": "flot", "repeat": null, "repeatDirection": "h", "repeatIteration": 1599729118325, "repeatPanelId": 147, "scopedVars": { "interface": { "selected": false, "text": "Red Hat, Inc. Device 0001", "value": "Red Hat, Inc. Device 0001" } }, "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "$interface $col", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "measurement": "interface", "orderByTime": "ASC", "policy": "autogen", "query": "SELECT count(\"ifInDiscards\") AS \"Discards\", count(\"ifInErrors\") AS \"Errors\" FROM \"interface\" WHERE (\"hostname\" =~ /^$hostname$/ AND \"ifDescr\" =~ /^$interface$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "ifInDiscards" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "1s" ], "type": "non_negative_derivative" }, { "params": [ "*8" ], "type": "math" }, { "params": [ "Discards" ], "type": "alias" } ], [ { "params": [ "ifInErrors" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "1s" ], "type": "non_negative_derivative" }, { "params": [ "*8" ], "type": "math" }, { "params": [ "Errors" ], "type": "alias" } ] ], "tags": [ { "key": "hostname", "operator": "=~", "value": "/^$hostname$/" }, { "condition": "AND", "key": "ifDescr", "operator": "=~", "value": "/^$interface$/" } ] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Discards/Errors $interface", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "none", "label": null, "logBase": 1, "max": null, "min": null, "show": true }, { "format": "short", "label": null, "logBase": 1, "max": null, "min": null, "show": false } ], "yaxis": { "align": false, "alignLevel": null } } ], "refresh": "", "schemaVersion": 26, "style": "dark", "tags": [ "https://sbcode.net/grafana" ], "templating": { "list": [ { "allValue": null, "current": { "selected": false, "text": "grafana", "value": "grafana" }, "datasource": "InfluxDB", "definition": "SHOW TAG VALUES FROM interface WITH KEY = \"hostname\"", "hide": 0, "includeAll": false, "label": "Hostname", "multi": false, "name": "hostname", "options": [], "query": "SHOW TAG VALUES FROM interface WITH KEY = \"hostname\"", "refresh": 2, "regex": "", "skipUrlSync": false, "sort": 1, "tagValuesQuery": "", "tags": [], "tagsQuery": "", "type": "query", "useTags": false }, { "allValue": null, "current": { "selected": false, "text": "All", "value": "$__all" }, "datasource": "InfluxDB", "definition": "SHOW TAG VALUES FROM interface WITH KEY = \"ifDescr\" WHERE hostname=~ /$hostname$/", "hide": 0, "includeAll": true, "label": "Interface", "multi": true, "name": "interface", "options": [], "query": "SHOW TAG VALUES FROM interface WITH KEY = \"ifDescr\" WHERE hostname=~ /$hostname$/", "refresh": 2, "regex": "", "skipUrlSync": false, "sort": 3, "tagValuesQuery": "", "tags": [], "tagsQuery": "", "type": "query", "useTags": false } ] }, "time": { "from": "now-12h", "to": "now" }, "timepicker": { "refresh_intervals": [ "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d" ], "time_options": [ "5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d" ] }, "timezone": "", "title": "SNMP Dashboard", "uid": "snmp-grafana-sbcode", "version": 7 }