# SNMP Bind Failed

**URL:** https://discuss.elastic.co/t/snmp-bind-failed/151014
**Category:** Logstash
**Created:** [October 4, 2018, 9:52am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014 "2018-10-04T09:52:25Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![paul1243](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@paul1243](https://discuss.elastic.co/u/paul1243)
#### Post date: [October 4, 2018, 9:52am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/1 "2018-10-04T09:52:25Z")

</div>

When I run the SNMP input filter, I get the SNMP trap listener died; can not assign requested address .  
Here is my config:

```auto
input {
 snmptrap {
   host => ' **.**. **.**'
   port => 161
   community => "public"
   yamlmibdir => 'C:\logstash\vendor\bundle\jruby\2.3.0\gems\snmp-1.2.0\data\ruby\snmp\mibs'
 }
}

output {
stdout {codec => rubydebug}
}

```

I tried with the MIB browser, it takes port no: 161, and it works fine but it fails at logstash config. please let em know if am wrong anywhere.

---

<div class="post-metadata">

### Author: ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)
#### Post date: [October 4, 2018, 11:57am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/2 "2018-10-04T11:57:15Z")

</div>

Are you getting an error message?

---

<div class="post-metadata">

### Author: ![paul1243](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@paul1243](https://discuss.elastic.co/u/paul1243)
#### Post date: [October 4, 2018, 1:33pm UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/3 "2018-10-04T13:33:44Z")

</div>

Hi @AquaX-  
Yes, I do. Here is the error log:

```auto
[2018-10-04T15:20:10,976][WARN][logstash.inputs.snmptrap] SNMP Trap listener d
ied {:exception=>#<Errno::EADDRNOTAVAIL: Can't assign requested address - bind -
 Cannot assign requested address: bind>, :backtrace=>["org/jruby/ext/socket/Ruby
UDPSocket.java:190:in `bind'", "C:/logstash/vendor/bundle/jruby/2.3.0/gems/snmp-
1.2.0/lib/snmp/manager.rb:540:in `initialize'", "C:/logstash/vendor/bundle/jruby
/2.3.0/gems/snmp-1.2.0/lib/snmp/manager.rb:586:in `create_transport'", "C:/logst
ash/vendor/bundle/jruby/2.3.0/gems/snmp-1.2.0/lib/snmp/manager.rb:618:in `initia
lize'", "C:/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-snmptrap-3.0.
5/lib/logstash/inputs/snmptrap.rb:75:in `build_trap_listener'", "C:/logstash/ven
dor/bundle/jruby/2.3.0/gems/logstash-input-snmptrap-3.0.5/lib/logstash/inputs/sn
mptrap.rb:79:in `snmptrap_listener'", "C:/logstash/vendor/bundle/jruby/2.3.0/gem
s/logstash-input-snmptrap-3.0.5/lib/logstash/inputs/snmptrap.rb:54:in `run'", "C
:/logstash/logstash-core/lib/logstash/pipeline.rb:524:in `inputworker'", "C:/log
stash/logstash-core/lib/logstash/pipeline.rb:517:in `block in start_input'"]}

```

---

<div class="post-metadata">

### Author: ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)
#### Post date: [October 4, 2018, 2:27pm UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/4 "2018-10-04T14:27:27Z")

</div>

Looks like port 161 is already in use. Either kill the process that is already listening on that port or change the port to something else 🙂

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 5, 2018, 5:14pm UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/5 "2018-10-05T17:14:36Z")

</div>

Is the IP address in the `host` option one of the addresses of the Logstash host?

---

<div class="post-metadata">

### Author: ![paul1243](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@paul1243](https://discuss.elastic.co/u/paul1243)
#### Post date: [October 7, 2018, 5:31pm UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/6 "2018-10-07T17:31:34Z")

</div>

@magnusbaeck - Hi, The IP Address in the Host Option is one of the Cisco device IP. NOT the Logstash IP.  
I tried giving the other ports, but still I see the same error message. ☹

---

<div class="post-metadata">

### Author: ![axrayn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axrayn/32/56503_2.png) [@axrayn](https://discuss.elastic.co/u/axrayn)
#### Post date: [October 8, 2018, 1:07am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/7 "2018-10-08T01:07:47Z")

</div>

Hi Paul,

Logstash won't be able to bind to an IP address of a remote device, it needs to be an address on the Logstash server. Also, you won't be able to bind to port 161 if you already have an SNMP agent like Net-SNMP running on the same host because 161 is the default snmp agent port and 162 is the default for SNMP traps.

Just a side query, are you expecting snmp traps on this Logstash or are you trying to do a snmp get/walk of a remote Cisco device with this input?

---

<div class="post-metadata">

### Author: ![paul1243](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@paul1243](https://discuss.elastic.co/u/paul1243)
#### Post date: [October 8, 2018, 6:59am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/8 "2018-10-08T06:59:23Z")

</div>

Hi @axrayn-  
I just need to do the snmp get/get next on a remote cisco device with this input. Thanks !

---

<div class="post-metadata">

### Author: ![axrayn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axrayn/32/56503_2.png) [@axrayn](https://discuss.elastic.co/u/axrayn)
#### Post date: [October 8, 2018, 7:09am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/9 "2018-10-08T07:09:09Z")

</div>

Ah, that could be an issue then. 🙂

The logstash-input-snmptrap module is for accepting snmp traps from remote devices.

Take a look at [https://github.com/logstash-plugins/logstash-input-snmp](https://github.com/logstash-plugins/logstash-input-snmp). It's not GA yet but will do the snmp get/walk you're after.

---

<div class="post-metadata">

### Author: ![paul1243](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@paul1243](https://discuss.elastic.co/u/paul1243)
#### Post date: [October 8, 2018, 7:29am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/10 "2018-10-08T07:29:53Z")

</div>

@axrayn- Could you please provide a sample input to do the snmpget on a remote device. Thanks !

---

<div class="post-metadata">

### Author: ![axrayn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axrayn/32/56503_2.png) [@axrayn](https://discuss.elastic.co/u/axrayn)
#### Post date: [October 8, 2018, 7:32am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/11 "2018-10-08T07:32:10Z")

</div>

Have a look at the sample.conf under the test folder.

> <https://github.com/logstash-plugins/logstash-input-snmp/blob/master/test/sample.conf>

---

<div class="post-metadata">

### Author: ![paul1243](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@paul1243](https://discuss.elastic.co/u/paul1243)
#### Post date: [October 8, 2018, 8:04am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/12 "2018-10-08T08:04:02Z")

</div>

Thank you @axrayn.  
I just have some of the Vendor MIB files, I need to do the snmp get for all of the OID's present in that MIB files. Is there any way that we can do that. Please let me know. Thanks !

Paul.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 5, 2018, 8:04am UTC](https://discuss.elastic.co/t/snmp-bind-failed/151014/13 "2018-11-05T08:04:11Z")

</div>

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