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

HTTP Content Sensor wih String

Votes:

0

Is it possible to have a sensor like http Content which can handle real Content like Strings.

We have some Status Websites with the following simple text output

Status: [OK] Info: [Everything OK]

Now it would be nice to have a sensor that can handle the two words in [ ] as a channel like the http content sensor. But with that i got an "Unexpected Format: OK" error...

The Info als can have values like "Import of File was not successfully" and so on.

Any solution for this?

http-content-sensor strings unexpected-format

Created on Dec 17, 2014 9:06:52 AM



Best Answer

Accepted Answer

Votes:

2

Now we have created our own "Costum Sensor" with a vbs check Here the vbs file

'GetHTMLSource.vbs

 args = WScript.Arguments.Count

 if args <> 1 then
   Wscript.Echo "usage: GetHTMLSource.vbs URL"
   wscript.Quit
 end if

 URL = WScript.Arguments.Item(0)

 Set WshShell = WScript.CreateObject("WScript.Shell")

 Set http = CreateObject("Microsoft.XmlHttp")
http.open "GET", URL, FALSE
http.send ""
 
 
responseText = http.responseText
 if InStr(http.responseText,"OK") > 0 then
 WScript.Echo "0:" & http.responseText
 Wscript.quit ("0")
 Elseif InStr(http.responseText,"WARNING") > 0 then
 WScript.Echo "1:" & http.responseText
 Wscript.quit ("1")
 Elseif InStr(http.responseText,"CRITICAL") > 0 then
 WScript.Echo "1:" & http.responseText
 Wscript.quit ("2")
Elseif InStr(http.responseText,"UNKNOWN") > 0 then
 WScript.Echo "1:" & http.responseText
 Wscript.quit ("2")
 Else
 WScript.Echo "1:result not valid"
 Wscript.quit ("1")
 End if

Created on Dec 18, 2014 9:27:54 AM

Last change on Dec 18, 2014 9:39:30 AM by  Torsten Lindner [Paessler Support]



3 Replies

Votes:

1

Please look the Sensor "HTTP Advanced Sensor" with the option "Check For Existing Key Words" this should help you. Enable key word check (positive) : In the result returned at the URL, check if a key word exists.

https://www.paessler.com/manuals/prtg/http_advanced_sensor.htm

Hope it helps!

Created on Dec 17, 2014 12:08:22 PM by  Carlos Echeverria (70) 1



Votes:

0

That works.

But with "HTTP Advanced Sensor" it is not possible to Display the Website Output.

I will try it with a costum sensor and a vbs script.

Created on Dec 17, 2014 3:39:52 PM



Accepted Answer

Votes:

2

Now we have created our own "Costum Sensor" with a vbs check Here the vbs file

'GetHTMLSource.vbs

 args = WScript.Arguments.Count

 if args <> 1 then
   Wscript.Echo "usage: GetHTMLSource.vbs URL"
   wscript.Quit
 end if

 URL = WScript.Arguments.Item(0)

 Set WshShell = WScript.CreateObject("WScript.Shell")

 Set http = CreateObject("Microsoft.XmlHttp")
http.open "GET", URL, FALSE
http.send ""
 
 
responseText = http.responseText
 if InStr(http.responseText,"OK") > 0 then
 WScript.Echo "0:" & http.responseText
 Wscript.quit ("0")
 Elseif InStr(http.responseText,"WARNING") > 0 then
 WScript.Echo "1:" & http.responseText
 Wscript.quit ("1")
 Elseif InStr(http.responseText,"CRITICAL") > 0 then
 WScript.Echo "1:" & http.responseText
 Wscript.quit ("2")
Elseif InStr(http.responseText,"UNKNOWN") > 0 then
 WScript.Echo "1:" & http.responseText
 Wscript.quit ("2")
 Else
 WScript.Echo "1:result not valid"
 Wscript.quit ("1")
 End if

Created on Dec 18, 2014 9:27:54 AM

Last change on Dec 18, 2014 9:39:30 AM by  Torsten Lindner [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.