LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-11-2012, 05:15 PM   #1
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Server Inventory Bash Script Thoughts...


Hi LQ,


I am writing a bash script to perform pre and post patching collection of server information for the purposes of diagnosing and rolling back anything that may break during a patch. This is going to be used on multiple different server configs most of which are configured in their own proprietary way.

I already have a rough draft created that gets most of the info you would think of, rpms installed, fstab, running procs, etc..

I was looking to see if anyone out there had any thoughts or knew of any pre-existing scripts that I could reference to make my life easier.

Basically, I'm asking if anyone can give me some input on info that should be collected when during a server inventory run just to make sure I don't forget or overlook something.
 
Old 06-12-2012, 11:49 AM   #2
kbscores
Member
 
Registered: Oct 2011
Location: USA
Distribution: Red Hat
Posts: 259
Blog Entries: 9

Rep: Reputation: 32
Which distro are you using?
If RedHat/Centos I recommend following commands:

List of patches:
Code:
[root] # rpm -qa --last
And then gather this info for general configurations/information about system :

For General Configuration Information:
Code:
uname -a
cat /etc/redhat-release
cat /etc/sysctl.conf
cat /etc/fstab
cat /etc/hosts
cat /etc/passwd
cat /etc/group
cat /proc/meminfo
cat /etc/grub.conf
cat /etc/resolv.conf
cat /etc/nsswitch.conf
cat /proc/mdstat
crontab -l
services --status-all
Disk/Fiber Info:
Code:
sfdisk -l /dev/sda
systool -c fc_host -v
systool -c fc_transport -v
mdadm -D /dev/md0
pvdisplay
vgdisplay
lvdisplay
Filesystem/Network/Memory Info:
Code:
df -h 
ifconfig -a
netstat -rnv
free
vmstat
For script you could do something like this:

Code:
for CMD in "
cmd1
cmd2
cmd3 ...etc"
do
echo "##########"
echo "Output from: $CMD"
echo "##########"
(${CMD})
echo ""
done

Last edited by kbscores; 06-12-2012 at 11:54 AM.
 
1 members found this post helpful.
Old 06-12-2012, 04:39 PM   #3
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Original Poster
Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Thanks for the pointers, I had most of the commands in my script already but you definitely highlighted a few that I didn't think about and will work on implementing.

Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help with linux server backup bash script. krogerssolar Linux - Newbie 9 05-08-2012 07:26 PM
need a bash script to connect to ftp server. y0_gesh Programming 2 01-31-2012 11:55 AM
LXer: How To Install OCS Inventory NG Server 2 On CentOS 5.5 LXer Syndicated Linux News 0 01-26-2011 05:00 PM
Bash script server HDD monitoring mele Programming 1 05-19-2009 07:03 AM
Bash script to test if I can SSH to a server? DanHulton Linux - General 2 05-18-2007 01:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration