Skip to content

Instantly share code, notes, and snippets.

@harunyardimci
Created August 24, 2015 14:26
Show Gist options
  • Select an option

  • Save harunyardimci/b01c98c2746618363ddb to your computer and use it in GitHub Desktop.

Select an option

Save harunyardimci/b01c98c2746618363ddb to your computer and use it in GitHub Desktop.
# add this to /etc/bashrc or /etc/profile
#------------------------------------------
CPUTIME=$(ps -eo pcpu | awk 'NR>1' | awk '{tot=tot+$1} END {print tot}')
CPUCORES=$(cat /proc/cpuinfo | grep -c processor)
UP=$(echo `uptime` | awk '{ print $3 " " $4 }')
echo "
System Status
Updated: `date`
- Server Name = `hostname`
- OS Version = `cat /etc/redhat-release`
- Load Averages = `cat /proc/loadavg`
- System Uptime = `echo $UP`
- Platform Data = `uname -orpi`
- CPU Usage (average) = `echo $CPUTIME / $CPUCORES | bc`%
- Memory free (real) = `free -m | head -n 2 | tail -n 1 | awk {'print $4'}` Mb
- Memory free (cache) = `free -m | head -n 3 | tail -n 1 | awk {'print $3'}` Mb
- Swap in use = `free -m | tail -n 1 | awk {'print $3'}` Mb
- Disk Space Used = `df / | awk '{ a = $4 } END { print a }'`
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment