Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carnivuth/edgex_iot_simulation
edgex environment simulation with snmp capable control nodes
https://github.com/carnivuth/edgex_iot_simulation
ansible edgex edgex-snmp telegram telegram-bot vagrant
Last synced: 26 days ago
JSON representation
edgex environment simulation with snmp capable control nodes
- Host: GitHub
- URL: https://github.com/carnivuth/edgex_iot_simulation
- Owner: carnivuth
- Created: 2024-05-30T13:43:54.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-13T18:56:17.000Z (5 months ago)
- Last Synced: 2024-09-30T23:42:25.413Z (about 1 month ago)
- Topics: ansible, edgex, edgex-snmp, telegram, telegram-bot, vagrant
- Language: Jinja
- Homepage:
- Size: 80.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# EDGEX IOT SIMULATION
edgex cluster simulation with snmp devices as linux servers
## ARCHITECTURE
The idea is to simulate a network environment with a node acting as a edgex gateway pulling information (*uptime in this example*) from snmp capable iot nodes, the uptime data stream is used by a external developed application (*monitor*) that uses the informations to notify that a node has been rebooted trough telegram messages
```mermaid
flowchart TD
subgraph edgex_gateway
direction TB
F[monitor]
A[snmp-device]
G[core-data]
E[edgex runtime]
A --send events to--> G
F --reads from--> G
end
subgraph iot_network
direction LR
B[iot node 1]
B
end
A --snmp queries--> B
```## INSTALLATION
- install [vagrant](https://www.vagrantup.com/) and [virtualbox](https://www.virtualbox.org/)
- create python venv and install dependencies
```bash
cd edgex_iot_simulation
python -m venv env
source env/bin/activate
pip install -r requirements.txt
```- install geerlingguy.docker role
```bash
source env/bin/activate
ansible-galaxy role install geeringguy.docker
```- start cluster
```bash
vagrant up
```- run the preflight.yml playbook
```bash
ansible-playbook -i inventory.yml preflight.yml -e 'telegram_token=' -e 'telegram_channel_id='
```- in order to test the application simply restart the iot node
```bash
vagrant reload iot-node-1
```- and then inspect logs on the edgex-runtime node
```bash
cd /usr/local/edgex-runtime
docker compose logs monitor
```## RESULTS
![](./img/result.jpg)
### PREFLIGHT
in order to run the playbook telegram configuration parameter are neded to start the monitoring application
telegram_token: token of the bot given from [botfather](https://telegram.me/BotFather)
telegram_channel_id: channel_id where to route reboot notification from the monitor app, this can be obtained by- sending a message to the bot
- connecting to the url `https://api.telegram.org/bot/getUpdates`the API will reply with a json with the chat id information
### MONITOR
Monitor application is a simple python script that fetches the data from the edgex-core microservice and send a telegram message to the configured channel id,
it's deployed exploiting the edgex compose file```mermaid
flowchart TD
subgraph monitor
A[monitor.py]
end
B[edgex_core_data]
C[(telegram_api)]
A --pull information from-->B
A --notify trough-->C```