Here an example if you would like to get the bold part from your example
Load=5262 Conns=6641 Mbps=36.9
# initialize the webclient
$webclient = New-Object Net.WebClient
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
# download the page
$urlDownload = $webclient.DownloadString('http://thisisanexample/lalelu.html')
$cutAfter = ($urlDownload -split 'Conns=')[1]
$cutBefore = ($filterTwice -split ' Mbps=')[0]
Write-Host "<?xml version="1.0" encoding="UTF-8" ?>"
Write-Host "<prtg>"
Write-Host "<result>"
Write-Host "<channel>Conns</channel>"
Write-Host "<value>$filterTwice</value>"
Write-Host "<Unit>Custom</Unit>"
Write-Host "<CustomUnit>Conns</CustomUnit>"
Write-Host "</result>"
Write-Host "</prtg>"
For more information check here: https://prtg.paessler.com/api.htm?tabid=7
Login Name: demo
Password: demodemo
In my example I first split the website output at Conns= taking the second part and then split the result again at 'space'Mbps= taking the first part of the result leaving me behind with the value 6641. (at least in theory...)
You could also do something like "get the next 4 characters after expression Conns=". I would have to google that myself tho...
Hope this helps..
Add comment