Skip to content

Instantly share code, notes, and snippets.

@YarekTyshchenko
Created June 19, 2014 14:12
Show Gist options
  • Save YarekTyshchenko/b0c1621c06a14f49c352 to your computer and use it in GitHub Desktop.
Save YarekTyshchenko/b0c1621c06a14f49c352 to your computer and use it in GitHub Desktop.
<?php
date_default_timezone_set('Europe/London');
$xml_data = @file_get_contents("http://admin:admin@10.150.6.5: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