What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Custom REST sensor on monitoring call in virtual host of tomcat

Votes:

1

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

custom-rest-sensor host http-header prtg rest

Created on Aug 14, 2020 1:19:17 PM



4 Replies

Votes:

0

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

Created on Aug 17, 2020 12:58:59 PM by  Felix Wiesneth [Paessler Support]



Votes:

0

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

Created on Aug 17, 2020 1:21:11 PM



Votes:

0

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

Created on Aug 18, 2020 11:39:53 AM by  Felix Wiesneth [Paessler Support]



Votes:

2

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

Created on Nov 5, 2020 8:48:21 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.