I read a tip the other day that I thought I'd pass on. One gripe that I often hear is that there is no way to retrieve the serial number of a running Sun system. You can get hostid, MAC address and lots of other information; just not the serial number.
The tip offered a very simple, yet elegant, solution to the problem; add the information to the system EPROM data. The entry "oem-banner" is almost never used and works very well for storing whatever text string the administrator chooses to put there.
The author of the tip, who's name I can't find, used the entry for system the serial number but it could be anything you felt significant. It could be an asset tag, system rack location, phone number of the responsible party; i.e. just about anything. Okay, you get the picture now right?
Here's how you do it. You can modify EPROM information via the OBP or the command line.
ok> setenv oem-banner "Serial 123456789"
or
# eeprom oem-banner="Serial 123456789"
You could also put multiple, delimited entries, into that location and write a small script to parse the output of the eeprom command.
# eeprom oem-banner="123456789#23FGY03#3204N"
--- cut here ---
#! /bin/csh -f
# getser
# doug.otto@govstor.com 05/21/2003
#
set id=`/usr/sbin/eeprom | /usr/bin/grep oem-banner | /usr/bin/grep -v ? |
/usr/bin/awk '-F=' '{print $2}'`
set serial=`/usr/bin/echo $id | /usr/bin/awk'-F#' '{print $1}'`
set asset=`/usr/bin/echo $id | /usr/bin/awk '-F#' '{print $2}'`
set loc=`/usr/bin/echo $id | /usr/bin/awk '-F#' '{print $3}'`
set name=`/usr/bin/uname -n`
printf "System name: $name"
printf "--------------------------"
printf "Serial number: $serial"
printf "Asset tag: $asset"
printf "Rack location: $loc"
--- cut here ---
Now we run the script and return our information:
# /tmp/getser
System name: tang
--------------------------
Serial number: 123456789
Asset tag: 23FGY03
Rack location: 3204N
I hope you find this little tidbit as useful as I have and are able to use it to make a sysadmin's life a little simpler.
Note: Copyright © 2001-2003 GovStor LLC. All rights reserved.