Last active
February 26, 2016 06:54
-
-
Save jakimfett/37afcd0df3b96ec5ff8d to your computer and use it in GitHub Desktop.
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 | |
DISKAVAILABLE=$(df / | awk '{ a = $3 } END { print a }'); | |
DISKUSED=$(df / | awk '{ a = $2 } END { print a }'); | |
DISKTOTAL=$((DISKAVAILABLE+DISKUSED)); | |
DISKPERCENTUSED=$(df / | awk '{ a = $5 } END { print a }'); | |
MEMUSE=$(free -m | head -n 2 | tail -n 1 | awk {'print $3'}); | |
MEMTOTAL=$(free -m | head -n 2 | tail -n 1 | awk {'print $2'}); | |
SWAPUSE=$(free -m | head -n 3 | tail -n 1 | awk {'print $3'}); | |
SWAPTOTAL=$(free -m | head -n 3 | tail -n 1 | awk {'print $2'}); | |
# TODO - Execute curl command once per day via cron, cat file here | |
# TODAYSEXCUSE=$(cat ~/.daily_excuse) | |
TODAYSEXCUSE=$(curl -silent http://pages.cs.wisc.edu/~ballard/bofh/bofhserver.pl | grep "The cause of the problem is"| { read x; echo "${x:198}"; }); | |
echo " | |
System Summary (collected `date`) | |
- CPU Usage (average) = `top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}'` | |
- Memory Usage = $MEMUSE/$MEMTOTAL MB | |
- Swap Usage = $SWAPUSE/$SWAPTOTAL MB | |
- System Uptime/Load =`uptime` | |
- Disk Space (MB/GB/%) = `echo $(($DISKUSED/1024))`/`echo $(($DISKTOTAL/1024))` MB Used | `echo $(($DISKUSED/1024/1024))`/`echo $(($DISKTOTAL/1024/1024))` GB Used | `echo $DISKPERCENTUSED` Used | |
- Today's excuse = $TODAYSEXCUSE | |
" > ~/.system_report | |
sysreport() { | |
cat ~/.system_report | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment