Advertisement
ujiajah1

server.sh

Oct 18th, 2016
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.54 KB | None | 0 0
  1. #!/bin/bash
  2. JAM=`date +%H`
  3. MENIT=`date +%M`
  4. blue='\e[1;34m'
  5. green='\e[0;23m'
  6. purple='\e[1;35m'
  7. cyan='\e[1;36m'
  8. red='\e[1;31m'
  9. echo -e $purple
  10. echo -e "
  11. _       _____ ______  _     _ _    _    ______         ______  
  12. | |     (_____)  ___ \| |   | \ \  / /  |  ___ \   /\  |  ___ \
  13. | |        _  | |   | | |   | |\ \/ /   | | _ | | /  \ | |   | |
  14. | |       | | | |   | | |   | | )  (    | || || |/ /\ \| |   | |
  15. | |_____ _| |_| |   | | |___| |/ /\ \   | || || | |__| | |   | |
  16. |_______|_____)_|   |_|\______/_/  \_\  |_||_||_|______|_|   |_|
  17.                                                                \n\n";
  18. echo -e $red
  19. echo -e "Sekarang jam" $JAM:$MENIT
  20. echo "++ Perangkat keras "
  21. CPU=`grep "model name" /proc/cpuinfo | head -n 1 | cut -f 2 -d ':'`
  22. RAM=`grep "MemTotal" /proc/meminfo | cut -f 2 -d ':'`
  23. echo " |- CPU : " $CPU
  24. echo " |- RAM : " $RAM
  25. echo "++ Sistem Operasi "
  26. # informasi sistem operasi
  27. OS=`uname -sr`
  28. echo " |- OS : " $OS
  29. echo " |- Shell : " $SHELL --version
  30. echo -n "Waktu system   :"; date
  31. echo -n "Distro Info    :"; lsb_release -a
  32. echo -n "Anda           :"; whoami
  33. echo -n "Banyak pemakai :"; who | wc -l
  34. echo -e $blue
  35.  
  36. # clear the screen
  37. clear
  38.  
  39. while getopts iv name
  40. do
  41.         case $name in
  42.           i)iopt=1;;
  43.           v)vopt=1;;
  44.           *)echo "Invalid arg";;
  45.         esac
  46. done
  47.  
  48. echo "Hai! Hello World"
  49. echo "Check_system_server by PujiErmanto@Hipster_Network"
  50.  
  51. if [[ $# -eq 0 ]]
  52. then
  53. {
  54.  
  55. # Cek Apakah Koneksi Internet Mati atau Tidak
  56. ping -c 1 google.com &> /dev/null && echo -e '\E[32m'"Internet:  Connected" || echo -e '\E[32m'"Internet:  Disconnected"
  57.  
  58. # cek type OS
  59. os=$(uname -o)
  60. echo -e '\E[32m'"Operating System Type :"  $os
  61.  
  62. # Cek Nama Release Version
  63. cat /etc/os-release | grep 'NAME\|VERSION' | grep -v 'VERSION_ID' | grep -v 'PRETTY_NAME' > /tmp/osrelease
  64. echo -n -e '\E[32m'"OS Name :"   && cat /tmp/osrelease | grep -v "VERSION" | cut -f2 -d\"
  65. echo -n -e '\E[32m'"OS Version :"  && cat /tmp/osrelease | grep -v "NAME" | cut -f2 -d\"
  66.  
  67. # Cek Architecture
  68. architecture=$(uname -m)
  69. echo -e '\E[32m'"Architecture :"  $architecture
  70.  
  71. # Cek Kernel Release
  72. kernelrelease=$(uname -r)
  73. echo -e '\E[32m'"Kernel Release :"  $kernelrelease
  74.  
  75. # Cek hostname
  76. echo -e '\E[32m'"Hostname :"  $HOSTNAME
  77.  
  78. # Cek Internal IP
  79. internalip=$(hostname -I)
  80. echo -e '\E[32m'"Internal IP :"  $internalip
  81.  
  82. # Cek DNS
  83. nameservers=$(cat /etc/resolv.conf | sed '1 d' | awk '{print $2}')
  84. echo -e '\E[32m'"Name Servers :"  $nameservers
  85.  
  86. # Cek Logged In Users
  87. who>/tmp/who
  88. echo -e '\E[32m'"Logged In users :"  && cat /tmp/who
  89.  
  90. # Cek RAM and SWAP Usages
  91. free -h | grep -v + > /tmp/ramcache
  92. echo -e '\E[32m'"Ram Usages :"
  93. cat /tmp/ramcache | grep -v "Swap"
  94. echo -e '\E[32m'"Swap Usages :"
  95. cat /tmp/ramcache | grep -v "Mem"
  96.  
  97. # Cek Disk Usages
  98. df -h| grep 'Filesystem\|/dev/sda*' > /tmp/diskusage
  99. echo -e '\E[32m'"Disk Usages :"  
  100. cat /tmp/diskusage
  101.  
  102. # Cek Load Average
  103. loadaverage=$(top -n 1 -b | grep "load average:" | awk '{print $10 $11 $12}')
  104. echo -e '\E[32m'"Load Average :"  $loadaverage
  105.  
  106. # Cek System Uptime
  107. tecuptime=$(uptime | awk '{print $3,$4}' | cut -f1 -d,)
  108. echo -e '\E[32m'"System Uptime Days/(HH:MM) :"  $tecuptime
  109.  
  110. # Remove Temporary Files
  111. rm /tmp/osrelease /tmp/who /tmp/ramcache /tmp/diskusage
  112. }
  113. fi
  114. shift $(($OPTIND -1))
  115. echo -n "Proxy-Server : "; squid -v
  116. while true; do
  117.     read -p "lanjut monitoring server ?" yn
  118.     case $yn in
  119.         [Yy]* ) break;;
  120.         [Nn]* ) exit;;
  121.         * ) echo "jawab yes atau no";;
  122.     esac
  123. done
  124. tail -f /var/log/squid/access.log | ccze
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement