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
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.
The script validate the existense of the software:
- postfix
- curl
- mutt
- cutycapt
- evince
- firefox
- wget
- /mnt/c/DBZ/DBZ/bash/notify-send/wsl-notify-send.exe Remember that the location changes depending on where you are located the software.
- qpdf
- 7z
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
Install wsl2 on your windows 11
- Run Windows Terminal as administrator.
wsl --install
- Install a GNU/Linux distribution from those available in the Microsoft application store.
The tests were on this version
-
Restart our computer to be able to start the Ubuntu installation.
-
Running the Ubuntu application and follow the steps
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.
Install mutt
sudo apt update
sudo apt install mutt
Mutt is a sophisticated text-based Mail User Agent.
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/
Install evince
sudo apt update
sudo apt install evince
pdf file viewer
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/
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.
Install wsl-notify-send
- Download your version https://github.com/stuartleeks/wsl-notify-send/releases
- Extract wsl-notify-send.exe from the downloaded zip and ensure that it is in your
PATH
- Testing In WSL, run
notify-send "Hello from WSL"
and you should see a Windows toast notification!
wsl-notify-send
provides a Windows executable that is intended to be a replacement for the Linuxnotify-send
utility.
https://github.com/stuartleeks/wsl-notify-send
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
Install 7z
sudo apt update
sudo apt install p7zip-full
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
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.
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
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
You can find out much more about how to use this project in our Wiki
In the fiture a will use SemVer for versioning. For all available versions, see the tags en este repositorio.
- David Baez Sanchez - Initial Work - DBZ repository - David Baez
Working on this - see the file LICENSE.md for details
- Tell others about this project 📢
- Invite for a beer 🍺 or a coffee ☕ to someone on the team..
- Publicly thanks 🤓.
- Anything you want.