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

Show the active IP - Web Site ( http\https ) - nslookup

Votes:

1

I have a web site ( http ) access can be done by 3 ip in data center distributed .

I need a sensor that performs the test ( nslookup ) to show the IP address active for the web site.

Example

C:\Users\>nslookup

> server 8.8.8.8 server: google-public-dns-a.google.com Address: 8.8.8.8

> paessler.com Server: google-public-dns-a.google.com Address: 8.8.8.8

Name: paessler.com Address: 62.146.25.20

The sensor show address IP (62.146.25.20) - On my monitor I can show the active IP .

batch custom-script-exe custom-sensor exe-script-sensor f5 http https powershell webserver

Created on May 13, 2015 3:43:51 PM



Best Answer

Accepted Answer

Votes:

7

I created an EXE Sensor to perform the nslookup testing and validating access my web page and passes the information to the sensor.

Sensor Parameter = 1% put the IP address of the server nslookup .

https://www.paessler.com/manuals/prtg/exe_script_advanced_sensor

example :

@echo off 
nslookup server %1 > nul
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup paessler.com %1 ^| find /v "Aliases"') do set dns_result=%%a
if %dns_result%==62.146.25.20 (echo 0:OK - Data Center DE - %dns_result% && EXIT /B 0) 
if %dns_result%==83.169.55.10 (echo 0:OK - Data Center DE - %dns_result% && EXIT /B 0) 
if %dns_result%==74.208.254.20  (echo 1:warning - Data Center US - %dns_result% && EXIT /B 1)
if %dns_result%==%1 (echo 2:Erro - Access site unavailable DNS - %dns_result% && EXIT /B 2)

Created on May 19, 2015 12:24:55 AM

Last change on May 19, 2015 4:46:04 AM by  Felix Saure [Paessler Support]



6 Replies

Votes:

6

Hi Max,

Depending on the exact output of your local nslookup.exe, something like this will do as a batch sensor.

@echo off
for /F "tokens=2" %%a in ('nslookup paessler.com 8.8.8.8') do (
  set value=%%a 
)
echo 0:%value%

It returns the part of the last nslookup.exe output line after the first white space.

In the example above this will be:

0:62.146.25.20

Created on May 17, 2015 3:39:31 PM



Accepted Answer

Votes:

7

I created an EXE Sensor to perform the nslookup testing and validating access my web page and passes the information to the sensor.

Sensor Parameter = 1% put the IP address of the server nslookup .

https://www.paessler.com/manuals/prtg/exe_script_advanced_sensor

example :

@echo off 
nslookup server %1 > nul
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup paessler.com %1 ^| find /v "Aliases"') do set dns_result=%%a
if %dns_result%==62.146.25.20 (echo 0:OK - Data Center DE - %dns_result% && EXIT /B 0) 
if %dns_result%==83.169.55.10 (echo 0:OK - Data Center DE - %dns_result% && EXIT /B 0) 
if %dns_result%==74.208.254.20  (echo 1:warning - Data Center US - %dns_result% && EXIT /B 1)
if %dns_result%==%1 (echo 2:Erro - Access site unavailable DNS - %dns_result% && EXIT /B 2)

Created on May 19, 2015 12:24:55 AM

Last change on May 19, 2015 4:46:04 AM by  Felix Saure [Paessler Support]



Votes:

0

Hi,

I just tried your code, but i'm getting the following error: This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

Could you tell us more about how to set this up?

Created on Jun 6, 2018 8:46:38 AM



Votes:

0

Hello Wouter,

This looks like that the variable got not filled correctly. Did you enter the IP address in the parameter field of the settings of the sensor?

Best regards, Felix

Created on Jun 6, 2018 8:57:55 AM by  Felix Saure [Paessler Support]



Votes:

3

Show the active IP - Web Site ( http\https ) - nslookup

The value of the 1% variable will be added in the EXE / SCRIPT sensor configuration.

In the Parameters field, you must add the IP address (8.8.8.8) of the external DNS server, which will be used to perform the tests.

https://i.imgur.com/zqyAp66.png

In the example I use google's DNS, but you can use others.

DNS GOOGLE - 8.8.8.8

DNS opendns - 208.67.222.222

DNS opendns - 208.67.220.220

SENSOR SETTINGS - EXE/SCRIPT

Parameters If your executable or script file catches command line parameters, you can define them here. You can use placeholders as well.

icon-book-arrows For a full list of all placeholders please see the API documentation: Application Programming Interface (API) Definition)

Note: Please make sure you write the placeholders in quotes to ensure that they are working properly if their values contain blanks. Use single quotation marks ' ' with PowerShell scripts, and double quotes " " with all others. Please enter a string or leave the field empty.

https://www.paessler.com/manuals/prtg/exe_script_sensor https://kb.paessler.com/users/Zarate%20Max

Zarate Max

Created on Jun 6, 2018 2:27:14 PM



Votes:

0

PRTG Manual: DNS v2 Sensor

The DNS v2 sensor monitors a Domain Name System (DNS) server, resolves domain name records, and compares them to a filter.

https://www.paessler.com/manuals/prtg/dns_v2_sensor

Why DNS monitoring matters

https://blog.paessler.com/why-dns-monitoring-matters-and-what-prtg-can-do-for-you

Created on Jul 21, 2021 3:15:51 PM




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.