how to get bytes one ip address usage in queue tree php api?

hi
how to get bytes one ip address usage in queue tree php api?
please help
thanks

How would you “manually” get that (from Winbox or CLI)?

(I don’t use queue trees; Just simple queues)

by winbox.

I write this script

:local megssaved
/queue tree
:local bytes [get [find name=“ip 10.253”] bytes];
:set megssaved ($bytes / 1048576);
/log info $megssaved;

it worked for me byte i need get by php api(Net_RouterOS)
thanks

no help?

Sorry. For some reason, I had missed your earlier reply.
(I don’t know why this keeps happening recently…)

So… it would be easiest like:

$util = new RouterOS\Util($client = new RouterOS\Client(...));
$bytes = $util->setMenu('/queue tree')->get('ip 10.253', 'bytes');
$megssaved = $bytes / 1048576;

//If you want to log it, as with the script
$logInfo = new RouterOS\Request('/log info');
$logInfo->setArgument('message',  $megssaved);
$client->sendSync($logInfo);

And on a related note, with your script, the part

:local bytes [get [find name="ip 10.253"] bytes];

can be reduced to

:local bytes [get "ip 10.253" bytes];

(because queues have unique names)

:smiley: thanks…