# How to get SNMP packets to my node-red docker image?

**URL:** https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561
**Category:** General
**Tags:** docker
**Created:** [20 May 2023 17:08 UTC](https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561 "2023-05-20T17:08:19Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![AndKe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andke/32/73023_2.png) [@AndKe](https://discourse.nodered.org/u/AndKe)
#### Post date: [20 May 2023 17:08 UTC](https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561/1 "2023-05-20T17:08:19Z")

</div>

A UPS is sending traps to the host of the node-red (in a docker).  
I have installed [node-red-node-snmp (node) - Node-RED](https://flows.nodered.org/node/node-red-node-snmp)

-how can I get the SNMP packets to the docker image?  
my iptables config:

```auto
$ sudo iptables -L
# Warning: iptables-legacy tables present, use iptables-legacy to see them
Chain INPUT (policy ACCEPT)
target prot opt source destination         
ACCEPT udp -- anywhere anywhere udp dpt:snmp-trap

Chain FORWARD (policy DROP)
target prot opt source destination         
DOCKER-USER all -- anywhere anywhere            
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere            
ACCEPT all -- anywhere anywhere            

Chain OUTPUT (policy ACCEPT)
target prot opt source destination         

Chain DOCKER (3 references)
target prot opt source destination         
ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:1880
ACCEPT tcp -- anywhere 172.18.0.2 tcp dpt:9001
ACCEPT tcp -- anywhere 172.18.0.2 tcp dpt:1883
ACCEPT tcp -- anywhere 172.18.0.3 tcp dpt:http-alt

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination         
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere            
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere            
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere            
RETURN all -- anywhere anywhere            

Chain DOCKER-ISOLATION-STAGE-2 (3 references)
target prot opt source destination         
DROP all -- anywhere anywhere            
DROP all -- anywhere anywhere            
DROP all -- anywhere anywhere            
RETURN all -- anywhere anywhere            

Chain DOCKER-USER (1 references)
target prot opt source destination         
RETURN all -- anywhere anywhere            
pi@lys:~ $ 

```

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [20 May 2023 17:24 UTC](https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561/2 "2023-05-20T17:24:04Z")

</div>

> [@AndKe](#):
>
> SNMP

You need to open UDP ports 161 and 162 to your Docker container first.

```auto
-p 161:161/udp
-p 162:162/udp

```

---

<div class="post-metadata">

### Author: ![AndKe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andke/32/73023_2.png) [@AndKe](https://discourse.nodered.org/u/AndKe)
#### Post date: [20 May 2023 17:31 UTC](https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561/3 "2023-05-20T17:31:36Z")

</div>

@TotallyInformation thanks - this reminds me of the last time I needed to find out how/where my docker was configured.  
now I need to figure it out again.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [20 May 2023 18:30 UTC](https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561/4 "2023-05-20T18:30:20Z")

</div>

If you use docker compose, you can configure docker containers using simple config files which you can annotate, you might find that easier.

---

<div class="post-metadata">

### Author: ![AndKe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andke/32/73023_2.png) [@AndKe](https://discourse.nodered.org/u/AndKe)
#### Post date: [20 May 2023 19:21 UTC](https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561/5 "2023-05-20T19:21:53Z")

</div>

@TotallyInformation Yes, I am using this for some services,

```auto
$ cat docker-compose.yml 
version: '3.8'
services:
  mqtt:
    container_name: mqtt
    image: eclipse-mosquitto:2.0
    restart: unless-stopped
    volumes:
      - "/home/pi/mosquitto-data:/mosquitto"
    ports:
      - "1883:1883"
      - "9001:9001"
    command: "mosquitto -c /mosquitto-no-auth.conf"

  zigbee2mqtt:
    depends_on:
      - mqtt
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt
    restart: unless-stopped
    volumes:
      #- ./data:/app/data
      - /home/pi/zigbee2mqtt-data:/app/data
      - /run/udev:/run/udev:ro
    ports:
      # Frontend port
      - 8080:8080
    environment:
      - TZ=Europe/Berlin
    devices:
      # Make sure this matched your adapter location
      #- /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00:/dev/ttyACM0
      - /dev/ttyUSB0:/dev/ttyUSB0

```

but still fail to see where node-red is started:

```auto
$ docker images 
REPOSITORY TAG IMAGE ID CREATED SIZE
koenkk/zigbee2mqtt latest 567088e9e6af 4 months ago 82.8MB
koenkk/zigbee2mqtt <none> ab272e315125 4 months ago 82.8MB
koenkk/zigbee2mqtt <none> e6bf13d00050 5 months ago 187MB
nodered/node-red latest 35f3062b67d1 9 months ago 407MB
koenkk/zigbee2mqtt <none> 5e16c0dd46a7 18 months ago 143MB
eclipse-mosquitto 2.0 79117ae3185f 18 months ago 9.91MB
hello-world latest 1ec996c686eb 19 months ago 4.85kB

```

I also see a /var/lib/docker/volumes/node\_red\_data/\_data/node\_modules/node-red-contrib-telegrambot-home/docker-compose.yml

- but cannot be sure whatever this is somehow in use too?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [20 May 2023 19:33 UTC](https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561/6 "2023-05-20T19:33:09Z")

</div>

> [@AndKe](#):
>
> but still fail to see where node-red is started:

It isn't in that compose file. Check other compose files.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [19 July 2023 19:33 UTC](https://discourse.nodered.org/t/how-to-get-snmp-packets-to-my-node-red-docker-image/78561/7 "2023-07-19T19:33:41Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
