Use Cisco MIB to fetch CPU and Memory using Logstash

I have Cisco Switches and Routers.
I have download their CPU and memory MIB's which are in .my format.
How can i use logstash to utilize these MIB to fetch CPU and Memory status of cisco switches and routers ?

If you search the forums you will find a number of threads that talk about doing this. This one, for example.

Hi @Badger,

Below is my configuration as per the page suggested above:

input {
  snmp {
    get => [
      "1.3.6.1.4.1.9.9.109.1.1.1.1.25"
    ]
    walk => [
      ".1.3.6.1.4.1.9.2.1.58"
    ]
    hosts => [
      { host => "udp:<cisco_switch_ip>/161" community => "xxxxx" }
    ]
        mib_paths => [
          "/etc/logstash/mib/OLD-CISCO-CPU-MIB.dic"
        ]
  }
}
output {
  stdout { codec => rubydebug }
 }

I am getting below error:

[2020-11-16T13:25:34,355][ERROR][logstash.inputs.snmp     ][main][545792a196c2078f3ed8e47c45cd1036c32d1a35f1f39e44e5cf8f0191b37d2c] error invoking walk operation on OID: 1.3.6.1.4.1.9.2.1.58, ignoring {:exception=>#<LogStash::SnmpClientError: error sending snmp walk request to target <ip>/161: Request timed out.>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-snmp-1.2.7/lib/logstash/inputs/snmp/base_client.rb:67:in `block in walk'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-snmp-1.2.7/lib/logstash/inputs/snmp/base_client.rb:62:in `walk'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-snmp-1.2.7/lib/logstash/inputs/snmp.rb:179:in `block in run'", "org/jruby/RubyArray.java:1809:in `each'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-snmp-1.2.7/lib/logstash/inputs/snmp.rb:177:in `block in run'", "org/jruby/RubyArray.java:1809:in `each'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-snmp-1.2.7/lib/logstash/inputs/snmp.rb:167:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:405:in `inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:396:in `block in start_input'"]}

Seems your configuration is correct..
Please check the connection using snmpget from logstash machine...
Or there are some firewall rules to prevent the logstash IP to connect to the routers.
Or just use nc to check the port

nc -vvvv -u <cisco_router_ip> 161

Thank you, seems like the issue is with Cisco which is not able to process the request.

One more quick question, i had cisco .my mib and i converted it to .dic using the below command as per documentation:

smidump --level=1 -k -f python CISCO-MEMORY-POOL-MIB.my > CISCO-MEMORY-POOL-MIB.dic
#########O/P##########
CISCO-MEMORY-POOL-MIB.my:30: failed to locate MIB module `CISCO-QOS-PIB-MIB'
CISCO-MEMORY-POOL-MIB.my:32: failed to locate MIB module `CISCO-SMI'
CISCO-MEMORY-POOL-MIB.my:66: unknown object identifier label `ciscoMgmt'
smidump: module `CISCO-MEMORY-POOL-MIB.my' contains errors, expect flawed output

Can it also be causing the issue?

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