Linux System parameter Statistics script

Source: Internet
Author: User

#!/bin/shClearif[[ $#-eq 0]] Then#Define Variable reset_terminalreset_terminal=$(tput sgr0)#Check OS Typeos=$ (Uname-o) echo-E ' \e[36m '"Operating System Type:" $Reset _terminal $OS#Check OS realease Version and Nameos_name=$ (cat/etc/issue | grep"Server") echo-E ' \e[36m '"Operating System realease Version:" $Reset _terminal $OS _name#Check Architecturearchitecture=$ (Uname-m) echo-E ' \e[36m '"Operating System Architecture:" $Reset _terminal $Architecture#Check Kernel realeasekernel_realease=$ (Uname-R) Echo-E ' \e[36m '"Operating System Kernel realease:" $Reset _terminal $Kernel _realease#Check Hostnamehostname=$(hostname) echo-E ' \e[36m '"Operating System Hostname:" $Reset _terminal $Hostname#Check Internal IPinternal_ip=$ (Hostname-I) echo-E ' \e[36m '"Operating System Internal IP:" $Reset _terminal $Internal _ip#Check External IPexternal_ip=$ (Curl-s http://ipecho.net/Plain) Echo-E ' \e[36m '"Operating System External IP:" $Reset _terminal $External _ip#Check DNS#dns=$ (cat/etc/resolv.conf | grep "/<nameserver[]+" |awk ' {print $NF} ')#echo-e ' \e[36m ' "Operating System DNS:" $Reset _terminal $DNS#Check if connected to the Internet Or not#ping-c2 www.baidu.com &>/dev/null && echo-e ' \e[36m ' "internet:connected" | | echo ' \e[36m ' "Int Ernet:failed "#Check logged in UsersWho >/tmp/Who Echo-E ' \e[36m '"Operating System lgged in Users:" $Reset _terminal&& cat/tmp/Who RM- F/tmp/W.H.O.#Check OS Memory useragesEcho-e ' \e[36m '"Operating System Memory userages:" $Reset _terminal$ (Cat/proc/meminfo | awk '/^memtotal/{memtotal= $}/^memfree/{memfree= $}END{print (Memtotal-memfree)/1024,"M"} ')#Check App Memory useragesEcho-e ' \e[36m '"App Memory userages:" $Reset _terminal$ (Cat/proc/meminfo | awk '/^memtotal/{memtotal= $}/^memfree/{memfree= $}/^buffers/{buffers= $}/^cached/{cached= $}END{print (memtotal-memfree-buffers-cached)/1024,"M"} ')#Check OS loadaverageEcho-e ' \e[36m '"Operating System loadaverage:" $Reset _terminal$ (top-n1b | grep"Load Average"| awk ' {print $ (NF-2) $ (NF-1)$NF} ')#Check CPU useragesEcho-e ' \e[36m '"Operating System CPU userages (us,sy,id):" $Reset _terminal$ (Top-b-N 1 | grep Cpu | awk- F"' {print $, $, $} ')#Check OS diskaverageEcho-e ' \e[36m '"Operating System diskaverage:" $Reset _terminal$ (df-hp | grep-ve"%%|tmpfs"| awk ' {print $, $} ')#Check OS RuntimeEcho-e ' \e[36m '"Operating System Runtime:" $Reset _terminal$ (top-n1b | grep"Load Average"| Awk- F"[ ,]+"' {print $} ') fi

Linux system parameter statistics script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.