#!/bin/ksh ## ## SCRIPT NAME: prtplt_sho_dns_prtrs_IPsort ## ## Where : in $FEDIR/scripts where FEDIR=/apps/nns_com/fea ## ############################################################################## ## PURPOSE: Uses 'nslookup' 'ls' command to show sorted list of NNS printers ## (in the prt.nns.com DNS domain) --- ## sorted by IP-address, rather than by-device-name. ## ## See 'prtplt_sho_dns_prtrs' for sort by-name. ## ## NOTE: This utility shows devices in prt.nns.com domain, but NOT in ## nns.com domain. ## Starting in mid-2000, printers started showing up in the nns.com ## domain instead of the prt.nns.com domain, as DHCP was being ## implemented to recognize printer definitions. ############################################################################## ## CALLED BY: $FEDIR/scripts/prtplt_mgr -> ## $FEDIR/tkGUIs/prtplt_lists ## ## where $FEDIR/scripts/prtplt_mgr is called by 'handytools' command, ## $FEDIR/scripts/handytools -- actually by ## $FEDIR/scripts/handytools.chestdef ## ## and 'prtplt_mgr' is also called by ## the 'screentools' command, $FEDIR/scripts/screentools ## --- actually by $FEDIR/scripts/screentools.chestdef. ## ## Can also be called user $HOME/.auxchestrc files. Example: ## /usr/people/bmo01/.auxchestrc. ## ## Could also be a desktop icon, created by 'Find, File QuickFind' on ## SGI Toolchest. ############################################################################## ## MAINTENANCE HISTORY: ## Written by: Blaise Montandon 27mar2001 Based on ## 'prtplt_sho_dns_hosts_IPsort' ## in $FEDIR/scripts ## Updated by: Blaise Montandon 27mar2001 ############################################################################## if test "$FEDIR" = "" then FEDIR=/apps/nns_com/fea fi ############################################################################## ## WARN USER THAT THIS QUERY WILL TAKE ABOUT 10 SECONDS. ## (I.e. the next popup will be in about 10 secs.) ############################################################################## xconfirm -c -B DISMISS \ -t "This ALL-DNS-devices query will take about 5 secs to complete." \ -font -*-courier-bold-r-normal-*-14-*-*-*-*-*-*-* \ > /dev/null & # -font -adobe-courier-bold-r-normal-*-14-*-*-*-*-*-*-* \ ############################################################################## ## PREP THE NAMES OF THE LIST FILE (AND AN INTERMEDIATE FILE). ############################################################################## . $FEDIR/scripts/set_localoutlist OUTLIST2=${OUTLIST}_2 ############################################################################## ## PREP THE TOP OF THE LIST (A HEADING). ############################################################################## echo "\ ****************** `date '+%Y %b %d %a %T%p %Z'` *************************** SOME PRINTERS ON THE NNS NETWORK, in the 'prt.nns.com' domain -- according to NNS DNS (Domain Name Service), via the 'nslookup' command. Performed on host: `hostname` SORTED BY *IP-ADDRESS*. A description of this list is at the bottom of the list. ------------------------------------------------------------------------ " > $OUTLIST2 ############################################################################## ## GATHER THE LIST CONTENTS -- with nslookup. ############################################################################## ## 'man nslookup' shows: ## ## ls [option] domain [> filename] ## ls [option] domain [>> filename] ## List the information available for domain, optionally creating or ## appending to filename. The default output contains host names and ## their Internet addresses. Option can be one of the following: ## ## -t querytype ## lists all records of the specified type (see querytype below). ## ## -a lists aliases of hosts in the domain. synonym for -t CNAME. ## ## ***>> -d lists all records for the domain. synonym for -t ANY. ## ## -h lists CPU and operating system information for the domain. ## synonym for -t HINFO. ## ## -s lists well-known services of hosts in the domain. synonym for ## -t WKS. ## ## When output is directed to a file, hash marks are printed for every ## 50 records received from the server. ## AND: ## querytype=value ## type=value ## Change the type of information query to one of: ## ## A the host's Internet address. ## ## CNAME the canonical name for an alias. ## ## HINFO the host CPU and operating system type. ## ## MINFO the mailbox or mail list information. ## ## MX the mail exchanger. ## ## NS the name server for the named zone. ## ## PTR the host name if the query is an Internet address, ## otherwise the pointer to other information. ## ## SOA the domain's ``start-of-authority'' information. ## ## TXT the text information. ## ## UINFO the user information. ## ## WKS the supported well-known services. ## ## Other types (ANY, AXFR, MB, MD, MF, NULL) are described in the ## RFC-1035 document. ## (Default = A, abbreviations = q, ty) ############################################################################## ## FOR TESTING: # set -x nslookup > $OUTLIST << ENDofINPUT ls -t A prt.nns.com exit ENDofINPUT ############################################################################## ## ONE COULD GENERATE JUST A LIST of ' A ' RECS and 'CNAME ' recs -- ## but the list would be missing the query-type indicators -- A & CNAME. ############################################################################## ## nslookup > $OUTLIST << ENDofINPUT ## ls -t A prt.nns.com ## ls -t CNAME prt.nns.com ## exit ## ENDofINPUT ############################################################################## ############################################################################## ## EXTRACT & SORT THE LIST. ############################################################################## ## THE EXTRACT eliminates records like ' TXT ' and ' NS ' and ' SOA ' recs. ## Examples: ## T141349-1 TXT "01:00:60:08:90:ad:70" ## eb NS netman4.nns.com ## nns.com. SOA netman1.nns.com netman.nns.com. (30347 900 900 604800 86400) ############################################################################## ## THE SORT sorts by 'record/query-type', then 'host-name'. ############################################################################## # egrep '^ ' $OUTLIST | egrep ' A |CNAME' | sort -k2b,2b -k1,1 | nl >> $OUTLIST2 ## FOR INITIAL DEVELOPMENT: # cat $OUTLIST | nl >> $OUTLIST2 # sort -k2b,2b -k1,1 $OUTLIST | nl >> $OUTLIST2 tail +5 $OUTLIST | egrep '^ ' | \ grep '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | \ awk '{printf ("%-15s %s \n", $2, $1)}' | \ sort -t. -k1n,1n -k2n,2n -k3n,3n -k4.1n,4.3n | nl >> $OUTLIST2 # rm $OUTLIST ## FOR TESTING: # set - ############################################################################## ## PREP THE BOTTOM OF THE LIST (A TRAILER). ############################################################################## echo " ---------------------------------------------------------------------------- INFO IN THIS LIST: This is a list of many hundreds of printer-identifiers -- along with their IP-addresses. This list is sorted by the IP-address. The sort reveals devices grouped essentially by subnets. And this sort can help identify devices with duplicate IP addresses. (IP = Internet Protocol) The device-identifiers are typically company telecomID numbers, used as 'aliases' for Unix (or NT) printer IP addresses. Note: This list was an up-to-date image from the NNS 'prt.nns.com' DNS domain -- at the time indicated in the time-stamp at the top of this list. ------------------------------------------------------------------------ PRINTERS: FOR PRINTERS, the device-identifier if often an NNS Telecomid (or an NNS-assigned 'plotter-queue' name). The IP address is actually the IP address of a 'print server' box/card to which the printer is attached. At NNS, a Telecom ID ###### is often used to make a printer 'queue' name for SGI workstations/hosts by prefixing a building name, like B600_P###### (for HP-language plot files or Postscript files or 'rich text' files) and B600_T###### (used for crude text printouts; automatically adds carriage-returns, and a final form feed, to files, which are assumed to be plain text). ------------------------------------------------------------------------ DEVICE DESCRIPTIONS/LOCATIONS: This list does NOT include *descriptions/locations* of each of these devices. If you need PRINTER LOCATION OR MODEL INFORMATION -- for example, to solve a network problem: You may be able to find descriptions of SOME printers used on the SGI network if you search some SGI host and printer lists in the NNS-SGI print-plot utilities, 'prtplt_mgr' --- available via the 'PrtPlt_Mgr' drawer of the 'HandyTools' toolchest, of the main SGI 'Toolchest'. Otherwise ... Ask a Computer/Network Support person for help, like an SGI, or other Unix, System Administrator (of T05 'Distributed Systems' Support). (If you cannot connect to a Computer/Network Support person, you could call 8-HELP to find an appropriate contact for information on an 'prt.nns.com' device.) ------------------------------------------------------------------------ SOURCE OF THIS LIST: This list comes from the NNS DNS (Domain Name Service) via the 'nslookup' command -- applied to domain 'prt.nns.com'. In particular, this list was generated by running the script $0 on host `hostname` . This query is available via a 'DNS Into' toolchest, which is available via the 'PrtPlt_Mgr' toolchest in the 'HandyTools' or 'Screentools' toolchests --- which are available via the SGI Toolchest. ------------------------------------------------------------------------ UNDER THE COVERS: This list was assembled using the 'nslookup' command with the 'ls -t A' sub-command. Specifically, nslookup > $OUTLIST << ENDofINPUT ls -t A prt.nns.com exit ENDofINPUT followed by an extract (filter) and a re-format and sort and numbering (with 'tail', grep', 'awk', 'sort', 'nl'). For details, see the script $0 For information on the output of 'nslookup', you can type 'man nslookup' in an SGI winterm window. Or you can refer to the 'Man Pages' or 'OnLine Books' (Search option) in the bottom Help drawer of the SGI Toolchest. ********************* END OF LIST OF DEVICE IDENTIFIERS ********************* ************** on the NNS NETWORK, in the 'prt.nns.com' domain ************** " >> $OUTLIST2 ############################################################################## ## SHOW THE LIST (IN A SCROLLABLE TEXT WINDOW). ############################################################################## $FEDIR/scripts/shofil $OUTLIST2 # export SHOFILENAME="$OUTLIST2" # $FEDIR/tkGUIs/shofil.tk & ## FOR TESTING: # set -