Stuck with a perl script!
- Issues an NSLOOKUP command 50 consecutive times against a local resource(like you own server name) in your own local DNS server and displays the time prior to the first NSLOOKUP command and after the last NSLOOKUP in order to give a rough estimate of performance. Between each command use the IPCONFIG command with the appropriate parameters to flush your DNS resolver cache so that the server is forced to resolve each request.
i was wondering how i may be able to do this with a script!! |
This perl module may come in handy
http://search.cpan.org/~jhi/Time-HiRes-1.9719/HiRes.pm if you want to execute system commands in perl use system("command"); good luck, j |
Yeah that will help a little bit, but i need help with the nslookup and the ipconfig commands in the script..
|
sth like that? You have to look for the params of the system programs you need and on the way to calculate the difference from the starting time to end of execution...
but maybe I get you wrong? see the man pages man ifconfig man nslookup #!/usr/bin/perl use Time::HiResqw( usleep ualarm gettimeofday tv_interval nanosleep clock_gettime clock_getres clock_nanosleep clock stat ); use strict; my ($i,$start_seconds, $start_microseconds,$end_seconds, $end_microseconds); ($start_seconds, $start_microseconds) = gettimeofday; for ($i=0;$i<50;$i++){ system("nsklookup -params"); system("ifconfig -params"); } ($end_seconds, $end_microseconds) = gettimeofday; |
ok.....do you do this the same way then or what??
- Issues an NSLOOKUP command 50 consecutive times against the DNS name www.amd.com using your own DNS server to resolve the requests. Again, flush the resolver cache between each command and display the elapsed time before the first and after the last NSLOOKUP command. i just plug in my ip address for my server in the script (its vmware...192.168.1.100???? thanks for your help...i am kinda new with this Perl scripting |
little bump to see if anyone else knows how to do that..:(
|
Show us what you've got so far (code) and what happens when you run it.
http://catb.org/~esr/faqs/smart-questions.html |
i dont have anything now!!!! I gave up and wasnt able to do it. Erased it.....i dont know where to begin.... :(
|
You may have to install the HiRes module by typing
sudo cpan Time::HiRes first then exchange thi ip given in nslookup command then run the following script that has to be made executable: #!/usr/bin/perl use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep clock_gettime clock_getres clock_nanosleep clock ); use strict; my ($i,$start_seconds, $start_microseconds,$end_seconds, $end_microseconds); ($start_seconds, $start_microseconds) = gettimeofday; for ($i=0;$i<50;$i++){ system("nslookup 10.49.45.72"); system("ifconfig -a"); } ($end_seconds, $end_microseconds) = gettimeofday; $start_microseconds= "0.".$start_microseconds; $end_microseconds= "0.".$end_microseconds; my $diff = ($end_seconds+$end_microseconds)-($start_seconds+$start_microseconds) ; print "this took $diff seconds \n"; |
Quote:
Even if you want to do ultimately do this in Perl, figuring out the manual shell commands would be a good starting point. Why don't you work on those 1st. Show us what you want to do, & we'll try to help you get them into the script of your choice. |
All times are GMT -5. The time now is 11:25 PM. |