Skip to content

v1.0.4

Latest
Compare
Choose a tag to compare
@D1ffic00lt D1ffic00lt released this 03 Jun 08:39
v1.0.4
f4cb24e

Site Status Checker

Console application for monitoring the status of sites from a .csv file

Task

You got a job as a system administrator in a small office. Your responsibilities include monitoring the health of multiple sites. You have successfully set up a server status mail notification from the hosting, but it turned out that this is not enough. And you decide to develop a small application in Python so that it sends you messages in case any of the sites becomes unavailable for any reason.

Implementation

  • The application performs all necessary checks
  • The application works offline, informs when there is no Internet access
  • The application performs input checks
  • The application performs all necessary checks every hour

Installation and launch

Bash script (universal meth, almost...)

Bash scripts are almost everywhere (even in windows, sort of...)

When testing with this script, I managed to run the program on both Unix and Windows.

Run command:

bash run.sh

The script checks for the presence of docker on the computer and, depending on the result, launches 2 options:

  • Build and run the docker image
  • Installing all the necessary libraries from the requirements.txt, running the app.py python script

The entire code of the script can be found here

Docker

Docker is an open platform for developing, delivering and operating applications. Docker is designed to get your applications up and running faster. With Docker, you can decouple your application from your infrastructure and treat your infrastructure as a managed application. Docker helps you deploy your code faster, test faster, deploy applications faster, and reduce the time between coding and running code. Docker does this with a lightweight container virtualization platform, using processes and utilities to help manage and host your applications.

At its core, Docker allows you to run almost any application safely isolated in a container. Secure isolation allows you to run many containers on the same host at the same time. The lightweight nature of the container, which runs without the overhead of a hypervisor, allows you to get more out of your hardware.

Running the docker image

  1. install docker on your computer
  2. run docker (it is important that it starts completely)
  3. Enter the command in the console
docker build --no-cache -t sitestatuschecker . && run -it sitestatuschecker
  1. Wait for the end of the program build
  2. Everything is ready to use!

Python (3.10+)

It is very important that the python version >= 3.10, otherwise the application will not work

It is also possible to run through a regular python

  1. In the console from the project directory, write the command
pip3 install -r requirements.txt
  1. Wait for all libraries to be installed and send the command to the console from the bot directory
python3 app.py
  1. Everything is ready to use!

What's Changed

Full Changelog: v1.0.2...v1.0.4