Build waiting , jobs in queue info via api


I would like to build an alarm if too many jobs are in the queue, if the jobs that we have are waiting for specific x minutes. It would be good if it’s possible to get this information as a company wide stat AND a per project stat. This would help us in deciding if we need to upgrade the number of cores -etc.