How Can I get the current traffic (queue or queue tree)

I want to use perl script, or perl API to grep the traffic of a queue.

I only try to get the traffic of the interface with perl API.
and Using Net::SSH to grep “/queue simple print rate” 's data, but nothing return.

Can help me ? Thanks a lot !

what you mean by “grep the traffic of a queue”? actual data that is queued or rate at what data is passing through the queue?

Sorry, I want to get the rate of the queue.

/queue simple print stats