DavidBaezDbz / check_www_site_bash.sh

Script in bash. Checks an array of sites to verify if the sites are up, down or if they take a long time to open the site. You can send as optional parameter the time to check the sites, default is 5 seconds. Improve coding https://gist.github.com/DnaX/4597186 Script en bash. Verifica un arreglo de sitios para verificar si los sitios esta arriba, abajo o si se demoran en abrir el sitio . Se puede enviar como parametro opcional el tiempo que se revisa los sitios, por defecto es 5 segundos.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

check_www_site_bash.sh

Started 🚀

Script in bash. Checks an array of sites to verify if the sites are up, down or if they take a long time to open the site. The bash have four (4) parameters:

  • The time to check the sites.
  • Flag to create evidence.
  • Flag only create and send the evidence.
  • Flag to verify the prerequisites.

Improve coding https://gist.github.com/DnaX/4597186

Examples

    bash check_sites_www.sh 60 0 0 0

Checks every 60 seconds without creating tests and don't validate the prerequisites.

    bash check_sites_www.sh 60 1 0 0

Checks every 60 seconds with creating tests and send email with the evidence and don't validate the prerequisites.

    bash check_sites_www.sh 60 1 1 0

Creating tests and send email with the evidence, no monitoring and don't validate the prerequisites.

    bash check_sites_www.sh 60 1 1 1

Creating tests and send email with the evidence, no monitoring validate the prerequisites.

Prerequisites 📋

The script validate the existense of the software:

  1. postfix
  2. curl
  3. mutt
  4. cutycapt
  5. evince
  6. firefox
  7. wget
  8. /mnt/c/DBZ/DBZ/bash/notify-send/wsl-notify-send.exe Remember that the location changes depending on where you are located the software.
  9. qpdf
  10. 7z

POSTIFIX WITH GMAIL

Install postfix, it's important to install and configure POSTFIX after do you try to send the email.

    sudo apt update
    sudo apt-get install postfix

Review the next page, works for me. https://tonyteaches.tech/postfix-gmail-smtp-on-ubuntu/

Second password for you account gmail https://www.youtube.com/watch?v=J4CtP1MBtOE

WSL

Install wsl2 on your windows 11

  1. Run Windows Terminal as administrator.
    wsl --install
  1. Install a GNU/Linux distribution from those available in the Microsoft application store.

Ubuntu 20.04

The tests were on this version

  1. Restart our computer to be able to start the Ubuntu installation.

  2. Running the Ubuntu application and follow the steps

Microsoft Documentation

CURL

Install curl

    sudo apt update
    sudo apt install curl

The command downloads files that are served with FTP, HTTP or HTTPS protocol. It’s an amalgamation of the words World Wide Web and the word get to form wget.

MUTT

Install mutt

    sudo apt update
    sudo apt install mutt

Mutt is a sophisticated text-based Mail User Agent.

CUTYCAPT

Install CUTYCAPT

    sudo apt update
    sudo apt install cutycapt

CutyCapt is a small cross-platform command-line utility to capture WebKit's rendering of a web page into a variety of vector and bitmap formats, including SVG, PDF, PS, PNG, JPEG, TIFF, GIF, and BMP. See IECapt for a similar tool based on Internet Explorer.

http://cutycapt.sourceforge.net/

EVINCE

Install evince

    sudo apt update
    sudo apt install evince

pdf file viewer

FIREFOX -- FIREFOX-ESR

Install FIREFOX

    sudo apt update
    sudo apt install firefox

https://support.mozilla.org/en-US/kb/install-firefox-linux

I have probles with FIREFOX on Ubuntu 22, i install FIREFOX-ESR

sudo apt update && sudo apt upgrade -y
sudo apt install software-properties-common apt-transport-https -y
sudo add-apt-repository ppa:mozillateam/ppa -y
sudo apt-get update
sudo apt install firefox-esr -y
firefox-esr &

For Ubuntu 22.004 https://www.linuxcapable.com/es/how-to-install-firefox-esr-on-ubuntu-22-04-lts/

WGET

Install wget

    sudo apt update
    sudo apt install wget
    wget --version

The command downloads files that are served with FTP, HTTP or HTTPS protocol. It’s an amalgamation of the words World Wide Web and the word get to form wget.

WSL-NOTIFY-SEND

Install wsl-notify-send

wsl-notify-send provides a Windows executable that is intended to be a replacement for the Linux notify-send utility.

https://github.com/stuartleeks/wsl-notify-send

QPDF

Install qpdf

    sudo apt update
    sudo apt install qpdf

QPDF is a program and C++ library for structural, content-preserving transformations on PDF files

https://qpdf.readthedocs.io/en/stable/installation.html

7Z

Install 7z

    sudo apt update
    sudo apt install p7zip-full

Instalación 🔧

Clone my repository and enjoy.

git clone git@github.com:DavidBaezDbz/check_www_site_bash.sh.git

Give permison to the bash

chmod a+x check_sites_www.sh

or execute whit bash command

bash check_sites_www.sh 30 1 0 0

Checks every 30 seconds with creating tests and send email with the evidence.

And the las step, is fill the file email and websitecheck

email

xxxxx@domain.com,xxxxx1@domain.com

websitecheck

https://www.xxxxxx.com
https://www.yyyyyy.com
https://www.dddddd.com
https://www.bbbbbb.com
https://www.zzzzzz.com

Example

bash check_sites_www.sh 20 1 0 0

Checks every 20 seconds with creating tests and send email with the evidence.

Test ⚙️

Example 1

Execute the bash

    bash check_sites_www.sh 60 0 0 1

Checks every 60 seconds without creating tests and check prerequisites.

Check the log

    tail -f logwebstatus.log  

Check the log

tail -f logwebstatus.log | grep FAIL

Example 2

Execute the bash

    bash check_sites_www.sh 60 1 0 0

Checks every 60 seconds with creating tests and send email.

Check the log

    tail -f logwebstatus.log  

Check the log

tail -f logwebstatus.log | grep FAIL

Check the directory of evidence

ll wwwevidence/070822140254/

The last directory is the datetme when you create the evidence

IF YOU HAVE PROBLEMS WITH THE EMAIL

Check the postfix service

sudo service postfix status

If the service is stop state, execute sudo service postfix start

if bash does not send mail, check logs

some commands

mail
# where you set up the postfix records /var/log/postfix.log
tail -f /var/log/postfix.log
#
journalctl -u postfix@-.service

Wiki 📖

You can find out much more about how to use this project in our Wiki

Version 📌

In the fiture a will use SemVer for versioning. For all available versions, see the tags en este repositorio.

Authors ✒️🖇️🛠️

License 📄

Working on this - see the file LICENSE.md for details

Expressions of Gratitude 🎁

  • Tell others about this project 📢
  • Invite for a beer 🍺 or a coffee ☕ to someone on the team..
  • Publicly thanks 🤓.
  • Anything you want.

About

Script in bash. Checks an array of sites to verify if the sites are up, down or if they take a long time to open the site. You can send as optional parameter the time to check the sites, default is 5 seconds. Improve coding https://gist.github.com/DnaX/4597186 Script en bash. Verifica un arreglo de sitios para verificar si los sitios esta arriba, abajo o si se demoran en abrir el sitio . Se puede enviar como parametro opcional el tiempo que se revisa los sitios, por defecto es 5 segundos.


Languages

Language:Shell 100.0%