$username = "admin"
$secure_string_pwd = convertto-securestring "admin" -asplaintext -force
$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,$secure_string_pwd)
$url_rabbit = "http://r01-crm01:15672/api/queues"
try
{
$web_queues = Invoke-WebRequest -Uri $url_rabbit -Method GET -Credential $credentials
$jsn = $web_queues | ConvertFrom-Json
#$jsn.name
$msg_cnt = @{}
foreach ($q in $jsn.name)
{
$json_web = Invoke-WebRequest -Uri "$url_rabbit/%2F/$q" -Method GET -Credential $credentials
$jsnw = $json_web | ConvertFrom-Json
$msg_cnt += @{$q = $jsnw.messages}
}
$msg_cnt
}
catch
{
$_.Exception.Message
}