1

I want to write a C program which receives snmptraps sent from another machine and parses them. I am able to do this from the command line, but have no idea on how to implement this in C.

I searched online and found most code was in ruby or the atleast C++ which had a traplistener class.

Is there any way to receive snmptraps from within a C program ?

Vasfed
  • 18,013
  • 10
  • 47
  • 53
kid
  • 140
  • 1
  • 10

1 Answers1

0

One of the best library is to use net-snmp. It supports both C and C++ linkages.

  • I am already using the net-snmp headers inside my code to send traps. I am just clueless on how to start a trap listener from inside the code. Can you point me to some sample code which has snmp trap listener using the net-snmp lib? – kid Jan 06 '16 at 05:07
  • There is not enough documentation. But, here's a reference link to [snmptrapd](http://fossies.org/linux/net-snmp/apps/snmptrapd.c) – Santhosh Nagasanthosh Jan 06 '16 at 05:33