Created
June 19, 2014 14:12
-
-
Save YarekTyshchenko/b0c1621c06a14f49c352 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Europe/London'); | |
$xml_data = @file_get_contents("http://admin:[email protected]:8161/admin/xml/queues.jsp"); | |
if (!$xml_data) die('No Data'); | |
$xml = simplexml_load_string($xml_data); | |
$result = $xml->xpath("//queues/queue"); | |
foreach ($result as $queue) { | |
$stats = $queue->stats; | |
$name = (string)$queue['name']; | |
$info = array( | |
'name' => $name, | |
'size' => $stats['size'], | |
'consumers' => $stats['consumerCount'], | |
'enqueueCount' => $stats['enqueueCount'], | |
'dequeueCount' => $stats['dequeueCount'] | |
); | |
display($info); | |
} | |
function display($q) { | |
printf( | |
"[%35s] Size: %-10s Enqueued: %-10s Dequeued: %-10s Consumers: %-3s".PHP_EOL, | |
$q['name'], $q['size'], $q['enqueueCount'], $q['dequeueCount'], $q['consumers'] | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment