Hello Thwack community,
I'm trying to build a PowerShell webscraper that is utilized by the SAM to monitor some XML status pages utilized by Cisco Iron Port. I'm completely new to utilizing SAM but through trial and error what I've been able to come up with is below:
$esa1 = "Some Site"
$c = (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "Some User", ("Some password" | ConvertTo-SecureString -AsPlainText -Force ))
$WebResponse= Invoke-WebRequest -Uri $esa1 -Credential $c
$workQueue= $WebResponse.AllElements | Where {$_.name -eq "msgs_in_work_queue"} | select -expand current
$activeRecipients= $WebResponse.AllElements | Where {$_.name -eq "active_recips"} | select -expand current
Write-Host "Statistics.WorkQueue: $workQueue";
Write-Host "Statistics.ActiveRecipients: $activeRecipients";
exit 0;
When testing it in SW I get the following output:
Output Result:
Get Output Failed:Output: ==============================================
Statistics.WorkQueue: 1
Statistics.ActiveRecipients: 258
Can someone point me in the right direction on where I'm going wrong here? Ideally I want the statistics to be a metric that I can later write an actionable alert for to track different metrics on the device.
Kind Regards,
Chris