Bash Script for Summary Count Mysql, Webserver (LINUX)

Bash Script for Summary Count Mysql, Webserver (LINUX)    Kali ini kita akan membahas mengenai bagaimana menghitung jumlah akses mysql, ...

Bash Script for Summary Count Mysql, Webserver (LINUX)

   Kali ini kita akan membahas mengenai bagaimana menghitung jumlah akses mysql, webserver (Apache / Nginx) pada server linux, yang dibuat menggunakan Bash Script & Simple AWK Programing, seperti yang kita ketahui kadang sulit bagi sysadmin/netadmin untuk mengetahui jumlah akses mysql dan webserver pada suatu server tanpa harus login terlebih dahulu ke suatu server (Ribeet meen . . .)

pada kesempatan ini sedikit sharing mengenai Simple Bash Scripting yang dibuat untuk mempermudah Sysadmin dalam proses menghitung jumlah count dari suatu log / port yang digunakan oleh aplikasi menggunakan Distro Base Redhat/Centos
1. Buat Script pengecekan server pada directory yang diinginkan ex : /home/scripting

# mkdir /home/scripting/

# touch /home/scripting/count.sh

2. edit count.sh dengan scripting tersebut

# vi /home/scripting/count.sh

scripting /home/scripting/count.sh
------------------------------------------------------------------------------------------------------
  HTTPDSUM=$(netstat -nat | grep 80 | wc -l  )
  MYSQLDSUM=$(netstat -nat | grep 3306 | wc -l )
  cat <<Endofmessage
  Monitoring Server Production 
  ==========================================
  Total Jumlah Akses HTTPD : $HTTPDSUM
  Total Jumlah Akses MYSQL : $MYSQLDSUM
------------------------------------------------------------------------------------------------------
3. buat juga konfigurasi /home/scripting/kirim.cfg yang akan kita gunakan untuk mempermudah pengiriman informasi space melalui metode pengiriman Email

# touch /home/scripting/kirim.cfg

# vi /home/scripting/kirim.cfg

scripting /home/scripting/kirim.cfg
------------------------------------------------------------------------------------------------------
/bin/sh /home/scripting/count.sh > test.txt
/bin/mail -s "MONITORING SERVER PRODUCTION" "wahyubudiprastowo@gmail.com" < test.txt
------------------------------------------------------------------------------------------------------

4. Jrengg jrenggg, sekarang sudah selesai kita buat sekarang tinggal system schedulingnya saja yang akan kita setting menggunakan Crontab dengan penjadwalan pengecekan akan dilakukan setiap 15 menit

# crontab -e

------------------------------------------------------------------------------------------------------
*/15 * * * * /home/scripting/kirim.sh
------------------------------------------------------------------------------------------------------
5. done, jika menggunakan log dan grep bydate, kita dapat custom scripting seperti ex :
------------------------------------------------------------------------------------------------------
HTTPDSUM=$(cat /var/log/messages | grep "$(date '+%b %d')" | grep xxxx | wc -l  )
------------------------------------------------------------------------------------------------------

COMMENTS

Name

Android,5,Apache,3,Bash Scripting,5,Bot,1,Centos,12,Cisco,5,GNS3,1,Hacking,5,internet marketing,1,Mikrotik,4,Monitoring,2,Nginx,2,Paket Tracer,2,Squid Proxy,2,Tips And Tricks,1,Virtualization,1,Webmin,2,Webserver,4,
ltr
item
Berbagi Itu Indah: Bash Script for Summary Count Mysql, Webserver (LINUX)
Bash Script for Summary Count Mysql, Webserver (LINUX)
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBBmHE72CZQfavzPDoZtNDbxpJnJ4z2fSEJ2a0CMniDg22S6UmhxN4rER-R_tted39lQNWSnz9T6U40_836E5YaM3yDI1TgmUlXoaEyr2Kjb7IRPLsuM3Ei03B8jVVt9WmZyn6sL6Cftjr/s320/blank_computer_screen.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBBmHE72CZQfavzPDoZtNDbxpJnJ4z2fSEJ2a0CMniDg22S6UmhxN4rER-R_tted39lQNWSnz9T6U40_836E5YaM3yDI1TgmUlXoaEyr2Kjb7IRPLsuM3Ei03B8jVVt9WmZyn6sL6Cftjr/s72-c/blank_computer_screen.png
Berbagi Itu Indah
https://wahyubud.blogspot.com/2013/05/bash-script-for-summary-count-mysql.html
https://wahyubud.blogspot.com/
https://wahyubud.blogspot.com/
https://wahyubud.blogspot.com/2013/05/bash-script-for-summary-count-mysql.html
true
4332986676755765585
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy