New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

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

 

Top Tags


View all Tags


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

Votes:

1

Your Vote:

Up

Down

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 by  Zarate Max (1,632) 5 5



Best Answer

Accepted Answer

Votes:

7

Your Vote:

Up

Down

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 by  Zarate Max (1,632) 5 5

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



5 Replies

Votes:

6

Your Vote:

Up

Down

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 by  PRTG Tools Family [prtgtoolsfamily.com] (12,885) 3 4



Accepted Answer

Votes:

7

Your Vote:

Up

Down

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 by  Zarate Max (1,632) 5 5

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



Votes:

0

Your Vote:

Up

Down

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



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Zarate Max (1,632) 5 5



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.