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


DNS lookup Sensor

Votes:

0

Your Vote:

Up

Down

Hello

is there a sensor in PRTG, which can be added to each device to lookup for the DNS-Entry and / or the IP-address of this device?

Like it is possible with "nslookup".

I will monitor, if there is valid DNS-Entry for several devices.

dns ip lookup

Created on Feb 17, 2017 9:20:30 AM by  uwe kopf (1) 1



2 Replies

Votes:

0

Your Vote:

Up

Down

Dear Uwe,

Thank you very much for your knowledge base post.

I'm sorry but PRTG does not offer such a sensor out-of-the-box. However, you might be able to retrieve the information by writing your own Custom Sensor.

Kind regards,
Sebastian

Created on Feb 17, 2017 1:31:09 PM by  Sebastian Kniege [Paessler Support]



Votes:

1

Your Vote:

Up

Down

Hello!

I found this question and we ended up writing our own custom sensor, which is just a simple PowerShell script. I'll share with the community. I'm not PowerShell expert, but this got the job done - just place it in the special EXE directory outlined in Sebastian's link above and modify as needed.

$DNSName = "www.website.com"
$AllowedIPArray = @("x.x.x.x","y.y.y.y")

Try {
    # NOTE: I use this method vs. the Resolve-DnsName since the output of the cmdlet mixes different object types 
    # (see link below), so it's more work to handle that.
    # https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/14452845-default-resolve-dnsname-object-output-results-in-a
    $DNSResultArray = [System.Net.Dns]::Resolve($DNSName).AddressList
}
# we need to catch the error thrown if DNS lookup fails
Catch {
    write-host "1:DNS Lookup Error"
    exit 1
}

# something is wrong, if more or less than one A record is returned.
if ($DNSResultArray.Count -ne 1) {
    write-host "2:DNS Lookup Error"
    exit 1 # warning
}

if ($AllowedIPArray -notcontains $DNSResultArray) {
    write-host "3:New IP Found " + $DNSResultArray[0].IPAddressToString
    exit 2 # error
}

write-host "0:OK"
exit 0

Created on Apr 3, 2017 8:36:53 AM by  Jeremy Goemaat (10) 1



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.