Hi everyone,
on my Mikrotik I’m trying to write a script that pushs rx/tx bytes of my WAN interface via MQTT to my Node-Red installation that should forward it to Influx to get some Grafana diagrams in the end.
The following code has two issues:
The rx-bytes/tx-bytes should contain the values since the script ran the last time. So I’m trying to reset the counter at the end. But the values are not reset for some reason.
The variables totalTX and totalRX are each separated into 3 digit blocks. This avoids creating a valid json message. I need the digits without spaces. E.g. instead of 133 519 996 it needs to be 133519996.
Sorry I was looking around for a solution for issue 2 for a long time but haven’t found any up to my post. Now few minutes later I figured it out.
But issue one (reset of values doesn’t work) is still there.
Wow that’s so much shorter than my version…and working
Still don’t know why my reset variant isn’t working but I can live with copying your solution Thanks!