Last active
December 13, 2015 18:48
-
-
Save gavincarr/4957410 to your computer and use it in GitHub Desktop.
Script to take a quick inventory of a RedHat/CentOS box
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| banner() { | |
| echo | |
| echo '**********************************************************************************************' | |
| echo $* | |
| echo '**********************************************************************************************' | |
| echo | |
| } | |
| run() { | |
| echo "# $*" | |
| $* | |
| echo | |
| } | |
| banner "Inventory for $(hostname)" | |
| banner Disks | |
| run fdisk -cul /dev/sd? | |
| banner Raid | |
| run cat /proc/mdstat | |
| banner LVM | |
| run pvs | |
| run vgs | |
| run lvs | |
| banner Filesystems and Mountpoints | |
| run df -h | |
| run mount | |
| banner Memory | |
| run free -m | |
| run swapon -s | |
| banner Networking | |
| run cat /etc/sysconfig/network | |
| for i in $(grep -li '^ONBOOT=.*yes' /etc/sysconfig/network-scripts/ifcfg-e*); do | |
| run cat $i | |
| done | |
| run ip addr | |
| run ip route | |
| run cat /etc/resolv.conf | |
| banner Services | |
| run chkconfig --list | grep 3:on | |
| banner NTP | |
| run grep ^server /etc/ntp.conf | |
| banner Groups | |
| perl -F: -ane 'print join ":", @F if $F[2] >= 500' /etc/group | |
| echo | |
| banner Users | |
| perl -F: -ane 'print join ":", @F if $F[2] >= 500' /etc/passwd | |
| echo | |
| banner Sudo | |
| run grep ^[%a-z] /etc/sudoers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment