summaryrefslogtreecommitdiff
path: root/man/netsnmp_agent_trap.3
blob: 3efee32e9e20fb1d3584cf67a8e6dfbc9f858b73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
.TH "Trap generation routines for mib modules to use" 3 "23 May 2010" "Version 5.4.3.pre1" "net-snmp" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Trap generation routines for mib modules to use \- 
.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBtrap_sink\fP"
.br
.in -1c
.SS "Defines"

.in +1c
.ti -1c
.RI "#define \fBSNMPV2_TRAPS_PREFIX\fP   SNMP_OID_SNMPMODULES,1,1,5"
.br
.ti -1c
.RI "#define \fBSNMPV2_TRAP_OBJS_PREFIX\fP   SNMP_OID_SNMPMODULES,1,1,4"
.br
.ti -1c
.RI "#define \fBSNMPV2_COMM_OBJS_PREFIX\fP   SNMP_OID_SNMPMODULES,18,1"
.br
.ti -1c
.RI "#define \fBSNMP_AUTHENTICATED_TRAPS_ENABLED\fP   1"
.br
.ti -1c
.RI "#define \fBSNMP_AUTHENTICATED_TRAPS_DISABLED\fP   2"
.br
.ti -1c
.RI "#define \fBMAX_ARGS\fP   128"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "void \fBinit_traps\fP (void)"
.br
.ti -1c
.RI "int \fBadd_trap_session\fP (\fBnetsnmp_session\fP *ss, int pdutype, int confirm, int version)"
.br
.ti -1c
.RI "int \fBremove_trap_session\fP (\fBnetsnmp_session\fP *ss)"
.br
.ti -1c
.RI "int \fBcreate_trap_session\fP (char *sink, u_short sinkport, char *com, int version, int pdutype)"
.br
.ti -1c
.RI "void \fBsnmpd_free_trapsinks\fP (void)"
.br
.ti -1c
.RI "\fBnetsnmp_pdu\fP * \fBconvert_v2pdu_to_v1\fP (\fBnetsnmp_pdu\fP *template_v2pdu)"
.br
.ti -1c
.RI "\fBnetsnmp_pdu\fP * \fBconvert_v1pdu_to_v2\fP (\fBnetsnmp_pdu\fP *template_v1pdu)"
.br
.ti -1c
.RI "int \fBnetsnmp_send_traps\fP (int trap, int specific, oid *enterprise, int enterprise_length, \fBnetsnmp_variable_list\fP *vars, char *context, int flags)"
.br
.RI "\fIThis function allows you to make a distinction between generic traps from different classes of equipment. \fP"
.ti -1c
.RI "void \fBsend_enterprise_trap_vars\fP (int trap, int specific, oid *enterprise, int enterprise_length, \fBnetsnmp_variable_list\fP *vars)"
.br
.ti -1c
.RI "int \fBhandle_inform_response\fP (int op, \fBnetsnmp_session\fP *session, int reqid, \fBnetsnmp_pdu\fP *pdu, void *magic)"
.br
.RI "\fICaptures responses or the lack there of from INFORMs that were sent 1) a response is received from an INFORM 2) one isn't received and the retries/timeouts have failed. \fP"
.ti -1c
.RI "void \fBsend_trap_to_sess\fP (\fBnetsnmp_session\fP *sess, \fBnetsnmp_pdu\fP *template_pdu)"
.br
.ti -1c
.RI "void \fBsend_trap_vars\fP (int trap, int specific, \fBnetsnmp_variable_list\fP *vars)"
.br
.ti -1c
.RI "void \fBsend_easy_trap\fP (int trap, int specific)"
.br
.RI "\fISends an SNMPv1 trap (or the SNMPv2 equivalent) to the list of configured trap destinations (or 'sinks'), using the provided values for the generic trap type and specific trap value. \fP"
.ti -1c
.RI "void \fBsend_v2trap\fP (\fBnetsnmp_variable_list\fP *vars)"
.br
.RI "\fIUses the supplied list of \fBvariable\fP bindings to form an SNMPv2 trap, which is sent to SNMPv2-capable sinks on the configured list. \fP"
.ti -1c
.RI "void \fBsend_trap_pdu\fP (\fBnetsnmp_pdu\fP *pdu)"
.br
.ti -1c
.RI "void \fBsnmpd_parse_config_authtrap\fP (const char *token, char *cptr)"
.br
.ti -1c
.RI "void \fBsnmpd_parse_config_trapsink\fP (const char *token, char *cptr)"
.br
.ti -1c
.RI "void \fBsnmpd_parse_config_trap2sink\fP (const char *word, char *cptr)"
.br
.ti -1c
.RI "void \fBsnmpd_parse_config_informsink\fP (const char *word, char *cptr)"
.br
.ti -1c
.RI "void \fBsnmpd_parse_config_trapsess\fP (const char *word, char *cptr)"
.br
.ti -1c
.RI "void \fBsnmpd_parse_config_trapcommunity\fP (const char *word, char *cptr)"
.br
.ti -1c
.RI "void \fBsnmpd_free_trapcommunity\fP (void)"
.br
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "struct \fBtrap_sink\fP * \fBsinks\fP = NULL"
.br
.ti -1c
.RI "struct timeval \fBstarttime\fP"
.br
.ti -1c
.RI "oid \fBobjid_enterprisetrap\fP [] = { NETSNMP_NOTIFICATION_MIB }"
.br
.ti -1c
.RI "oid \fBtrap_version_id\fP [] = { NETSNMP_SYSTEM_MIB }"
.br
.ti -1c
.RI "int \fBenterprisetrap_len\fP"
.br
.ti -1c
.RI "int \fBtrap_version_id_len\fP"
.br
.ti -1c
.RI "oid \fBtrap_prefix\fP [] = { SNMPV2_TRAPS_PREFIX }"
.br
.ti -1c
.RI "oid \fBcold_start_oid\fP [] = { SNMPV2_TRAPS_PREFIX, 1 }"
.br
.ti -1c
.RI "oid \fBwarm_start_oid\fP [] = { SNMPV2_TRAPS_PREFIX, 2 }"
.br
.ti -1c
.RI "oid \fBlink_down_oid\fP [] = { SNMPV2_TRAPS_PREFIX, 3 }"
.br
.ti -1c
.RI "oid \fBlink_up_oid\fP [] = { SNMPV2_TRAPS_PREFIX, 4 }"
.br
.ti -1c
.RI "oid \fBauth_fail_oid\fP [] = { SNMPV2_TRAPS_PREFIX, 5 }"
.br
.ti -1c
.RI "oid \fBegp_xxx_oid\fP [] = { SNMPV2_TRAPS_PREFIX, 99 }"
.br
.ti -1c
.RI "oid \fBsnmptrap_oid\fP [] = { SNMPV2_TRAP_OBJS_PREFIX, 1, 0 }"
.br
.ti -1c
.RI "oid \fBsnmptrapenterprise_oid\fP []"
.br
.ti -1c
.RI "oid \fBsysuptime_oid\fP [] = { SNMP_OID_MIB2, 1, 3, 0 }"
.br
.ti -1c
.RI "size_t \fBsnmptrap_oid_len\fP"
.br
.ti -1c
.RI "size_t \fBsnmptrapenterprise_oid_len\fP"
.br
.ti -1c
.RI "size_t \fBsysuptime_oid_len\fP"
.br
.ti -1c
.RI "oid \fBagentaddr_oid\fP [] = { SNMPV2_COMM_OBJS_PREFIX, 3, 0 }"
.br
.ti -1c
.RI "size_t \fBagentaddr_oid_len\fP"
.br
.ti -1c
.RI "oid \fBcommunity_oid\fP [] = { SNMPV2_COMM_OBJS_PREFIX, 4, 0 }"
.br
.ti -1c
.RI "size_t \fBcommunity_oid_len\fP"
.br
.ti -1c
.RI "char * \fBsnmp_trapcommunity\fP = NULL"
.br
.ti -1c
.RI "int \fBsnmp_enableauthentraps\fP = SNMP_AUTHENTICATED_TRAPS_DISABLED"
.br
.ti -1c
.RI "int \fBsnmp_enableauthentrapsset\fP = 0"
.br
.in -1c
.SH "Function Documentation"
.PP 
.SS "int handle_inform_response (int op, \fBnetsnmp_session\fP * session, int reqid, \fBnetsnmp_pdu\fP * pdu, void * magic)"
.PP
Captures responses or the lack there of from INFORMs that were sent 1) a response is received from an INFORM 2) one isn't received and the retries/timeouts have failed. 
.PP
Definition at line 850 of file agent_trap.c.
.SS "int netsnmp_send_traps (int trap, int specific, oid * enterprise, int enterprise_length, \fBnetsnmp_variable_list\fP * vars, char * context, int flags)"
.PP
This function allows you to make a distinction between generic traps from different classes of equipment. For example, you may want to handle a SNMP_TRAP_LINKDOWN trap for a particular device in a different manner to a generic system SNMP_TRAP_LINKDOWN trap.
.PP
\fBParameters:\fP
.RS 4
\fItrap\fP is the generic trap type. The trap types are:
.IP "\(bu" 2
SNMP_TRAP_COLDSTART: cold start
.IP "\(bu" 2
SNMP_TRAP_WARMSTART: warm start
.IP "\(bu" 2
SNMP_TRAP_LINKDOWN: link down
.IP "\(bu" 2
SNMP_TRAP_LINKUP: link up
.IP "\(bu" 2
SNMP_TRAP_AUTHFAIL: authentication failure
.IP "\(bu" 2
SNMP_TRAP_EGPNEIGHBORLOSS: egp neighbor loss
.IP "\(bu" 2
SNMP_TRAP_ENTERPRISESPECIFIC: enterprise specific
.PP
.br
\fIspecific\fP is the specific trap value.
.br
\fIenterprise\fP is an enterprise oid in which you want to send specifc traps from.
.br
\fIenterprise_length\fP is the length of the enterprise oid, use macro, OID_LENGTH, to compute length.
.br
\fIvars\fP is used to supply list of \fBvariable\fP bindings to form an SNMPv2 trap.
.br
\fIcontext\fP currently unused
.br
\fIflags\fP currently unused
.RE
.PP
\fBReturns:\fP
.RS 4
void
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsend_easy_trap\fP 
.PP
\fBsend_v2trap\fP 
.RE
.PP

.PP
Definition at line 629 of file agent_trap.c.
.SS "void send_easy_trap (int trap, int specific)"
.PP
Sends an SNMPv1 trap (or the SNMPv2 equivalent) to the list of configured trap destinations (or 'sinks'), using the provided values for the generic trap type and specific trap value. This function eventually calls send_enterprise_trap_vars. If the trap type is not set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length paramater is set to the pre defined NETSNMP_SYSTEM_MIB oid and length respectively. If the trap type is set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length parameters are set to the pre-defined NETSNMP_NOTIFICATION_MIB oid and length respectively.
.PP
\fBParameters:\fP
.RS 4
\fItrap\fP is the generic trap type.
.br
\fIspecific\fP is the specific trap value.
.RE
.PP
\fBReturns:\fP
.RS 4
void
.RE
.PP
\fBSee also:\fP
.RS 4
send_enterprise_trap_vars 
.PP
\fBsend_v2trap\fP 
.RE
.PP

.PP
Definition at line 978 of file agent_trap.c.
.SS "void send_v2trap (\fBnetsnmp_variable_list\fP * vars)"
.PP
Uses the supplied list of \fBvariable\fP bindings to form an SNMPv2 trap, which is sent to SNMPv2-capable sinks on the configured list. An equivalent INFORM is sent to the configured list of inform sinks. Sinks that can only handle SNMPv1 traps are skipped.
.PP
This function eventually calls send_enterprise_trap_vars. If the trap type is not set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length paramater is set to the pre defined NETSNMP_SYSTEM_MIB oid and length respectively. If the trap type is set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length parameters are set to the pre-defined NETSNMP_NOTIFICATION_MIB oid and length respectively.
.PP
\fBParameters:\fP
.RS 4
\fIvars\fP is used to supply list of \fBvariable\fP bindings to form an SNMPv2 trap.
.RE
.PP
\fBReturns:\fP
.RS 4
void
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsend_easy_trap\fP 
.PP
send_enterprise_trap_vars 
.RE
.PP

.PP
\fBExamples: \fP
.in +1c
\fBnotification.c\fP.
.PP
Definition at line 1007 of file agent_trap.c.
.SH "Variable Documentation"
.PP 
.SS "oid snmptrapenterprise_oid[]"\fBInitial value:\fP
.PP
.nf

    { SNMPV2_TRAP_OBJS_PREFIX, 3, 0 }
.fi
.PP
Definition at line 99 of file agent_trap.c.
.SH "Author"
.PP 
Generated automatically by Doxygen for net-snmp from the source code.