Document Manifesto
Let's face it, at one time or another, nearly everyone has wanted to know exactly how aparticular
UNIX box is configured. Typically, it's your manager at 5 p.m. on a Friday. Some siteskeep a database of all workstations, which, though it is cumbersome to build, sure savestime in the long run. The hard part is always the gathering of the data. For example, howmuch memory does a particular host have? Is it using JFS for a file system? Which SCSIaddress is the tape player set to? Is it using NIS? Was it installed with Ignite/UX? Whenwas it installed?
Though these things are easy enough to determine, you will end up spending more than afew minutes running the commands necessary to gather all this information. It might bemuch longer if you've just returned from vacation and can't remember which commands to useto determine these bits of data. This month's column addresses a rather new and verysimple way to gather most of the data you need to answer questions about how a workstationis configured, or gather data about your network to store in a database.
DATA GATHERING
Last month's column was about HP's Ignite/UX product. The print_manifest command ispart of Ignite/UX. As mentioned, Ignite/UX is free, and can be downloaded fromwww.software.hp.com. After installation, print_manifest is in /opt/ignite/bin. Runningthis command takes a minute or so, then it spits out almost 100 lines of systemconfiguration information. This includes data about the installed software and hardware,disk and filesystem layout information, swap configuration, any kernel changes the systemhas compared to the "installation default" kernel and all network configurationparameters. Not a bad list of stuff for one command, wouldn't you say? If the host wasinstalled with Ignite/UX, there will be even more lines of output.
A CLOSER LOOK
Let's look at some of the data found in the output of the command.
First, there are two sections: one titled "System Information," and one thatis really network configuration. It lists the parameter, followed by the value it is setto. For example, here is the hostname line:
Note that the writers of this tool were nice enough to put a colon after the parametername, which makes it easier to parse the output with a script to extract data for adatabase. The other parameters listed in this section include: IP address, subnet mask,gateway IP address, time zone, DNS domain name, DNS IP address, and NIS domain name.
A common request from end users of a machine is "How much memory does ithave?" In the section of output called "System Hardware" you will find itlisted in the format:
along with several other hardware items such as model, processors, LAN hardware ID,software ID, storage devices and all I/O interfaces and the drivers used for them.
Ok, enough of the output, you get the idea. What we have here is a summary of theoutputs from many commands, listed in a coherent manner. A print-out of this command couldhave been handed to your manager about two minutes after the request.
TAILORED OUTPUT
Heck, if you issued print_manifest with the -e and -s options, you could hand an evenprettier report even quicker to management before leaving on Friday afternoon.
The -e option means use PCL control codes in the output so you get things like boldheadings. The -s option means use previously stored data, don't search the system. Thisimplies that manifest data is stored somewhere and can be extracted for output. That istrue since the raw data is stored in the file (by default):/var/opt/ignite/local/manifest/manifest.info. This is the basis for being able tocustomize the output.
Customization is done with the -t option. You supply a template file that uses pcl3formatting commands (many look similar to printf), allowing you to structure the output asdesired. Luckily, there is a sample file in the /var/opt/ignite/local/manifest directorythat you can edit as desired. The sample file is called template.def, though that is apeculiar name for a file that is actually used. Just make a safety copy, then edit away onthe original.
For example, if you want to compress the output by removing all the blank lines, deleteall the lines that contain TEXT with no text after it. If you will be parsing this datawith a program, you might consider speeding things up by removing all leading spaces andremoving all section headers. For example, in the template.def file, the lines:
TEXT System Hardware FORMAT Model: %s\n MODEL |
could be changed to:
which would remove the System Hardware heading and condense the printing of the systemmodel. If you want the default output to remain, but to also have a brief format output,copy template.def to brief.def, then issue print_manifest -t brief.def.
DATA DIVE-IN
Another way to work with this data is to jump straight into the file where it'sactually stored, and ignore the print_manifest command output. The manifest.info file hasa beautifully readable condensed format. For example, here are the first few lines:
OS_REV B.10.20 ARCH 700 SW_ID 2007120498 MODEL 9000/705 RAM 48 LAN 0x080009276AC6 |
Note the MODEL line. The data assigned to this variable is accessed from thetemplate.def file when the output is printed, as seen in the example above. If you weregoing to access this information from a program or script, it would probably be worthaccessing this file directly. It is updated every time print_manifest is run without the-s option.
If you want to gather up information about all the HP-UX machines in your network, youcould base the data gathering on this tool. Once it is installed, or accessible from allhosts, execute it, then have some locally written tool send the data to a central machinefor storing.
Of course, Perl comes to mind for writing the client and server sides of this tool. Youcould also just copy the manifest.info file from all hosts to a single location, naming itafter the host it came from (the poor man's database). This kind of hardware accountingwas recently initiated at my site.
--Fred was last seen installing some "borrowed" memory back to hismanager's workstation.