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

Monitoring multiple sites in a load-balanced environment

Votes:

0

I work in a hosted environment where we have multiple servers in a load-balancing farm, each server having nearly 40 sites. I am looking for a way to be able to attach a sensor that behaves like the HTTP sensor, but have it only look at a single server-specific instance of the site. From what I can tell, we can only put the full URL of a site, but this can be troublesome when only one instance of a single site goes down on one of the servers.

Any ideas or input would be appreciated!

http http-sensor prtg

Created on Feb 22, 2012 7:22:16 AM



Best Answer

Accepted Answer

Votes:

9

I resolved this by downloading a windows port of curl and put together the powershell script below.
Then create each sensor based on the “EXE/Script” custom sensor and pass in two parameters:
'%host' pageurl, e.g. '%host' /index.html

PowerShell code:

$hostIP = $args[0]
$url = "http://$hostIP" + $args[1] # expect 2nd argument to have leading slash
$output = $(C:\curl-7.46.0-win64-mingw\bin\curl -i -k $url -H "Host: www.luton.gov.uk" -s)
$status = $output | select-string "HTTP/1.1" 
if ($status -like "*200 OK") { $retval = 0 } else { $retval = 2 }
write-host ("{0}:{1}" -f $retval, $status)

Hope this is helpful to someone

Created on Jan 12, 2016 1:13:59 PM

Last change on Jan 12, 2016 1:44:47 PM by  Luciano Lingnau [Paessler]



8 Replies

Votes:

0

In this case your individual web servers' content must be accessible (additionally) via a direct URL which you can then monitor with PRTG using the HTTP sensors.

Of course, monitoring the individual web servers directly is also a good idea (for example, via WMI or SSH) to make sure all performance measurements are in a desired range.

Created on Feb 22, 2012 1:37:52 PM by  Daniel Zobel [Product Manager]



Votes:

0

Is there a possibility of having an HTTP sensor with GET requests? We have another monitoring product that utilizes this method of being able to do an HTTP check against the IP of one of the load balanced servers, and the following GET request would target the host header of the site.

Example:

HTTP://10.10.10.10 GET / HTTP/1.0^Host:www.mytestsite.com^^

Created on Apr 25, 2012 7:18:16 PM

Last change on Apr 26, 2012 9:22:48 AM by  Daniel Zobel [Product Manager]



Votes:

0

Have you already tried the HTTP Advanced Sensor?

Created on Apr 26, 2012 9:23:56 AM by  Daniel Zobel [Product Manager]



Votes:

0

In the case of the HTTP Advanced Sensor, I don't see a method of customizing a GET request method (I currently use HTTP Advanced Sensor for most of our HTTP monitoring). Would this be something that could be added to a future release?

Created on Apr 26, 2012 3:40:01 PM



Votes:

0

Dear Sam,

using customized GET requests is not possible with the sensors that come with PRTG. For such special request, however, there is the PRTG API which you can use to write your own executable or script. PRTG can run your file and display the returned results in a sensor of the type "EXE/Script".

For detailed information about custom sensors, see PRTG Manual: Custom Sensors.

Created on Apr 27, 2012 8:29:40 AM by  Daniel Zobel [Product Manager]

Last change on Jul 18, 2018 1:37:01 PM by  Brandy Greger [Paessler Support]



Accepted Answer

Votes:

9

I resolved this by downloading a windows port of curl and put together the powershell script below.
Then create each sensor based on the “EXE/Script” custom sensor and pass in two parameters:
'%host' pageurl, e.g. '%host' /index.html

PowerShell code:

$hostIP = $args[0]
$url = "http://$hostIP" + $args[1] # expect 2nd argument to have leading slash
$output = $(C:\curl-7.46.0-win64-mingw\bin\curl -i -k $url -H "Host: www.luton.gov.uk" -s)
$status = $output | select-string "HTTP/1.1" 
if ($status -like "*200 OK") { $retval = 0 } else { $retval = 2 }
write-host ("{0}:{1}" -f $retval, $status)

Hope this is helpful to someone

Created on Jan 12, 2016 1:13:59 PM

Last change on Jan 12, 2016 1:44:47 PM by  Luciano Lingnau [Paessler]



Votes:

0

Hello frankthomas, thank you for sharing!

Created on Jan 12, 2016 1:44:36 PM by  Luciano Lingnau [Paessler]



Votes:

0

I have changed the code of
frankthomas
(thanks for your first input!!!). Now you can use this same script for every url. You have add the url (www.mysite.nu) into the parameters field.

The parameters field should look like this:

%host www.mysite.nu /index.html (or leave blank after "/")
$hostIP = $args[0]
$H = '"Host: ' + $args[1] + '"'
$url = "http://$hostIP" + $args[2] # expect 2nd argument to have leading slash

$output = $(C:\curl-7.53.1-win64-mingw\bin\curl -i -k $url -H $H -s)

$status = $output | select-string "HTTP/1.1" 
if ($status -like "*200 OK") { $retval = 0 } else { $retval = 2 }
write-host ("{0}:{1}" -f $retval, $status)

[int]$v = $retval

if ($v -eq 0) {
  $x=[string]$v+":OK"
  write-host $x
}

ElseIf ($v -eq 2) {
  $x=[string]$v+": NOT OK: " + $args[1] + " [" + $hostIP + "]"
  write-host $x
}

exit $retval

Created on Apr 18, 2017 1:10:33 PM

Last change on Apr 19, 2017 7:49:57 AM by  Luciano Lingnau [Paessler]




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.