Linux script checking system information
This script is usually used in scenarios where there are some important changes in the system (replatform, rehost, ...) and we want to make sure that after the change, everything remains the same as before the change.
You need to be the super user or in sudo group before running the script
This script has been tested and works well on Debian 11, CentOS 7, Ubuntu 20.04, Red Hat 8.2
The script supports 3 healthcheck modes: Before - After - Compare.
The script is written with the aim to check some system information of Linux servers (for Application Consistency). It will check the system and then generate the files to save those infomation. It's tasks include:
- OS services: Collect service status: run before shutdown/after start VM
- CPU/RAM/Disk: CPU + RAM in total, Disk in detail
- DNS: Copy & save file /etc/hosts to compare
- Mountpoint: Listing mountpoint & compare with fstab
- Proxy/Internet: Check internet access
- Port status: Show TCP/UDP listening port
- TCP/IP config: Save IPconfig to "ipconfig.txt", save route print to "route.txt"
- Disable personal firewall: Check iptable status
- Show DNS resolve
- Show running processes
- Show environment variables
Run in sequence these commands:
./healthcheck.sh -s before
: Check the system information before any changes../healthcheck.sh -s after
: Check the system information again after the changes../healthcheck.sh -s compare
: Compare the system information before and after the changes.
The -s
flag will indicate the stage we want to run.
Output will be a folder named: hostname-stage-date
(ex: ubuntu-before-20230102)