Last active
October 25, 2017 09:08
-
-
Save uchm4n/fa5537eb4b44ba94f97eb8635861b2bc to your computer and use it in GitHub Desktop.
This is valid for Ubuntu servers
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
#! /usr/bin/env bash | |
# Basic info | |
IP=`hostname -I | awk '{print $1}'` | |
HOSTNAME=`uname -n` | |
#ROOT=`df -Ph | grep xvda1 | awk '{print $4}' | tr -d '\n'` | |
ROOT=`df -Ph | grep vda1 | awk 'NR==1{print $4}' | tr -d '\n'` | |
# System load | |
MEMORY1=`free -t -m | grep Total | awk '{print $3" MB";}'` | |
MEMORY2=`free -t -m | grep "Mem" | awk '{print $2" MB";}'` | |
LOAD1=`cat /proc/loadavg | awk {'print $1'}` | |
LOAD5=`cat /proc/loadavg | awk {'print $2'}` | |
LOAD15=`cat /proc/loadavg | awk {'print $3'}` | |
MYSQL=`ps aux | grep mysqld | awk 'NR==1{print $4}'` | |
APACHE=`ps aux | grep apache2 | awk 'NR==1{print $4}'` | |
echo " | |
=============================================== | |
- IP Address .........: $IP | |
- Hostname............: $HOSTNAME | |
- Disk Space..........: $ROOT remaining | |
=============================================== | |
- CPU usage...........: $LOAD1, $LOAD5, $LOAD15 (1, 5, 15 min) | |
- Memory used.........: $MEMORY1 / $MEMORY2 (Total) | |
- Swap in use.........: `free -m | tail -n 1 | awk '{print $3}'` MB | |
=============================================== | |
- MYSQL usage ........: $MYSQL MB | |
- APACHE usage .......: $APACHE MB | |
=============================================== | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment