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

Is it possible to parse/scrape a custom 404 page with an HTTP sensor?

Votes:

0

We have a need to check if a custom error page is correctly in place for certain servers based on Tomcat. Unfortunately, the HTTP Advanced sensor doesn't seem to get past (ignore) the 404 error and scrape the error page itself for text I'm looking for. I'm guessing the sensor will only parse for text if the page returns a 200.

Background - Security compliance scans will complain if the default Tomcat error page is used.

Is there a solution for this?

Thanks!

http http-advanced prtg

Created on May 28, 2020 5:23:49 PM



3 Replies

Votes:

0

Hi Peter,

You're right here, this article lists all status codes and how the PRTG sensors behave. Do I understand you correctly that you simply want to monitor for status codes? Then, this would help.


Kind regards,
Felix Saure, Tech Support Team

Created on May 29, 2020 9:53:30 AM by  Felix Saure [Paessler Support]



Votes:

0

Thanks for the reply, but no, we aren't monitoring for status codes. We need to scrape the text of the 404 error page, to make sure the default Tomcat error page isn't being used.

We ended up developing a Powershell script to handle this.

try { Invoke-WebRequest https://www.contoso.com/123 } catch { $result = $_.Exception.Response.GetResponseStream() $reader = New-Object System.IO.StreamReader($result) $reader.BaseStream.Position = 0 $reader.DiscardBufferedData() $responseBody = $reader.ReadToEnd(); $responseBody.Contains(“Tomcat”) }

Created on May 29, 2020 3:28:38 PM



Votes:

0

Hi Peter,

I'm afraid this is indeed only possible using a powershell script and custom sensor. The default HTTP sensors cannot be used here. Thank you for sharing your script here!

Created on Jun 1, 2020 6:44:24 AM by  Timo Dambach [Paessler Support]




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.