MikrotikApi.Normalize (mikrotik_api v0.3.4)
View SourceOptional normalization helpers for turning RouterOS string fields into typed values.
NOTE: Core helpers do not depend on this module. Exporters may choose to use these utilities when building metrics.
Summary
Functions
Convert common string booleans to true/false. Accepts: true/false, "true"/"false", "yes"/"no", "enabled"/"disabled". Returns boolean or the original value if not matched.
Parse rates like "877 Mbps" or "54 Mbps" into integer Mbps. Returns integer Mbps or original value if the unit doesn't match.
Convert float-looking strings (e.g., "-3.14", "1.0e3") to floats. Returns float or original value if parsing fails.
Convert numeric-looking strings (e.g., "-64", "1500") to integers. Returns integer or original value if parsing fails.
Functions
Convert common string booleans to true/false. Accepts: true/false, "true"/"false", "yes"/"no", "enabled"/"disabled". Returns boolean or the original value if not matched.
Parse rates like "877 Mbps" or "54 Mbps" into integer Mbps. Returns integer Mbps or original value if the unit doesn't match.
Convert float-looking strings (e.g., "-3.14", "1.0e3") to floats. Returns float or original value if parsing fails.
Convert numeric-looking strings (e.g., "-64", "1500") to integers. Returns integer or original value if parsing fails.