Skip to content

Commit

Permalink
add: README file
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioscardace authored Jun 11, 2024
1 parent 4716344 commit 64f1222
Showing 1 changed file with 86 additions and 2 deletions.
88 changes: 86 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,86 @@
# NetWatch
Service to Check Local Utilities Health and Alert Their Owners.
# NetWatch • Utilities Health Monitor
_Project for "Distributed Systems Engineering" course_<br/>
_Grade: 30 with honors / 30_<br/>
_[Antonio Scardace](https://linktr.ee/antonioscardace)_ @ _Dept of Math and Computer Science, University of Catania_

[![CodeFactor](https://www.codefactor.io/repository/github/antonioscardace/netwatch/badge)](https://www.codefactor.io/repository/github/antonioscardace/netwatch)
[![License](https://img.shields.io/github/license/antonioscardace/netwatch.svg)](https://github.com/antonioscardace/netwatch/blob/master/LICENSE)
[![Open Issues](https://img.shields.io/github/issues/antonioscardace/netwatch.svg)](https://github.com/antonioscardace/netwatch/issues)

## Introduction

The project is a health checker. It aims to check in real-time the health of each observed local utility.<br/>
The utility can be a Docker Container, a Machine, or a Network Device in your local network.<br/>
If a utility changes its state (i.e. **goes offline** or **comes back online**), the monitor notifies the utility referent.<br/>
The alert can be a Slack message, an Email, or a Telegram message like these:

<img src="/docs/snaps/telegram.png" alt="Telegram" width="500px"/>
<img src="/docs/snaps/email-online.png" alt="Telegram" width="500px"/>

## Exam Goals

An accurate report can be found in [/docs/report.pdf](/docs/report.pdf)<br/>
This project was created as an exam project to test a set of skills, including:

+ Knowledge of Microservices
+ Knowledge of Design Patterns
+ Knowledge of Java, Maven, and Spring Boot
+ Knowledge of Messaging Systems (RabbitMQ) and their Patterns
+ Knowledge of Git & GitHub

I also had the opportunity to practice the following skills:
+ Knowledge of ORMs (Hibernate)
+ Knowledge of Redis
+ Use of the Static Analysis Tools (CodeFactor, Snyk Code, and Sonar Qube)

## System Infrastructure

Each microservice is contained in a Docker Container.<br/>
The only reachable containers in the Docker Network are Frontend, API Gateway, and Grafana.<br/>
The UML of the internal structure of each microservice is stored in [/docs/uml/](/docs/uml/).<br/>

<img src="/docs/images/infrastructure.svg" alt="Infrastructure"/>

Main Notes:

- **RabbitMQ** provides an Exchange implementing the Publish-Subscribe Design Pattern.
- The HTTP connection between **Monitor** and **Data Manager** is a Keep-Alive (persistent) connection.
- **Monitor** implements the Factory-Method Design Pattern for the _request_ module.
- **Notification** implements the Factory-Method Design Pattern for the _sender_ module.
- Both **Identity Manager** and **Monitor** microservices use a Redis cache to store, respectively, active tokens and offline utilities. Storing data in a Redis cache rather than a local data structure (e.g. Hash Maps) offers several advantages like scalability, distribution, and persistence.

Here are some useful links for communication:

- **Telegram Bot**: [BotFather](https://core.telegram.org/bots/tutorial)
- **Slack**: [Incoming WebHooks](https://slack.dev/java-slack-sdk/guides/incoming-webhooks)
- **Email with a 2FA Account**: [Make an App Custom Password](https://stackoverflow.com/questions/26736062/sending-email-fails-when-two-factor-authentication-is-on-for-gmail#answer-27130058)

## Grafana Demo

<p align="center">
<img src="/docs/snaps/grafana-screen.png" alt="Grafana Logs" width="80%"/>
</p>

## Getting Started

So that the repository is successfully cloned and the project runs, there are a few prerequisites:

* A stable internet connection.
* A certain amount of RAM and CPU is required.
* Any set of valid credentials or tokens (e.g. for Telegram) to send notifications.
* Need to download and install [Docker](https://docs.docker.com/get-docker/).

Then, the repo can be cloned, dependencies can be installed, and the project can be run.

```sh
$ git clone https://github.com/antonioscardace/NetWatch.git
$ cd YOUR_PATH/NetWatch/
$ bash run.sh
```

### Useful Links

Container | URL | Description
----- | ------- | -------
grafana-charts | [https://localhost:8800/](https://localhost:8800/d/2xZ6SccSz/netwatch-logs?orgId=1&refresh=5s&from=now-24h&to=now) | Grafana Logs
rabbitmq | http://localhost:15672/ | RabbitMQ UI

0 comments on commit 64f1222

Please sign in to comment.