LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Server Inventory Bash Script Thoughts... (https://www.linuxquestions.org/questions/linux-server-73/server-inventory-bash-script-thoughts-4175410930/)

Kustom42 06-11-2012 05:15 PM

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.

kbscores 06-12-2012 11:49 AM

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


Kustom42 06-12-2012 04:39 PM

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.


All times are GMT -5. The time now is 05:52 AM.