Hello dears,
i have an edge agent running and up with deployed edge workflow that include UDP Node listen to port 3001, i tried to send udp packet from the cli using " echo ‘Hello Losant’ > /dev/udp/0.0.0.0/3001"m how ever it doesn’t trigger the workflow
below the agent logs and snapshot of workflow debug
Note: i started the agent using the With “Environment Config” as i am always face issue with config.toml
When you started the container, did you map a UDP port on the host machine to port 3001 in the Docker container?
Attached is a simple workflow for testing. Note that, without doing the port mapping, this workflow will work fine as the UDP message is originating from within the Docker container but sending a message through the CLI on the host machine will fail.
But, if you start the GEA with this configuration …
docker run -d --restart always --name YOUR_CONTAINER_NAME \
-e 'DEVICE_ID=YOUR_DEVICE_ID' \
-e 'ACCESS_KEY=YOUR_ACCESS_KEY' \
-e 'ACCESS_SECRET=YOUR_ACCESS_SECRET' \
-p 3001:3001/udp \
losant/edge-agent:1.34.0
… Then, you can send UDP datagrams from the host machine to the Docker container and trigger the workflow …
echo 'hello from the host machine' | nc -u 0.0.0.0 3001
udp-test-develop.flow (2.3 KB)
1 Like
Thanks Dylan! i passed the port mapping and it received messages now.
i am facing issue with “File: Read” Node, as it can’t find/read files in host machine. is there something missing? is there a specific way to define the file path?
Similar to requiring a port mapping, Docker requires mounting a volume within the container if you wish to read files from the host machine. For example, the -v
line below …
docker run -d --restart always --name YOUR_CONTAINER_NAME \
-e 'DEVICE_ID=YOUR_DEVICE_ID' \
-e 'ACCESS_KEY=YOUR_ACCESS_KEY' \
-e 'ACCESS_SECRET=YOUR_ACCESS_SECRET' \
-p 3001:3001/udp \
-v /directory/on/host/machine:/directory/in/docker/container \
losant/edge-agent:1.34.0
More information can be found in our documentation as well as Docker’s documentation.
1 Like
i have already mounted the volume within the container: /var/lib/losant-edge-agent/data
however it stills gives the error, i am trying to access text file “decodetest-output002” inside the same mounted directory
docker run -d --restart always --name docs-agent \
-e 'DEVICE_ID=MY_DEVICEID' \
-e 'ACCESS_KEY=MY_ACCESSKEY \
-e 'ACCESS_SECRET=MY_SECRETKEY' \
-p 3001:3001/udp \
-v /var/lib/losant-edge-agent/data:/data \
losant/edge-agent
Your ‘File Path Template’ should be relative to the location in the Docker container, not the location on your hardware’s file system. So instead of …
/var/lib/losant/edge-agent/data/decodedtest-output002
… it should be …
/data/decodedtest-output002
The File: Read Node documentation does say this value should be “A string template for the disk location of the file to read.” I will file a ticket to clarify that that should be the location of the mounted volume.
1 Like
Thanks a lot, very helpful!