Skip to content

MikroTik 260GS SNMP Dashboard

Video Lecture

MikroTik 260GS SNMP Dashboard MikroTik 260GS SNMP Dashboard

Description

I have an SNMP enabled MikroTik 260GS switch configured as a host in my Zabbix system. I demonstrate creating a Grafana dashboard for it.

MikroTik 260gs SNMP Dashboard

First I will create a dashboard variable, that can be used for the interface selector.

Name interface
Query Type Item
Group network
Host MikroTik
Item Tag component: network
Item /.\*/
Regex /(Interface Port.*)\(/

I also show a repeating Stat panel showing the operational status of each interface.

Visualization Stat
Title $interface
Repeat Options interface
Repeat Direction Vertical
Value Mappings 1 -> UP Green\n0 -> Down Red
Data source Zabbix
Query Type Metrics
Group network
Host MikroTik
Item Tag component: network
Item /$interface\(\): Operational status/

I also create a repeating time series each showing several properties of each interface.

Visualization Stat
Title $interface
Repeat Options interface
Repeat Direction Vertical
Data source Zabbix
Query Type Metrics
Group network
Host MikroTik
Item Tag component: network
Item A /$interface\(\): Bits sent/
Item B /$interface\(\): Bits received/
Item C /$interface\(\): Inbound packets discarded/
Item D /$interface\(\): Outbound packets discarded/

The item names in the legend are very long, so I can use a transformation to replace the text by regex.

The regex uses a capture group where I exclude the part of teh n ame starting with Interface Port.*:

Match Interface Port.*: (.*)
Replace $1

I also create a visualization showing the health properties.

Visualization Time Series
Title Health
Data source Zabbix
Query Type Metrics
Group network
Host MikroTik
Item Tag component: network
Item /.\*/

Dashboard Model JSON

Grafana v11.3.0

{
    "annotations": {
        "list": [
            {
                "builtIn": 1,
                "datasource": {
                    "type": "grafana",
                    "uid": "-- Grafana --"
                },
                "enable": true,
                "hide": true,
                "iconColor": "rgba(0, 211, 255, 1)",
                "name": "Annotations & Alerts",
                "type": "dashboard"
            }
        ]
    },
    "editable": true,
    "fiscalYearStartMonth": 0,
    "graphTooltip": 0,
    "id": 40,
    "links": [],
    "panels": [
        {
            "datasource": {
                "type": "alexanderzobnin-zabbix-datasource",
                "uid": "ae2tkrp9nv6yod"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "palette-classic"
                    },
                    "custom": {
                        "axisBorderShow": false,
                        "axisCenteredZero": false,
                        "axisColorMode": "text",
                        "axisLabel": "",
                        "axisPlacement": "auto",
                        "barAlignment": 0,
                        "barWidthFactor": 0.6,
                        "drawStyle": "line",
                        "fillOpacity": 0,
                        "gradientMode": "none",
                        "hideFrom": {
                            "legend": false,
                            "tooltip": false,
                            "viz": false
                        },
                        "insertNulls": false,
                        "lineInterpolation": "linear",
                        "lineWidth": 1,
                        "pointSize": 5,
                        "scaleDistribution": {
                            "type": "linear"
                        },
                        "showPoints": "auto",
                        "spanNulls": false,
                        "stacking": {
                            "group": "A",
                            "mode": "none"
                        },
                        "thresholdsStyle": {
                            "mode": "off"
                        }
                    },
                    "mappings": [],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            },
                            {
                                "color": "red",
                                "value": 80
                            }
                        ]
                    }
                },
                "overrides": []
            },
            "gridPos": {
                "h": 7,
                "w": 24,
                "x": 0,
                "y": 0
            },
            "id": 2,
            "options": {
                "legend": {
                    "calcs": [],
                    "displayMode": "list",
                    "placement": "bottom",
                    "showLegend": true
                },
                "tooltip": {
                    "mode": "single",
                    "sort": "none"
                }
            },
            "pluginVersion": "11.3.0",
            "targets": [
                {
                    "application": {
                        "filter": ""
                    },
                    "countTriggersBy": "",
                    "datasource": {
                        "type": "alexanderzobnin-zabbix-datasource",
                        "uid": "ae2tkrp9nv6yod"
                    },
                    "evaltype": "0",
                    "functions": [],
                    "group": {
                        "filter": "network"
                    },
                    "host": {
                        "filter": "MikroTik"
                    },
                    "item": {
                        "filter": "/.*/"
                    },
                    "itemTag": {
                        "filter": "component: health"
                    },
                    "macro": {
                        "filter": ""
                    },
                    "options": {
                        "count": false,
                        "disableDataAlignment": false,
                        "showDisabledItems": false,
                        "skipEmptyValues": false,
                        "useTrends": "default",
                        "useZabbixValueMapping": false
                    },
                    "proxy": {
                        "filter": ""
                    },
                    "queryType": "0",
                    "refId": "A",
                    "resultFormat": "time_series",
                    "schema": 12,
                    "table": {
                        "skipEmptyValues": false
                    },
                    "tags": {
                        "filter": ""
                    },
                    "textFilter": "",
                    "trigger": {
                        "filter": ""
                    }
                }
            ],
            "title": "Health",
            "type": "timeseries"
        },
        {
            "datasource": {
                "type": "alexanderzobnin-zabbix-datasource",
                "uid": "ae2tkrp9nv6yod"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "mappings": [
                        {
                            "options": {
                                "0": {
                                    "color": "red",
                                    "index": 1,
                                    "text": "DOWN"
                                },
                                "1": {
                                    "color": "green",
                                    "index": 0,
                                    "text": "UP"
                                }
                            },
                            "type": "value"
                        }
                    ],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            }
                        ]
                    }
                },
                "overrides": []
            },
            "gridPos": {
                "h": 6,
                "w": 3,
                "x": 0,
                "y": 7
            },
            "id": 3,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "percentChangeColorMode": "standard",
                "reduceOptions": {
                    "calcs": ["lastNotNull"],
                    "fields": "",
                    "values": false
                },
                "showPercentChange": false,
                "textMode": "auto",
                "wideLayout": true
            },
            "pluginVersion": "11.3.0",
            "repeat": "interface",
            "repeatDirection": "v",
            "targets": [
                {
                    "application": {
                        "filter": ""
                    },
                    "countTriggersBy": "",
                    "datasource": {
                        "type": "alexanderzobnin-zabbix-datasource",
                        "uid": "ae2tkrp9nv6yod"
                    },
                    "evaltype": "0",
                    "functions": [],
                    "group": {
                        "filter": "network"
                    },
                    "host": {
                        "filter": "MikroTik"
                    },
                    "item": {
                        "filter": "/$interface\\(\\): Operational status/"
                    },
                    "itemTag": {
                        "filter": "component: network"
                    },
                    "macro": {
                        "filter": ""
                    },
                    "options": {
                        "count": false,
                        "disableDataAlignment": false,
                        "showDisabledItems": false,
                        "skipEmptyValues": false,
                        "useTrends": "default",
                        "useZabbixValueMapping": false
                    },
                    "proxy": {
                        "filter": ""
                    },
                    "queryType": "0",
                    "refId": "A",
                    "resultFormat": "time_series",
                    "schema": 12,
                    "table": {
                        "skipEmptyValues": false
                    },
                    "tags": {
                        "filter": ""
                    },
                    "textFilter": "",
                    "trigger": {
                        "filter": ""
                    }
                }
            ],
            "title": "$interface",
            "transformations": [
                {
                    "id": "renameByRegex",
                    "options": {
                        "regex": "Interface Port.*:(.*)",
                        "renamePattern": "$1"
                    }
                }
            ],
            "type": "stat"
        },
        {
            "datasource": {
                "type": "alexanderzobnin-zabbix-datasource",
                "uid": "ae2tkrp9nv6yod"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "palette-classic"
                    },
                    "custom": {
                        "axisBorderShow": false,
                        "axisCenteredZero": false,
                        "axisColorMode": "text",
                        "axisLabel": "",
                        "axisPlacement": "auto",
                        "barAlignment": 0,
                        "barWidthFactor": 0.6,
                        "drawStyle": "line",
                        "fillOpacity": 0,
                        "gradientMode": "none",
                        "hideFrom": {
                            "legend": false,
                            "tooltip": false,
                            "viz": false
                        },
                        "insertNulls": false,
                        "lineInterpolation": "linear",
                        "lineWidth": 1,
                        "pointSize": 5,
                        "scaleDistribution": {
                            "type": "linear"
                        },
                        "showPoints": "auto",
                        "spanNulls": false,
                        "stacking": {
                            "group": "A",
                            "mode": "none"
                        },
                        "thresholdsStyle": {
                            "mode": "off"
                        }
                    },
                    "mappings": [],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            },
                            {
                                "color": "red",
                                "value": 80
                            }
                        ]
                    }
                },
                "overrides": []
            },
            "gridPos": {
                "h": 6,
                "w": 21,
                "x": 3,
                "y": 7
            },
            "id": 1,
            "options": {
                "legend": {
                    "calcs": [],
                    "displayMode": "list",
                    "placement": "right",
                    "showLegend": true
                },
                "tooltip": {
                    "mode": "single",
                    "sort": "none"
                }
            },
            "pluginVersion": "11.3.0",
            "repeat": "interface",
            "repeatDirection": "v",
            "targets": [
                {
                    "application": {
                        "filter": ""
                    },
                    "countTriggersBy": "",
                    "datasource": {
                        "type": "alexanderzobnin-zabbix-datasource",
                        "uid": "ae2tkrp9nv6yod"
                    },
                    "evaltype": "0",
                    "functions": [],
                    "group": {
                        "filter": "network"
                    },
                    "host": {
                        "filter": "MikroTik"
                    },
                    "item": {
                        "filter": "/$interface\\(\\): Bits sent/"
                    },
                    "itemTag": {
                        "filter": ""
                    },
                    "macro": {
                        "filter": ""
                    },
                    "options": {
                        "count": false,
                        "disableDataAlignment": false,
                        "showDisabledItems": false,
                        "skipEmptyValues": false,
                        "useTrends": "default",
                        "useZabbixValueMapping": false
                    },
                    "proxy": {
                        "filter": ""
                    },
                    "queryType": "0",
                    "refId": "A",
                    "resultFormat": "time_series",
                    "schema": 12,
                    "table": {
                        "skipEmptyValues": false
                    },
                    "tags": {
                        "filter": ""
                    },
                    "textFilter": "",
                    "trigger": {
                        "filter": ""
                    }
                },
                {
                    "application": {
                        "filter": ""
                    },
                    "countTriggersBy": "",
                    "datasource": {
                        "type": "alexanderzobnin-zabbix-datasource",
                        "uid": "ae2tkrp9nv6yod"
                    },
                    "evaltype": "0",
                    "functions": [],
                    "group": {
                        "filter": "network"
                    },
                    "hide": false,
                    "host": {
                        "filter": "MikroTik"
                    },
                    "item": {
                        "filter": "/$interface\\(\\): Bits received/"
                    },
                    "itemTag": {
                        "filter": ""
                    },
                    "macro": {
                        "filter": ""
                    },
                    "options": {
                        "count": false,
                        "disableDataAlignment": false,
                        "showDisabledItems": false,
                        "skipEmptyValues": false,
                        "useTrends": "default",
                        "useZabbixValueMapping": false
                    },
                    "proxy": {
                        "filter": ""
                    },
                    "queryType": "0",
                    "refId": "B",
                    "resultFormat": "time_series",
                    "schema": 12,
                    "table": {
                        "skipEmptyValues": false
                    },
                    "tags": {
                        "filter": ""
                    },
                    "textFilter": "",
                    "trigger": {
                        "filter": ""
                    }
                },
                {
                    "application": {
                        "filter": ""
                    },
                    "countTriggersBy": "",
                    "datasource": {
                        "type": "alexanderzobnin-zabbix-datasource",
                        "uid": "ae2tkrp9nv6yod"
                    },
                    "evaltype": "0",
                    "functions": [],
                    "group": {
                        "filter": "network"
                    },
                    "hide": false,
                    "host": {
                        "filter": "MikroTik"
                    },
                    "item": {
                        "filter": "/$interface\\(\\): Inbound packets discarded/"
                    },
                    "itemTag": {
                        "filter": ""
                    },
                    "macro": {
                        "filter": ""
                    },
                    "options": {
                        "count": false,
                        "disableDataAlignment": false,
                        "showDisabledItems": false,
                        "skipEmptyValues": false,
                        "useTrends": "default",
                        "useZabbixValueMapping": false
                    },
                    "proxy": {
                        "filter": ""
                    },
                    "queryType": "0",
                    "refId": "C",
                    "resultFormat": "time_series",
                    "schema": 12,
                    "table": {
                        "skipEmptyValues": false
                    },
                    "tags": {
                        "filter": ""
                    },
                    "textFilter": "",
                    "trigger": {
                        "filter": ""
                    }
                },
                {
                    "application": {
                        "filter": ""
                    },
                    "countTriggersBy": "",
                    "datasource": {
                        "type": "alexanderzobnin-zabbix-datasource",
                        "uid": "ae2tkrp9nv6yod"
                    },
                    "evaltype": "0",
                    "functions": [],
                    "group": {
                        "filter": "network"
                    },
                    "hide": false,
                    "host": {
                        "filter": "MikroTik"
                    },
                    "item": {
                        "filter": "/$interface\\(\\): Outbound packets discarded/"
                    },
                    "itemTag": {
                        "filter": ""
                    },
                    "macro": {
                        "filter": ""
                    },
                    "options": {
                        "count": false,
                        "disableDataAlignment": false,
                        "showDisabledItems": false,
                        "skipEmptyValues": false,
                        "useTrends": "default",
                        "useZabbixValueMapping": false
                    },
                    "proxy": {
                        "filter": ""
                    },
                    "queryType": "0",
                    "refId": "D",
                    "resultFormat": "time_series",
                    "schema": 12,
                    "table": {
                        "skipEmptyValues": false
                    },
                    "tags": {
                        "filter": ""
                    },
                    "textFilter": "",
                    "trigger": {
                        "filter": ""
                    }
                }
            ],
            "title": "$interface",
            "transformations": [
                {
                    "id": "renameByRegex",
                    "options": {
                        "regex": "Interface Port.*:(.*)",
                        "renamePattern": "$1"
                    }
                }
            ],
            "type": "timeseries"
        }
    ],
    "preload": false,
    "schemaVersion": 40,
    "tags": [],
    "templating": {
        "list": [
            {
                "current": {
                    "text": "All",
                    "value": "$__all"
                },
                "datasource": {
                    "type": "alexanderzobnin-zabbix-datasource",
                    "uid": "ae2tkrp9nv6yod"
                },
                "definition": "",
                "hide": 2,
                "includeAll": true,
                "name": "interface",
                "options": [],
                "query": {
                    "application": "",
                    "group": "network",
                    "host": "MikroTik",
                    "item": "/.*/",
                    "itemTag": "component: network",
                    "queryType": "item"
                },
                "refresh": 1,
                "regex": "/(Interface Port.*)\\(/",
                "type": "query"
            }
        ]
    },
    "time": {
        "from": "now-1h",
        "to": "now"
    },
    "timepicker": {},
    "timezone": "utc",
    "title": "MikroTik 260GS",
    "uid": "fe4038lnxcqv4c",
    "version": 30,
    "weekStart": ""
}

Comments