@cryptotaxi247 / netdata / commits / 32d3b4a9f

improve mikrotik-router snmp profile (#20605)

Ilya Mashchenko committed Jun 30, 2025 at 14:35 UTC 32d3b4a9ffcc5a1431f6c9270894adf7061caf24
1 file changed +65 -65
src/go/plugin/go.d/config/go.d/snmp.profiles/default/mikrotik-router.yaml
+65 -65
@@ -1,6 +1,10 @@
1 extends:
2 - _base.yaml
3 - _generic-if.yaml
4 +
5 +sysobjectid:
6 + - 1.3.6.1.4.1.14988.1.*
7 +
8 metadata:
9 device:
10 fields:
@@ -8,8 +12,15 @@ metadata:
12 value: "MikroTik"
13 type:
14 value: "Router"
11 -sysobjectid:
12 - - 1.3.6.1.4.1.14988.1.*
15 +
16 +metric_tags:
17 + - OID: 1.3.6.1.4.1.14988.1.1.4.1.0
18 + symbol: mtxrLicSoftwareId
19 + tag: software_id
20 + - OID: 1.3.6.1.4.1.14988.1.1.4.4.0
21 + symbol: mtxrLicVersion
22 + tag: license_version
23 +
24 metrics:
25 - MIB: MIKROTIK-MIB
26 table:
@@ -63,35 +74,14 @@ metrics:
74 0: 'ok'
75 1: 'loss'
76 metric_tags:
66 - - symbol:
77 + - tag: optical_index
78 + symbol:
79 OID: 1.3.6.1.4.1.14988.1.1.19.1.1.1
80 name: mtxrOpticalIndex
69 - tag: mtxr_optical_index
70 - - symbol:
81 + - tag: optical_name
82 + symbol:
83 OID: 1.3.6.1.4.1.14988.1.1.19.1.1.2
84 name: mtxrOpticalName
73 - tag: mtxr_optical_name
74 - - MIB: MIKROTIK-MIB
75 - symbol:
76 - OID: 1.3.6.1.4.1.14988.1.1.3.6
77 - name: mtxrHlCpuTemperature
78 - description: Temperature near cpu
79 - family: CPU/Temperature/Value
80 - unit: "Cel"
81 - - MIB: MIKROTIK-MIB
82 - symbol:
83 - OID: 1.3.6.1.4.1.14988.1.1.3.10
84 - name: mtxrHlTemperature
85 - description: Temperature at sensor chip
86 - family: Environment/Temperature/Value
87 - unit: "Cel"
88 - - MIB: MIKROTIK-MIB
89 - symbol:
90 - OID: 1.3.6.1.4.1.14988.1.1.3.8
91 - name: mtxrHlVoltage
92 - description: Core voltage
93 - family: Power/Voltage/Core
94 - unit: "V"
85 - MIB: MIKROTIK-MIB
86 table:
87 OID: 1.3.6.1.4.1.14988.1.1.15.1
@@ -100,71 +90,89 @@ metrics:
90 - OID: 1.3.6.1.4.1.14988.1.1.15.1.1.6
91 name: mtxrPOEPower
92 description: Power over ethernet
103 - family: Network/PoE/Power
93 + family: Interface/PoE/Power
94 unit: "W"
95 - OID: 1.3.6.1.4.1.14988.1.1.15.1.1.4
96 name: mtxrPOEVoltage
97 description: Power over ethernet voltage
108 - family: Network/PoE/Voltage
98 + family: Interface/PoE/Voltage
99 unit: "V"
100 - OID: 1.3.6.1.4.1.14988.1.1.15.1.1.5
101 name: mtxrPOECurrent
102 description: Power over ethernet current
113 - family: Network/PoE/Current
103 + family: Interface/PoE/Current
104 unit: "mA"
115 - metric_tags:
116 - - symbol:
117 - OID: 1.3.6.1.4.1.14988.1.1.15.1.1.1
118 - name: mtxrPOEInterfaceIndex
119 - tag: mtxr_poe_interface_index
120 - - symbol:
121 - OID: 1.3.6.1.4.1.14988.1.1.15.1.1.2
122 - name: mtxrPOEName
123 - tag: mtxr_poe_name
124 - - symbol:
125 - OID: 1.3.6.1.4.1.14988.1.1.15.1.1.3
126 - name: mtxrPOEStatus
127 - tag: mtxr_poe_status
105 + - OID: 1.3.6.1.4.1.14988.1.1.15.1.1.3
106 + name: mtxrPOEStatus
107 + description: Power over ethernet status
108 + family: Interface/PoE/Status
109 + unit: "{status}"
110 mapping:
111 1: disabled
112 2: waiting_for_load
113 3: powered_on
114 4: overload
115 + metric_tags:
116 + - tag: poe_interface_index
117 + symbol:
118 + OID: 1.3.6.1.4.1.14988.1.1.15.1.1.1
119 + name: mtxrPOEInterfaceIndex
120 + - tag: poe_name
121 + symbol:
122 + OID: 1.3.6.1.4.1.14988.1.1.15.1.1.2
123 + name: mtxrPOEName
124 +
125 + # CPU hrProcessorTable (https://www.net-snmp.org/docs/mibs/host.html#hrProcessorTable)
126 - MIB: HOST-RESOURCES-MIB
134 - symbol:
135 - OID: 1.3.6.1.2.1.25.3.3.1.2.1
136 - name: cpu.usage
137 - description: Average percentage of time that this processor was not idle
138 - family: CPU/Usage
139 - unit: "%"
127 + table:
128 + OID: 1.3.6.1.2.1.25.3.3
129 + name: hrProcessorTable
130 + symbols:
131 + - OID: 1.3.6.1.2.1.25.3.3.1.2
132 + name: cpu.usage
133 + description: The average, over the last minute, of the percentage of time that this processor was not idle.
134 + family: CPU/Usage
135 + unit: "%"
136 + metric_tags:
137 + - tag: cpu_index
138 + index: 1
139 +
140 + # Storage hrStorageTable (https://www.net-snmp.org/docs/mibs/host.html#hrStorageTable)
141 - MIB: HOST-RESOURCES-MIB
142 table:
143 OID: 1.3.6.1.2.1.25.2.3
144 name: hrStorageTable
145 symbols:
145 - # HOST-RESOURCES-MIB reports storage sizes in "allocation units" rather than bytes.
146 - # The allocation unit size is defined in hrStorageAllocationUnits (1.3.6.1.2.1.25.2.3.1.4).
147 - # MikroTik devices typically use 1024-byte allocation units for all storage types.
148 - # The scale_factor multiplies the raw value by 1024 to convert to bytes.
146 - OID: 1.3.6.1.2.1.25.2.3.1.5
147 name: memory.total
148 description: Total size of the storage in bytes
149 family: Memory/Total
153 - scale_factor: 1024
150 unit: "By"
151 + transform: |
152 + {{- $unit := index .Metric.Tags "rm:storage_alloc_unit" | default "1" -}}
153 + {{- $factor := int64 $unit -}}
154 + {{- setValue .Metric (mul .Metric.Value $factor) -}}
155 - OID: 1.3.6.1.2.1.25.2.3.1.6
156 name: memory.used
157 description: Amount of storage currently allocated in bytes
158 family: Memory/Used
159 - scale_factor: 1024
159 unit: "By"
160 + transform: |
161 + {{- $unit := index .Metric.Tags "rm:storage_alloc_unit" | default "1" -}}
162 + {{- $factor := int64 $unit -}}
163 + {{- setValue .Metric (mul .Metric.Value $factor) -}}
164 metric_tags:
162 - - tag: _mem_index
165 + - tag: mem_index
166 index: 1
164 - - tag: mem
167 + - tag: _mem_desc
168 symbol:
169 OID: 1.3.6.1.2.1.25.2.3.1.3
170 name: hrStorageDescr
171 + - tag: rm:storage_alloc_unit # Needed for transformation
172 + symbol:
173 + OID: 1.3.6.1.2.1.25.2.3.1.4
174 + name: hrStorageAllocationUnits
175 +
176 # Table metrics - Extended health monitoring (multi-sensor support)
177 - MIB: MIKROTIK-MIB
178 table:
@@ -217,11 +225,3 @@ metrics:
225 symbol:
226 OID: 1.3.6.1.4.1.14988.1.1.3.100.1.4
227 name: mtxrHlSensorUnit
220 -
221 -metric_tags:
222 - - OID: 1.3.6.1.4.1.14988.1.1.4.1.0
223 - symbol: mtxrLicSoftwareId
224 - tag: software_id
225 - - OID: 1.3.6.1.4.1.14988.1.1.4.4.0
226 - symbol: mtxrLicVersion
227 - tag: license_version