Sign inSign up

bxnxm/micros-gateway

By bxnxm

‱Updated about 1 month ago

This is a gateway container (REST API) to access micrOS nodes. https://github.com/BxNxM/micrOS

Image
Networking
Web servers
Monitoring & observability
0

1.3K

bxnxm/micros-gateway repository overview

Instagram YouTube Facebook Thingiverse GitHub

README⁠

⁠ALL IN ONE: Docker compose

docker-compose.yaml⁠

docker-compose -p gateway up -d

Change GATEWAYIP=10.0.1.1 to your router IP, where the host machine and micrOS endpoints are connected. Chnage API_AUTH=: for basic auth, or remove param if you don't need basic auth.

⁠Open in browser:
  • host_machine_ip, for example: 10.0.1.61
http://host_machine_ip:5000
http://host_machine_ip:9090
|______||______||______||______||______||______||______||______||______||______|


 _____  _                         _                          _                
/  ___|| |                       | |                        | |               
\ `--. | |_   ___  _ __   ______ | |__   _   _  ______  ___ | |_   ___  _ __  
 `--. \| __| / _ \| '_ \ |______|| '_ \ | | | ||______|/ __|| __| / _ \| '_ \ 
/\__/ /| |_ |  __/| |_) |        | |_) || |_| |        \__ \| |_ |  __/| |_) |
\____/  \__| \___|| .__/         |_.__/  \__, |        |___/ \__| \___|| .__/ 
                  | |                     __/ |                        | |    
                  |_|                    |___/                         |_|   manual container orchestration

⁠Start micrOS gateway:

  • GATEWAYIP: replace with your router IP, where the host machine and micrOS endpoints are connected.
docker run --name micros-gateway -p 5000:5000 -e GATEWAYIP="10.0.1.1" -d bxnxm/micros-gateway:1.22.5
⁠Open in browser:
  • host_machine_ip, for example: 10.0.1.61
http://host_machine_ip:5000

REST API response:

{
  "/list": "List known devices, sort by online/offline",
  "/metrics/<device>/<cmd>": "REST API endpoint for Prometheus scraping, (prometheus format)",
  "/search": "Search devices",
  "/sendcmd/<device>/<cmd>": "Send command to the selected device. Use + instead of space. Example: http://172.17.0.3:5000/sendcmd/__simulator__/system+clock",
  "/status": "Get all device status - node info",
  "micrOS gateway": "v1.1"
}
⁠Dedicated Prometheus REST API response /metrics
http://host_machine_ip:5000/metrics/TerraceSensor/dht22+measure

# TYPE python_info gauge
# HELP micrOS_TerraceSensor__dht22_measure Dynamic content: temp [ÂșC]
# TYPE micrOS_TerraceSensor__dht22_measure gauge
micrOS_TerraceSensor__dht22_measure 21.4

⁠Start Prometheus with data scraping

⁠Prometheus scrape_configs: prometheus.yml
  • Change micros-gateway if needed to exact IP address

prometheus.yml⁠

⁠Start Prometheus container
docker run --name prometheus -d -p 9090:9090 -v ./prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

⁠Open Prometheus in browser

  • Change 10.0.1.61 to the right Prometheus IP.
http://10.0.1.61:9090

Tag summary

Content type

Image

Digest

sha256:efea16b39


Size

152.6 MB

Last updated

about 1 month ago

docker pull bxnxm/micros-gateway:3.3.5