What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. 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:

0

Your Vote:

Up

Down

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 by  hullabaluh (0) 1



4 Replies

Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  hullabaluh (0) 1



Votes:

0

Your Vote:

Up

Down

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:

0

Your Vote:

Up

Down

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 by  hullabaluh (0) 1



Please log in or register to enter your reply.


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.