Hi,
I have a bit of a complicated problem... or it is possible it is quite simple and I'm making it complicated.
The end result I am after is I want to set a sensor that can detect when it gets an http response code of 200 (good) and send a warning notification when it gets anything but the 200 response.
The steps I have taken so far:
First, I have a HTTP Advanced sensor set to go get a token from a url and store that token in a log file. This part works fine.
Next, I have made an EXE sensor with a powershell script:
$token = Get-Content 'C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)\Result of Sensor 2109-A.txt'
$url= "blahblah" <-- this accepts the $token value and makes a valid url that returns what I want it to.
$request = [System.Net.WebRequest]::Create($url)
$response = $request.GetResponse()
[int]$response.StatusCode
$response.Close()
This does get me an end result of 200 in powershell when the site is working, but when the sensor runs the script it tells me the following:
Response not wellformed: "(200 )" (code: PE132)
I have the value channel set to look at the prtg.standardlookups.http.statuscode in an attempt to have the 200 be accepted, but it doesn't seem to help.
I'm at a bit of a loss here because I'm not a programmer and my powershell experience is pretty limited as well. Any help would be greatly appreciated.
Thanks.
Add comment