Sign in to follow this  
Purnadi K

'Shell' with 'Power' - DNS response time

Recommended Posts

I never believe the 'virtual' dispute between *nix lovers and UI lovers that has been going on since NT days (with its PDC,BDC concept) and during the days when virtualization was still a highly-guarded confidential technology by the big boys of Unix era (LPAR, LDOM,VPAR) which was boasted to be able to do hardware virtualization and of course with its highly non-sensible price of license as well. IBM was the champion of all with its RISC and Mainframe era, followed by SPARC of the 'sold-off' Sun Microsystem, developed heavily by Fujitsu. Sadly for the big boys, that too-far-fetched technology has become a commodity, common for wide consumers, nowadays. Thanks to virtualization technology running on x86 that makes the seasoned sysadmin and newbie alike to be able to play with used-to-be 'high-level' certified Unix administrator. Exclusivism has become a commonality. 

Back to the dispute...one group say GUI-based system administration is the best tool of all while the other camp, with its exclusivity and probably fear-driven feeling of losing the identity, say the terminal-based administration has no rival. I beg to differ though, and must disagree with both. The best of both worlds is the best (smile)

Therefore there are times text-based system administration is very useful and efficient but on the other hand, throwing terminal for the sake of few clicks on a UI is what a sysadmin should do to enjoy more life.

With that, I would say that introducing PowerShell since some time ago is the right move by Microsoft and it is about time for them to bring up the level of competition.

So much about the past, I actually just would like to inform that in the recent past, our 'creative' Client of a loyal LogicMonitor's customer (whom I should refrain to mention the name since no permission is given to me by the person but quoting his initial 'JJ' will be sufficient I believe, attempted to use PowerShell to do name server lookup. Being a *nix guy for sometime, I was wondering why in the world people do not want to just use nslookup or dig? I hope my client would not get offended and he should not since I was about to give a compliment.

 

Through the simple and raw development of a datasource, I learnt once again that a new thing is not a bad thing and in fact, it brings about a new way of creative thinking and opportunities. Although our Support team, by standard operating procedure, is never responsible to develop datasource and such capability is even beyond the capacity of Support team, but in this exceptional case, the Support team has tried to put a very raw development, however it is not to be taken as official datasource nor a complete and efficient development, but merely for a proof of concept or simple achievement of a purpose.

Improvement has been made based on the original script submitted by our Client as follows:

$DomainControllers = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() | Select-Object -ExpandProperty GlobalCatalogs | Select-Object -Property @{Name="DC";Expression={$_.Name.split('.')[0].ToUpper()}}, Name, IPAddress, SiteName
$FastenalDomain = "fastenal.com"
$Server = "10.0.0.1"
$Prime = (Measure-Command {Resolve-DnsName -Name $FastenalDomain -Server $Server -ErrorAction SilentlyContinue}).Milliseconds
ForEach ($DomainController in $DomainControllers) {
try {
$DNSResponseTime = (Measure-Command {Resolve-DnsName -Name $FastenalDomain -Server $DomainController.IPAddress -ErrorAction Stop}).Milliseconds
}
catch {
$DNSResponseTime = $false
}
Write-Host "$($DomainController.DC)=$DNSResponseTime"
}

So basically what to be achieved is to measure the latency of resolving an [external|internal] domain using several DNS servers (in this case is internal DNS in a customer's domain). The script looked quite complex at first and as we might have known that datasource may need two set of scripts for Active Discovery as well as data Collection, so after some tests and reworks beyond support hours (smile) ...and I need you to imagine the time spent for non-programmers to develop such datasource, is beyond comprehension, but the anti-climax is: it is actually very simple that possibly will take 5 minutes time of a real scripter. Anyway, it is still an achievement nonetheless, so here it is the final product:

Active Discovery (this is querying DNS servers exist in the local domain):

$DomainControllers = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() | Select-Object -ExpandProperty GlobalCatalogs | Select-Object -Property @{Name="DC";Expression={$_.Name.split('.')[0].ToUpper()}}, Name, IPAddress, SiteNameForEach ($DomainController in $DomainControllers) {
    $nsipaddress = $DomainController.IPAddress
    Write-Host "$($nsipaddress)##$($DomainController.DC)"
}
  
return 0

Collection:

$responseTime = (Measure-Command {resolve-dnsname -name fastenal.com -server ##WILDVALUE## -erroraction stop}).milliseconds
Write-Host "$responseTime"

Yes, of course, it is used in Windows Servers environment (I do not even know if *nix has domain controller concept?).....

Cheers.

dns_latency_monitoring.thumb.png.3ee655b111a8b2b412e9412d7d370a42.png

Edited by Purnadi K

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this