/downtime_monitor

An API that monitors, detects and tracks website's up and down times

Primary LanguagePython

Downtime Monitor Todo Assessment

Downtime Monitor

A SaaS that: -     Monitors, detects and tracks website's up and down times -     Provides an API that responds with logs of historical stats for up and down times -     Notifies specific group of people via email (and/or SMS) when a website goes down and comes back up -     Able to perform operations all operations with the highest level of complications and sophistications applicable considered.

The sophistication expected includes:

  • to track multiple websites simultaneously
  • allows all common forms of authorization scheme as available on the destination server
  • enforces authorization on system-system data exchange via a scheme of choice
  • for data exchange interface provided to be able to return a properly encrypted analyzed historical data that is ready for use
  • and every other standard SaaS software requirement

Key target:

  • knowledge and use (approach) of software architecture
  • a good experience in the use of data analytics, log storage data and retrieval tools, and encryption tools
  • use of test suites (unit and e2e test)

Setup

The first thing to do is to clone the repository:

$ git clone https://github.com/izudada/downtime_monitor.git

Create a virtual environment to install dependencies and activate it use the link below first to install virtualenv here.)

After installation create a virtual environment by running:

$ virtualen env_name

Next, activate the virtual enviroment with :

$ source env_name/bin/activate

Then install the dependencies:

(env)$ pip install -r requirements.txt

Use migrate command to effect database model:

(env)$ python manage.py makemigrations
(env)$ python manage.py migrate

Start the server with:

$ python manage.py runserver

And navigate to http://127.0.0.1:8000/

Cronjob/Crontabs/Schedule Jobs

Ater running the django server and inserting records into the web models, you can run the web monitoring scheduled job to monitor changes in the state of a website by running the crontab command on a new terminal:

$ python manage.py crontab add

The above command will add a monitoring function to its schedule

To deactivate or stop the scheduled job run:

$ python manage.py crontab remove

Note: scheduled job runs every 3 mins. This is so inorder for the observer to get results quicker. You can increase the interval by editting the value of CRONJOBS constant in the settings.py file.

Also, once the cronjobs is initiated, a cronjob.log file will be created on the root directory for debugging purposes

Documentation

Postman documentation can be found Here

Import Postman Collection

You can import the postman collection "Inventory Management System.postman_collection.json" to test the endpoints locally. by importing Web "Monitor.postman_collection.json" into postman

Note: Postman collection also contain tests for each endpoint

Test

To run all available tests use:

(folder_name)$ python manage.py test

Useful resources