system general information


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting system general information
# 1  
Old 04-02-2007
Bug system general information

hi
I am new to this forum. hope to get help from u all.
how can i write these by using shell programming?
1. The name of the machine and the date/time at which the report was produced.
2. Licensing information such as the operating system revision level and license restrictions in terms of user numbers
3. When was the system last rebooted.

thank u
# 2  
Old 04-02-2007
Here's one script, I found it somewhere in the net, long time ago...
It gengerates HTML report for most of the important system files. See the usage at the start of the script. It works for RHEL, FC*; you need to be root to execute this, also, you may add any system env as per your wishes.

Code:
#!/bin/bash
# Description: Linux System Information Report in HTML format
# Usage: script-name > /var/www/html/report.html

cat << HEAD
<HTML>
<HEAD><TITLE>System Report</TITLE></HEAD>
<BODY bgcolor="#c0c0c0" text="#000000">
<HR size=5>
<P>
<H1>System Report for "
HEAD
echo `hostname`

cat << BODY1
"</H1>
<P>
<HR size=5>
<P>
BODY1

cat << HOSTNAME
<H3>OS System Configuration:</H3>
<B>hostname: </B> 
HOSTNAME
/bin/hostname

cat << RELEASE
<P>
<B>OS Release: </B> 
RELEASE
/bin/cat /etc/*-release

cat << HOSTID
<P>
<B>hostid: </B> 
HOSTID
/usr/bin/hostid

cat << UNAMEO
<P>
<B>Kernel OS: </B>
UNAMEO
uname --operating-system

cat << UNAMER
<P>
<B>Kernel release: </B>
UNAMER
uname --kernel-release

cat << UNAMEV
<P>
<B>Kernel version: </B>
UNAMEV
uname --kernel-version

cat << UNAMEK
<P>
<B>Harware Platform: </B>
UNAMEK
uname --hardware-platform

cat << UNAMEPM
<P>
<B>Processor Architecture: </B>
UNAMEPM
uname --processor

cat << CHKCONFIG
<P>
<B>System services: (chkconfig)</B> 
<DL><DD>
<SMALL>
<PRE>
CHKCONFIG
/sbin/chkconfig --list|grep on
cat << CHKCONFIGEND
</PRE>
</SMALL>
</DL>
<P>
CHKCONFIGEND

cat << CRONTAB
<P>
<B>File: <TT>/etc/crontab</TT></B> 
<DL><DD>
<SMALL>
<PRE>
CRONTAB
cat /etc/crontab
cat << CRONTABEND
</PRE>
</SMALL>
</DL>
<P>
CRONTABEND

echo "<P><HR><P>"
echo "<H3>Network Configuration:</H3>"

cat << HOSTS
<P>
<B>File: <TT>/etc/hosts</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
HOSTS
cat /etc/hosts
cat << HOSTSEND
</PRE>
</SMALL>
</DL>
<P>
HOSTSEND

cat << SWITCH
<B>File: <TT>/etc/nsswitch.conf</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
SWITCH
cat /etc/nsswitch.conf
cat << SWITCHEND
</PRE>
</SMALL>
</DL>
<P>
SWITCHEND

cat << RESOLV
<B>File: <TT>/etc/resolv.conf</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
RESOLV
cat /etc/resolv.conf

cat << RESOLVEND
</PRE>
</SMALL>
</DL>
<P>
RESOLVEND

cat << IFCONFIG
<B>ifconfig: </B> 
<DL><DD>
<SMALL>
<PRE>
IFCONFIG
/sbin/ifconfig
cat << IFCONFIGEND
</PRE>
</SMALL>
</DL>
<P>
IFCONFIGEND

cat << ROUTE
<B>/sbin/route: </B> 
<DL><DD>
<SMALL>
<PRE>
ROUTE
/sbin/route
cat << ROUTEEND
</PRE>
</SMALL>
</DL>
<P>
ROUTEEND

if [[ -r /etc/sysconfig/network ]];
then
cat << IFCFGN
<B>Network Configuration File: <TT>/etc/sysconfig/network</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
IFCFGN
cat /etc/sysconfig/network
cat << IFCFGENDN
</PRE>
</SMALL>
</DL>
<P>
IFCFGENDN
fi

cat << IFCFG
<B>Files <TT>/etc/sysconfig/network-scripts/ifcfg-eth*</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
IFCFG
cat /etc/sysconfig/network-scripts/ifcfg-eth*
cat << IFCFGEND
</PRE>
</SMALL>
</DL>
<P>
IFCFGEND

echo "<P><HR><P>"

if [[ -r /etc/mail/local-host-names || -r /etc/sendmail.cw || -r /etc/aliases || -r /etc/mail/virtusertable ]];
then
echo "<H3>Mail Server Configuration:</H3>"

if [[ -r /etc/mail/local-host-names ]];
then
# Redhat 7.1 - Fedora Core X
cat << SENMAILCFGN2
<B>Mail Hosts File: <TT>/etc/mail/local-host-names</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
SENMAILCFGN2
cat /etc/mail/local-host-names
cat << SENMAILCFGN2
</PRE>
</SMALL>
</DL>
<P>
SENMAILCFGN2

elif [[ -r /etc/sendmail.cw ]];
then
# Redhat 6.x
cat << SENMAILCFGN
<B>Mail Hosts File: <TT>/etc/sendmail.cw</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
SENMAILCFGN
cat /etc/sendmail.cw
cat << SENMAILCFGN
</PRE>
</SMALL>
</DL>
<P>
SENMAILCFGN
fi

if [[ -r /etc/mail/virtusertable ]];
then
cat << SENMAILCFGV
<B>Sendmail Virtual Table File: <TT>/etc/mail/virtusertable</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
SENMAILCFGV
cat /etc/mail/virtusertable
cat << SENMAILCFGV
</PRE>
</SMALL>
</DL>
<P>
SENMAILCFGV
fi

if [[ -r /etc/aliases ]];
then
cat << SENMAILCFGN
<B>eMail Aliases File: <TT>/etc/aliases</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
SENMAILCFGN
cat /etc/aliases
cat << SENMAILCFGN
</PRE>
</SMALL>
</DL>
<P>
SENMAILCFGN
fi

fi

echo "<P><HR><P>"

cat << DF
<H3>Storage:</H3>
<B>df -k: </B>
<DL><DD>
<SMALL>
<PRE>
DF
df -k
cat << DFEND
</PRE>
</SMALL>
</DL>
<P>
DFEND

cat << FDISK
<B>Disk Partitions: <TT>/sbin/fdisk -l</TT>:</B>
<DL><DD>
<SMALL>
<PRE>
FDISK
/sbin/fdisk -l
cat << FDISKEND
</PRE>
</SMALL>
</DL>
<P>
FDISKEND

cat << FSTAB
<B>File: <TT>/etc/fstab</TT>: </B> 
<DL><DD>
<SMALL>
<PRE>
FSTAB
cat /etc/fstab
cat << FSTABEND
</PRE>
</SMALL>
</DL>
FSTABEND

echo "<P><HR><P>"

cat << HARDWARE
<H3>Hardware Configuration:</H3>
<B>CPU info: </B> 
<DL><DD>
<SMALL>
<PRE>
HARDWARE
cat /proc/cpuinfo

cat << SWAP
</PRE>
</SMALL>
</DL>
<P>
<B>Total Swap Memory: </B> 
<DL><DD>
SWAP
grep SwapTotal: /proc/meminfo


cat << MEM
</DL>
<P>
<B>System Memory: </B> 
<DL><DD>
MEM
grep MemTotal /proc/meminfo
cat << MEMEND
</DL>
<P>
MEMEND

cat << PCI
<B>/sbin/lspci: </B> 
<DL><DD>
<SMALL>
<PRE>
PCI
/sbin/lspci
cat << PCIEND
</PRE>
</SMALL>
</DL>
<P>
PCIEND

cat << HWCONF
<B>Devices:</B>
<DL><DD>
<B>File: <TT>/etc/sysconfig/hwconf</TT></B> 
<SMALL>
<PRE>
HWCONF
cat /etc/sysconfig/hwconf
cat << HWCONFEND
</PRE>
</SMALL>
</DL>
<P>
HWCONFEND


cat << BODYEND
<P>
<HR>
<P>
</BODY>
</HTML>
BODYEND


Last edited by sysgate; 04-02-2007 at 10:03 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

General Terminology related to the UNIX System

Hello, I am relatively new to the world of programming in general and to the UNIX System in particular. I have a bunch of theoretical questions related to terminology which I have come across in my coursebooks. I hope I post my question at the right place. Any help would be warmly welcome! ... (1 Reply)
Discussion started by: feliks0
1 Replies

2. HP-UX

HP-UX system information

Hi, I'm writing a script to display a lot of information which describe a server (OS distrib, release, Hardware platform, CPU, HD, S/N...). For Linux side it is ok as you have almost all the information in /proc/cpuinfo, /proc/meminfo... and you can use dmidecode but for HP-UX I didn't find... (13 Replies)
Discussion started by: biker007fr
13 Replies

3. HP-UX

System Information

How do I get the system information on a HP UNIX server. details like CPU speed, number of processors etc. (4 Replies)
Discussion started by: Olamide
4 Replies

4. What is on Your Mind?

Some Sweeping, General Information from AT&T

Click here. (5 Replies)
Discussion started by: Perderabo
5 Replies

5. UNIX for Dummies Questions & Answers

How do I find out general system info?

How can I find out what type of processor, and speed, along with memory info such as RAM and storage. Also how do I scrollup on the shell? (2 Replies)
Discussion started by: AllyJones
2 Replies

6. UNIX for Dummies Questions & Answers

Looking for a general purpose System Monitor

Does anyone have any scripts or suggestions on a general purpose Unix/Linux monitoring tool? (5 Replies)
Discussion started by: darthur
5 Replies

7. UNIX for Dummies Questions & Answers

AIX System information

Hi All, I am new to Unix and am working on AIX ( rs6000 ). I am looking for the system info of the unix box like 1. Number of CPUs 2. CPU speed 3. RAM size Your help is much appreciated Thanks rao. (6 Replies)
Discussion started by: rao
6 Replies
Login or Register to Ask a Question

Featured Tech Videos