The Sistema de Monitoramento de Insumos of the Universidade de Brasília (SMI-UnB), is a web application developed to assist in the monitoring and management of Universidade de Brasília's power consumption and distribution.
The idea is to monitor, collect and display data of each campus power supply, allowing a much better comprehension of the usage patterns and energy quality received from the distribution station.
The system is divided into three main layers:
- the presentation layer, which holds the front-end of the application, including the dashboard for researchers.
- the master layer, which is responsible for all the data management, data processing, and database redundancy.
- the slave layer is responsible for the communication with energy transductors and data collection.
First install Docker following the instructions according to your Operational System, here.
After installing Docker, you can install Docker-Compose, also according to your Operational System here.
If you have already lifted up SMI Slave's API. All you have to do is:
sudo docker-compose up
If you haven't you must create the docker network needed for Master to connect. As:
sudo docker network create smi-network
and you can lift up you Master environment with:
sudo docker-compose up
And, that's it! You have SMI up and running!
To simplify the commands you can use make to run the application. You can lift up you Master environment with:
sudo make up
obs: This command creates the smi network if it doesn't exist yet.
sudo make stop # stop all Master containers
sudo make down # down all Master containers
sudo make dump # generate a dump with the saved data
sudo make loaddump # restore dumped data to dump-db.json file
sudo make fixhstore # fix hstore error
You may register a slave server by sending a POST to '/slave/' (shortcut).
If you are running a slave server on the same machine you are running master, you can find the IP address on the slave container by typing:
sudo docker inspect slave-api
You may create a transductor by sending a POST to '/energy_transductors/' (shortcut).
A created transductor is only registred locally on master server, for registering it to a slave server, POST to '/energy_transductors/(transductor's serial number)/add_to_server/' and the post's body must contain { "slave_id" : (target slave id) }.