I'm trying to create a monitor script, and no matter what I do, I get "Get output failed". Next to this message is the output that was generated, which is exactly the output I was expecting. I'm extremely confused by this. What am I doing wrong?
My script:
$port = $args.get(0)
$url = "http://${Node.DNS}`:$port"
$req = [system.Net.WebRequest]::Create($url)
try {
$res = $req.GetResponse()
}
catch [System.Net.WebException] {
$res = $_.Exception.Response
}
[int]$res.StatusCode
$exitCode = 0
Output:
Output: ==============================================
403