Hello guys,

I'm working on a simple script to easily collect info about a Linux box for the purposes of discovery/documentation.
I'm attaching my first version if somebody has any comments suggestions, please do talk them out, feel (GPL) free to add to the script but please comment your changes.
Let's see if we can make the piece as useful and generic as possible.

What do you think?


#!/bin/sh
#This script collects info about a machine and prodcues a summary
#Please run as root
#Possible location of installation: /usr/local/bin
#Preferred permissions 700 as it may contain passwords
#Written by Yaman Saqqa abulyomon AT gmail DOT com
#License GPL

#To do list:
#Distro type differentiation
#RPM base vs Debian based for both package mgt and startup scripts

#Apache Conf
#Tomcat Conf
#MySQL DB info

basic() {
        echo
        echo Hostname: `hostname`
        echo Kernel: `uname -r`
        echo
        echo 'CPU(s):'
        cat /proc/cpuinfo | grep 'model name' | cut -d: -f2
        echo
        echo Memory Info
        #Swap shown is Enabled not available
        free -m | grep -E 'Mem|Swap' |  awk '{print $1" "$2"M"}'
}

net() {
        echo
        echo Network Info:
        ifconfig -a | grep -E 'inet|Link' | grep -v inet6 |sed -e 's/Link.*HWaddr/MAC/g' | sed -e 's/^\([^ ]\)/\n\1/g'
        echo
        echo Default Route: `route -n | grep '^0.0.0.0' | awk '{print $2}'`
        echo
}

fs() {

        echo Storage/Filesystem Info:
        #This needs some arrangement
        echo
        echo Physical Disks:
        fdisk -l
        echo
        df -h
        echo
        echo Mounted Filesystems:
        mount | grep -Ev 'proc|sysfs|devpts|tmpfs|usbfs'
        echo
        #Check for LVM/md


}

cron() {

        echo Cronjobs for user `whoami`
        #may be add configuration to collect crons for other users
        echo
        crontab -l
}

basic
net
fs
cron

#EOF

--
abulyomon

www.KiLLTHeUPLiNK.com
_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org

Reply via email to