1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| #!/bin/bash
clear
if [[ $# -eq 0 ]] then
# Define Variable reset_terminal reset_terminal=$(tput sgr0)
# Check OS Type os=$(uname -o) echo -e '\E[32m' "Check OS Type" $reset_terminal $os
# Check OS Release Version and Name os_name=$(cat /etc/issue|grep -e "Server") echo -e '\E[32m' "Check OS Release Version and Name" $reset_terminal $os_name
# Check Architecture architecture=$(uname -m) echo -e '\E[32m' "Check Architecture" $reset_terminal $architecture
# Check Kernel Release kernel_release=$(uname -r) echo -e '\E[32m' "Check Kernel Release" $reset_terminal $kernel_release
# Check Hostname $HOSTNAME host_name=$(uname -n) echo -e '\E[32m' "Check Hostname" $reset_terminal $host_name
# Check Internal IP internal_ip=$(hostname -I) echo -e '\E[32m' "Check Internal IP" $reset_terminal $internal_ip
# Check External IP external_ip=$(curl -s http://ipecho.net/plain) echo -e '\E[32m' "Check External IP" $reset_terminal $external_ip
# Check DNS name_servers=$(cat /etc/resolv.conf | grep -E "\<nameserver[ ]+" | awk '{print $NF}') echo -e '\E[32m' "Check DNS" $reset_terminal $name_servers
# Check if connected to Internet or not ping -c 2 baidu.com &> /dev/null && echo "Internet:Connected" || echo "Internet:Disconnected" echo -e '\E[32m' "Check if connected to Internet or not" $reset_terminal $ping
# Check Logged In Users who>/tmp/who echo -e '\E[32m' "Logged In Users" && cat /tmp/who rm -f /tmp/who
# Check System Memory Usages system_men_usages=$(awk '/MemTotal/{total=$2}/MemFree/{free=$2}END{print (total-free)/1024}' /proc/meminfo) apps_mem_usages=$(awk '/MemTotal/{total=$2}/MemFree/{free=$2}/^Cached/{cached=$2}/Buffers/{buffers=$2}END{print (total-free-cached-buffers)/1024}' /proc/meminfo)
echo -e '\E[32m' "System Memuserages" $reset_terminal $system_men_usages echo -e '\E[32m' "Apps Memuserages" $reset_terminal $apps_mem_usages
load_average=$(top -n 1 -b | grep "load average:" | awk '{print $12 $13 $14}') echo -e '\E[32m' "load averages" $reset_terminal $load_average
disk_average=$(df -hP | grep -vE 'Filesystem|tmpfs' | awk '{print $1 " " $5}') echo -e '\E[32m' "disk averages" $reset_terminal $disk_average
fi
|