Tool
The hostinfo command creates a quick summary of the server at login time. It is especially useful in environments with a lot of servers at different OS levels. The summary looks like this:
--[ hostinfo v0.55-2 ]------------------------------------ Hostname: jrecord4 Current As Of: 08/01/08 09:35:56 Distribution: SUSE Linux Enterprise Server 10 Service Pack: 1 Kernel Version: 2.6.16.46-0.12-default Architecture: i386 IPv4 Address: 137.65.55.73 eth0 (static) IPv4 Address: 192.168.20.20 eth1 (static) Total/Free Memory: 504/8 MB Hard Disk: /dev/sda 8 GB Hard Disk: /dev/sdb 8 GB Hard Disk: /dev/sdc 3 GB User Logged In: uid=0(root) gid=0(root) on pts0 Owner: Jason Record Function: Test Server -----------------------------------------------------------
You can also create an html page with the same information, by running hostinfo -w > info.html.
Installation Instructions
- Remove the previous package
- Download the current hostinfo RPM package
- Install the hostinfo RPM package
- Use the "hi" alias to see the current information
- You can add a "Function" line by creating a single line file called /opt/hostinfo-function.txt
- You can add an "Owner" line with /opt/hostinfo-owner.txt
rpm -e hostinfo
rpm -ivh hostinfo-0.55-2.noarch.rpm
Version 0.55-2
- Added the tty for login
- Added the -i switch for hostinfo to replace the /etc/issue file
- Added free memory
- Added -f to include free disk space. However this only works if the df output includes the same devices as the /proc/partitions.
Version 0.51-8
- Added hostinfo(5)
- Includes all ethernet addresses found
- Added -t and -T sec switches for a timer. The default is 30 seconds with -t.
- Added -f to include free disk space, but this only works for mounted partitions found in /proc/partitions.
- Free memory is not reported along with total memory.
Version 0.30-5
- Added cciss support
- Added a <title> tag to the -w output
- If the network is not configured, an error displayed. The error no longer displays.
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.
Related Articles
User Comments
Slanted towards SLES as root?
Submitted by AndyDeck on 22 January 2008 - 1:46pm.
The app as written appears slanted towards running on SLES as root:for example, the Service Pack entry is blank on OpenSuSE 10.1, and the Hard Disk info from fdisk cannot be filled in by a regular user. There's also a conflict with NoMachine's NX software, apparently - I get errors from NX when hostinfo is set to run in /etc/profile.local that go away when hostinfo is removed.
- Be the first to comment! To leave a comment you need to Login or Register
- Be the first to comment! To leave a comment you need to Login or Register
Slanted towards SLES as root?
Submitted by jrecord on 25 January 2008 - 9:16am.
Yes, it is slanted a bit toward SLES and root. The disk information comes from the fdisk command, which is root only. The service pack is correct on OpenSuSE 10.1, because it does not have a service pack. OpenSuSE 10.3 for example is a different product without any service packs. I am considering a way to get the disk information as a non root user though. Using /proc/partitions for example. Thanks for the feedback!
-jason
- Be the first to comment! To leave a comment you need to Login or Register
Did you find a fix for
Submitted by Anonymous on 12 December 2008 - 9:29pm.
Did you find a fix for this?
Thanks in advance
-Dan Saltman
- Be the first to comment! To leave a comment you need to Login or Register
df -h
Submitted by peterhine on 28 January 2008 - 1:13am.
You could use 'df -h'. it is available to everyone.
eg:
admin@server:~> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 97G 17G 80G 18% /
tmpfs 2.0G 56K 2.0G 1% /dev/shm
/dev/sda1 99M 11M 84M 12% /boot
/dev/evms/DATA 450G 264G 186G 59% /opt/novell/nss/mnt/.pools/DATA
admin 4.0M 0 4.0M 0% /_admin
DATA 118G 87G 31G 75% /media/nss/DATA
SOFTWARE 157G 125G 32G 80% /media/nss/SOFTWARE
MASTER 98G 51G 48G 52% /media/nss/MASTER
- Be the first to comment! To leave a comment you need to Login or Register
df -h
Submitted by jrecord on 28 January 2008 - 11:15am.
Yes it would work. Currently I only pick one disk, and the first disk the OS detects. Really I need to determine what the "Hard Disk" label is going to mean. The intent is to show the size of disk in the server available for use. However, I currently only show the first disk detected by fdisk. What I probably need to do is enhance the script to show all disks and their sizes. If I use /proc/partitions in association with df output, I could probably get what I want. I could also get the information from /proc/parititons, once I figure out how to calculate the number given in the output. I just haven't taken the time yet.
-jason
- Be the first to comment! To leave a comment you need to Login or Register
using /proc/partitions
Submitted by AndyDeck on 19 February 2008 - 9:43am.
This was nagging at me too, so I figured out a method that comes pretty close to producing identical output for non-root users (un-wrap the lines at the "\"):
DISK_SIZE="$(fdisk -l 2>/dev/null
\ | grep ^Disk | egrep 'sda|hda|xvda'
\ | head -1 | awk '{print $2, $3, $4}' | cut -d',' -f1)"
if [ -z $DISK_SIZE]; then
DISK_SIZE="$(egrep 'sda|hda|xvda' /proc/partitions
\ | head -1 | awk '{print $3 *1024/(1000*1000*1000)}')"
DISK_SIZE="$(egrep 'sda|hda|xvda' /proc/partitions
\ | head -1 | awk '{print "/dev/"$4":"}') $DISK_SIZE GB"
fiThen, replace the print statement with this to use the new calculated values:
printf "$ROW_OUT" "Hard Disk:" "$DISK_SIZE" - Be the first to comment! To leave a comment you need to Login or Register
Thanks for the Feedback
Submitted by jrecord on 26 February 2008 - 11:15am.
Thanks everyone for the feedback. The updated version should work out for everyone. Please let me know if you have anymore ideas for it.
- Be the first to comment! To leave a comment you need to Login or Register
partitions at a hp server
Submitted by keutterling on 7 March 2008 - 5:22pm.
Could you change the partions matching regexp to:
'[s,h,xv,c][0-9]?d[a-z,0-9]$'
# cat /proc/partitions
major minor #blocks name
104 0 35561280 cciss/c0d0
104 1 1052226 cciss/c0d0p1
104 2 34507620 cciss/c0d0p2
7 0 4460422 loop0
thx :)
- Be the first to comment! To leave a comment you need to Login or Register
partitions on hp server
Submitted by jrecord on 10 March 2008 - 3:06pm.
Great idea, I've added it to the next release.
- Be the first to comment! To leave a comment you need to Login or Register


10