Last active
May 6, 2016 15:57
-
-
Save ngfw/e3754e645da180eb655b79e8e1c3a47d 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 | |
# | |
# Server Status Script | |
# Version 1 | |
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` | |
- Public IP = `ifconfig | grep inet | head -n 1 | awk '/inet addr/ {gsub("addr:", "", $2); print $2}'` | |
- OS Version = `lsb_release -d | awk {'print $2 " " $3 " " $4'}` | |
- Load Averages = `cat /proc/loadavg` | |
- System Uptime = `echo $UP` | |
- Platform Data = `uname -orpi` | |
- CPU Usage (average) = `echo $CPUTIME / $CPUCORES | bc`% | |
- Memory = `free -m | head -n 2 | tail -n 1 | awk {'print $2'}` Mb | |
- 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 -h | grep '/dev/' | awk {'print $3 "/" $2'}` | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment