2

Which is the more resource-friendly way to collect SNMP traps from a Cisco router via python:

  1. I could use a manager on a PC running a server, where the Cisco SNMP traps are sent to in case one occurs
  2. I could use an agent to send a GET/GETBULK request every x timeframe to check if any new traps have occurred

I am looking for a way to run the script so that it uses the least resources as possible. Not many traps will occur so the communication will be low mostly, but as soon as one does occur, the PC should know immediately.

AlG
  • 14,697
  • 4
  • 41
  • 54
ChillY
  • 106
  • 6
  • 1
    If you wish to minimize information propagation delay and message processing overhead, then #1 looks better to me. You could experiment by running a notification receiver example (from pysnmp web site). – Ilya Etingof Jan 26 '15 at 17:00
  • 1
    I have one set up and it doesn't seem to take much resource to tell the truth, just thought that maybe someone has done some testing for this kind of comparison – ChillY Jan 27 '15 at 17:27

1 Answers1

0

Approach 1 is better from most perspectives.

  • It uses a little memory on the PC due to running a trap collecting daemon, but the footprint should be reasonably small since it only needs to listen for traps and decode them, not do any complex task.
  • Existing tools to receive traps include the net-snmp suite which allows you to just configure the daemon (i e you don't have to do any programming if you want to save some time).

Approach 2 has a couple of problems:

  1. No matter what polling interval you choose, you run the risk of missing an alarm that was only active on the router for a short time.
  2. Consumes CPU and network resources even if no faults are occurring.
  3. Depending on the MIB of the router, some types of event may not be stored in any table for later retrieval. For Cisco, I would not expect this problem, but you do need to study the MIB and make sure of this.
Jolta
  • 2,620
  • 1
  • 29
  • 42