Send Mail when Saturated Simple Queue

Hello, I want to make a script that sends an email when a certain simple queue is saturated or its icon is red in the list.
I have several scripts that send emails but I can not find the variable that contains this information.
Thank you