Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to send net-snmp traps from "C"

Tags:

c

snmp

I need to write code to send traps from my application (using net-snmp APIs) Anyone has a simple sample code to do that? Thanks, Gil

like image 462
Gil Avatar asked Nov 15 '09 07:11

Gil


People also ask

What is the difference between SNMP and SNMP trap?

An SNMP poll is initiated by the server and the router or switch responds to the server. An SNMP trap is initiated by the router or switch when it has information to send (usually some event happened) and does not want to wait for the server to ask for information.


1 Answers

Net-snmp contains a command-line application called snmptrap which can be used to generate traps. You can take a look at a tutorial here and you can download its source from here. \net-snmp-5.5\apps\snmptrap.c is 395 lines long, so it can be considered as a 'simple sample code'.

like image 58
Bill Avatar answered Oct 06 '22 22:10

Bill