I am running a simple shell script using jq to get the size of the jenkins build queue.
jq
QUEUE_SIZE=$(curl -s -k http://myjenkinsurl/queue/api/jso