Skip to content

Django Web App to monitor different hosts via the Monitor-Agent. It was Final Year Project.

License

Notifications You must be signed in to change notification settings

n0nuser/Monitor

Repository files navigation

Monitor

Computer Science Final Degree Project @ USAL - Web App to manage monitorized hosts

Contributors Forks Stargazers Issues GPL License LinkedIn

Built With

Python Poetry

Django Django REST Framework

Docker

Redis Django RQ RQ Scheduler

Uvicorn Nginx

(back to top)

Architecture

Architecture

Getting Started

A web app that allows to manage agents and get results from them. Django is used for the webpage, while Django REST Framework is used for the REST API.

The webpage will be used by the user to manage its server/computers remotely and get their metrics, as well as send them commands in POST requests to the agents.

⚠️ For agents to receive commands port forwarding to the agents must be done in the router to the port specified in the settings file of the agent.

The REST API will receive the metrics and the alerts from the agents.

Installation and use

Modify the .env file to suit your needs.

ALLOWED_HOSTS=127.0.0.1,localhost,192.168.0.28
DEBUG=False
DJANGO_SUPERUSER_EMAIL=admin@monitor.tfg
DJANGO_SUPERUSER_PASSWORD=admin
DJANGO_SUPERUSER_USERNAME=admin
EMAIL_HOST=smtp.gmail.com
EMAIL_HOST_PASSWORD=password
EMAIL_HOST_USER=account@gmail.com
EMAIL_PORT=587
PORT=8000
POSTGRES_NAME=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_USER=postgres
SECRET_KEY=myDummySecretKey
SERVER=YOUR FQDN

Execute the docker_compose_up.sh file to deploy the containers.

chmod +x docker_compose_up.sh
./docker_compose_up.sh

Endpoints

Endpoint URL
users http://fqdn/api/users/
agents http://fqdn/api/agents/
agent_configs http://fqdn/api/agent_configs/
metrics http://fqdn/api/metrics/
alerts http://fqdn/api/alerts/
alert_emails http://fqdn/api/alert_emails/
alert_webhooks http://fqdn/api/alert_webhooks/

Authentication

In the web app, the user can log in with the username and password, or with the token (only to the REST API).

This token is assigned automatically to the user when it's registered and can be seen in the user's profile.

Get the user token

In case you prefer the REST API method, you can get the token with the following command:

# curl -X POST -d "username=YOUR_USERNAME&password=YOUR_PASSWORD"  http://SERVER:PORT/api-token-auth/
curl -X POST -d "username=admin&password=admin"  http://localhost:8000/api-token-auth/

Authenticate with Token

# curl http://localhost:8000/api/users/ -H 'Authorization: Token YOUR_TOKEN'
curl http://localhost:8000/api/users/ -H 'Authorization: Token abe47ef7170a53a0f9670c8b2b1081d8ace7d3e5'

Roadmap

Check the Roadmap here.

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the GPL-3.0 License. See LICENSE.txt for more information.

(back to top)

Contact

Pablo González Rubio - @n0nuser_ - gonzrubio.pablo@gmail.com

Project Link: https://github.com/n0nuser/Monitor

(back to top)

About

Django Web App to monitor different hosts via the Monitor-Agent. It was Final Year Project.

Topics

Resources

License

Stars

Watchers

Forks