#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    8
    Rep Power
    0

    some unix system admin questions


    Can anyone answer following questions? Thanks!

    8. Please ignore that artificial line feeds introduced by Word in the following question:
    We have a web log from apache httpd server which can be like:

    128.249.149.23 - - [19/Mar/2002:17:14:06 -0500] "GET
    /entrez/query.fcgi?cmd=Retrieve&db=OMIM&dopt=Detailed&tmpl=dispomimTemplate&list
    _uids=602321 HTTP/1.0" 200 12299 1
    "http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi?SUBMIT=y"
    62.219.219.182 - - [19/Mar/2002:17:14:06 -0500] "GET /corehtml/ncbi_test.css
    HTTP/1.1" 304 - 0 "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=&DB=PubMed"
    62.219.219.182 - - [19/Mar/2002:17:14:21 -0500] "GET
    /entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=10236068&dopt=Abstract
    HTTP/1.1" 200 16082 0
    "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=&DB=PubMed"
    132.239.159.125 - - [19/Mar/2002:17:14:22 -0500] "GET /corehtml/transparent.gif
    HTTP/1.0" 304 - 0
    "http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi?CMD=search&DB=PubMed"
    132.239.159.125 - - [19/Mar/2002:17:14:22 -0500] "GET /corehtml/GoUp2.gif
    HTTP/1.0" 304 - 0
    "http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi?CMD=search&DB=PubMed"
    132.239.159.125 - - [19/Mar/2002:17:14:22 -0500] "GET /entrez/query/gifs/2.gif
    HTTP/1.0" 200 93 0
    "http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi?CMD=search&DB=PubMed"
    18.79.0.32 - - [19/Mar/2002:17:14:22 -0500] "GET
    /entrez/utils/fref.fcgi?http://www.pnas.org/cgi/pmidlookup?v...ll&pmid=937176
    8 HTTP/1.0" 302 318 0
    "http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_ui
    ds=9371768&dopt=Abstract"
    155.41.134.187 - - [19/Mar/2002:17:14:23 -0500] "POST
    /entrez/query.fcgi?SUBMIT=y HTTP/1.1" 200 35998 1
    "http://www4.ncbi.nlm.nih.gov/PubMed/"
    130.207.65.145 - - [19/Mar/2002:17:14:24 -0500] "GET /blast/html/corner_bl.gif
    HTTP/1.0" 200 196 0
    "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Web&LAYOUT=TwoWindows&AUTO_FORM
    AT=Semiauto&PAGE=Nucleotides&NCBI_GI=yes&FILTER=L&HITLIST_SIZE=100&SHOW_OVERVIEW
    =yes&AUTO_FORMAT=yes"
    129.100.249.27 - - [19/Mar/2002:17:14:24 -0500] "GET /corehtml/bkgd.gif
    HTTP/1.0" 304 - 0
    "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=
    11803231&dopt=Abstract"

    The log is huge and updated continuously by the server.
    The problem is to find:
    a) how to roughly estimate the number of requests processed per second.
    b) top ten hosts who send most of the requests to us for last 30 minutes.
    The unix text processing tools like sort, awk, uniq, cut, sed should be used.



    9. How can I check, on a Unix system, the number of network interfaces?



    10. How to find out the IP address and netmask associated with network
    interface?


    11. A user complains that his or her machine has become quite slow, compared to its previous performance. What commands may be used to find why the machine slowed?

    12. How can I check what dynamic libraries are needed to run the particular binary file on linux/solaris?



    13. What's the difference between a system call and library function?
  2. #2
  3. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    110
    The log is huge and updated continuously by the server. The problem is to find:
    a) how to roughly estimate the number of requests processed per second.
    b) top ten hosts who send most of the requests to us for last 30 minutes.
    a) apache comes with a benchmarking utility called ab (man ab will show its man pages) It will tell you what you need to know

    b) There are lots of systems for this sort of stuff. the most common one is Webalizer is probably the most popular and can be found here :http://www.mrunix.net/webalizer/

    9. How can I check, on a Unix system, the number of network interfaces?
    you haven't indicated what flavour of UNIX you are using, but from my Linux knowledge, may I recommend the ifconfig -a command. It will present results as below:

    eth0 Link encap:Ethernet HWaddr 00:E0:18:19:02:7A
    inet addr:10.0.0.5 Bcast:10.255.255.255 Mask:255.0.0.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:274569 errors:10 dropped:0 overruns:0 frame:0
    TX packets:264299 errors:3 dropped:0 overruns:0 carrier:6
    collisions:114 txqueuelen:100
    RX bytes:213639351 (203.7 Mb) TX bytes:28102056 (26.8 Mb)
    Interrupt:9 Base address:0xac00

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:2229 errors:0 dropped:0 overruns:0 frame:0
    TX packets:2229 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:1104682 (1.0 Mb) TX bytes:1104682 (1.0 Mb)


    10. How to find out the IP address and netmask associated with network
    interface?
    see above


    11. A user complains that his or her machine has become quite slow, compared to its previous performance. What commands may be used to find why the machine slowed?
    a useful tool for system load diagnostics is top (man top will show the docs). It indiacates uptime, load average, memory usage and a list of running processes in cpu usage order. You can quickly identify greedy processes and if necessary kill them off, or adjust their 'nice' values etc

    12. How can I check what dynamic libraries are needed to run the particular binary file on linux/solaris?
    unless someone can tell me otherwise, this is the sort of thing that can only be resolved by reading the documentation for the application in question. Usually application docs list any required libraries or installarions, often referring to them as 'dependencies'

    13. What's the difference between a system call and library function?
    A system call is when a piece of code spawns a new process by making a call to the shell. The process might just be a shell sequence, or it might start another application. For example, in the following snippet of PERL code, although it doesn't do anything that you might find usful, there is a system calls on line 7. It uses backtick operators to send a sequesnce of commands to the shell (in this case it cd's to the path specified in $ROOT then collects a list of the contents of that directory.

    #!/usr/bin/perl
    # chris lacy-hulbert
    # October 2002

    $ROOT="/home/root2/sites/";
    chomp($ROOT);
    @sites=`cd $ROOT && ls`;

    $exclude="/home/root2/exclusions";
    open (EXCL, ">>$exclude")|| die "can't list exclusions";
    foreach $site (@sites){
    chomp $site;
    $statspath=$site . "/logs\n";
    print EXCL $statspath;
    }


    A library function is a bit different, because it is usally written in the same language as the calling routine and it doesn't necessarily envoke any child processes.. it is simply a convenient way of modularising code - ie bundle useful functions into a library file and then include that library at the top of any programmes which call the requried functions.

    I hope that's sort of accurate/useful

    christo
    This is me: http://chris.uk.com
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    8
    Rep Power
    0

    Thanks!


    Thank you so much for your reply!
    Bin

IMN logo majestic logo threadwatch logo seochat tools logo