Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param($url = "")
- $values = ((Invoke-WebRequest $url) | ConvertFrom-Json)
- $channel = @"
- <result>
- <channel>{0}</channel>
- <value>{1}</value>
- </result>
- "@
- #endregion
- Write-Host "<?xml version='1.0' encoding='UTF-8' ?><prtg>"
- # We can't evaluate those two channels.
- $Values.PSObject.Properties.Remove('date')
- $Values.PSObject.Properties.Remove('site')
- $values | get-member -type NoteProperty | foreach-object {
- $name=$_.Name ;
- $value=$values."$($_.Name)"
- Write-Host ([string]::Format($channel,$name,$value))
- }
- Write-Host "</prtg>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement