Hi everybody, The custom REST sensor worked perfectly the last year for us. Now that we need to deploy the same application twice, we started to use virtual hosts of tomcat. I now detected that the custom rest sensor cannot use the custom http header "Host". This makes this sensor now useless and we cannot monitor our api backend anymore.

Has anybody an idea how to overcome this problem? Or is PRTG going to support the host header soon? Why is the host header not supported?

Greetings, Aurel


Article Comments

Hi Aurel,

I'm afraid there is no solution so far.

The only alternative would be the rather old HTTP XML/REST Value Sensor.


Kind regards

Felix Wiesneth - Team Tech Support


Aug, 2020 - Permalink

Dear Felix, I forgot to mention that we use POST for this. It seems the HTTP XML/REST Value Sensor does not permit to specify the HTTP method? Can you tell me why it is not possible to set the Host header for the Custom REST Sensor?

With my kindest regards, Aurel


Aug, 2020 - Permalink

Hi Aurel,

It's not possible to set as custom http header "Host", since the sensor is designed in this way. I'm sorry that I have no more information for you about this.


Kind regards

Felix Wiesneth - Team Tech Support


Aug, 2020 - Permalink

Hi all, I finally managed to make it as an Program/Script (extended) with a PowerShell script:

$ip=$args[0]
$hostheader=$args[1]

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("customheadername", 'customheadervalue')
$headers.Add("Host", $hostheader)
#$headers.Add("Host", 'hostname')

$response = Invoke-RestMethod "http://$($ip):port/url/path/whereever" -Method Post -Headers $headers

$prtgjson = @"
{
          "prtg": {
           "result": [
            {
             "channel": "Duration",
             "value": "$($response.duration)"
            },
            {
             "channel": "ReturnCode",
             "value": "$($response.returnCode)"
            }
           ]
          }
         }
"@

Write-Output $prtgjson

Like this I can call the same IP but check different virtual tomcat hosts.

Kindest regards Aurel


Nov, 2020 - Permalink