- Kernel type and version
- patch level
- disk partition and mount point
- installed software
- IP address
- routing table
- running processors
I tried to developed small script to get these information to one file. before do any change to the server, system administrator can run the script and collect information.
#!/bin/bash
###################################################
# #
# BACKUP SERVER INFO BEFORE PATCHING #
# Version 1.0 #
# Created Date 14/03/2012 #
# Last Modified Date 14/03/2012 #
# INSTRUCTIONS- #
# Log file will save on /home/admin directory #
# file name is server_backup_info.<date>.log #
# example - server_backup_info.14Mar2012.log #
###################################################
echo " Server Information" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo " ++++++++++++++++++">> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "HOSTNAME: " $(hostname) >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "DATE: " $(date) >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "=======================================================" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo " " >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "IP Address information" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
ifconfig -a >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "ROUTING TABLE" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
netstat -rn >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "Kernel Information" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
uname -a >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "Disk information" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
cat /etc/fstab >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "Disk Usage" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
df -h >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "Boot Loader Information" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
cat /boot/grub/menu.lst >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "RPMs" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
rpm -qa >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "Running Processors" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
ps -eaf >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "How Long Server UP and Running" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
uptime >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "Patch Level" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "-------------------------------------------------------" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
cat /etc/SuSE-release >> /home/admin/server_backup_info.`date +%d%b%Y`.log
echo "_______________________________________________________" >> /home/admin/server_backup_info.`date +%d%b%Y`.log
exit 0
This script for SuSE Linux. For other Linux version require to do small changes. And sometimes you need more information to collect.If anyone wants modified script please send comment.