Skip to content

Instantly share code, notes, and snippets.

@sahal
Last active August 29, 2015 14:05
Show Gist options
  • Save sahal/c225dbf6515f636e484c to your computer and use it in GitHub Desktop.
Save sahal/c225dbf6515f636e484c to your computer and use it in GitHub Desktop.
Generate very simple server stats using this bash script. Who needs phpSysInfo?
#!/bin/bash
# ./gen-server-stats.sh
# by Sahal Ansari - github.com/sahal
# desc: generates a list of stats on the box you're on. Not as impressive as phpSysInfo.
#
# run it every hour via cron, if you'd like:
# 0 * * * * /home/user/gen-server-stats.sh > /home/user/public_html/stats
# generate "html":
#echo "<pre>"
function stats {
echo \$ "$1"
eval "$1"
echo
}
echo "System Vital: "
stats date
#stats hostname
stats "uname -a"
stats uptime
echo "Hardware Information: "
stats lscpu
#stats "cat /proc/cpuinfo"
stats lspci
stats lsusb
echo "Memory Usage: "
stats "free -m"
echo "Mounted Filesystems: "
stats "df -h --total"
echo "Network Usage: "
stats "ip a"
#stats ifconfig # this will not work if running as a non-root user on Debian
#stats "vnstat -s" # you'll need to install: http://humdi.net/vnstat/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment