I use JAVA API send command to routeros,
if I input “put [/interface get value-name=rx-byte number=ether5]” in winbox.
I can get download traffice value from ether5
but I send this command in JAVA API, I can’t get anything.
how to get one ether upload or donwload traffice data value in JAVA API
You need to do a print with a query matching the item.
To get the rx-byte, I think you’d also need to add “stats”.
So:
ret.sendCommand("/interface/print\n=stats=\n=.proplist=rx-byte\n?name=ether5");
Alternatively (and BTW I had checked previously, and it appears to work only now, in 6.*), you can do:
ret.sendCommand("/interface/get\n=number=ether5\n=value-name=rx-byte");
P.S. “/put” is pretty much useless in the API, despite its existence - it merely echoes whatever you put as “message”. It might’ve been more useful if at least it outputted it on everyone’s terminals, but alas, no.