Re: Issue with trapsess in snmpd.conf file

Magnus Fromreide <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
On Wed, Apr 29, 2020 at 02:46:30AM +0200, Philippe Denis wrote:
> Hello all,
> 
> I’m facing several issues when I’ve tried to send V3 traps from my Agent X to the master agent to trap recipient. The program linked to the trap generation was written by mib2c tool mainly. (Only dummies variables and values added)
> 
> I’ve added in my configuration file snmpd.conf file, the following line:
> trapsess 192.1.2.1
> 
> When I start the agent, I got the following error message “no community specified.” but when reading the man page it looks that the trap community is for trapsink, trap2sink and trapinform.
> 
> Is it correct ? Is there any option to use to know what is wrong ?

In the man page it says that trapsess should take arguments like snmptrapd.

In order to experiment I would run

  snmpd -Lo -d -f --trapsess="trapsess-params" 127.0.0.1

and then stop snmpd with Ctrl-C so for my first attempt, similar to
yours, I run

  snmpd -Lo -d -f --trapsess="127.0.0.1" 127.0.0.1

and snmpd happily prints

  Security name is missing.Cannot add new trap destination internal0

so something differs between our agents or configs. If I try with

  snmpd -Lo -d -f --trapsess="-v2c 127.0.0.1" 127.0.0.1

then my snmpd prints

  No community name specified.

and I suppose that is similar enough to your case but it is also a v2
notification so lets say explicitly that we want a v3 notification

  snmpd -Lo -d -f --trapsess="-v3 127.0.0.1" 127.0.0.1

prints

  Security name is missing.Cannot add new trap destination internal0

and the snmpcmd.1 man page states that -u is used to specify a securityName
so lets try that

  snmpd -Lo -d -f --trapsess="-v3 -u mySecurityName 127.0.0.1" 127.0.0.1

This results in my snmpd sending something with mySecurityName in it so I
suppose that is the startup notification.

In order to make this permanent I then add

trapsess -v3 -u mySecurityName 127.0.0.1

to my snmpd.conf

Does this help?

(The snmpd parameters mean
 -Lo - send logs to stdout
 -d  - log all traffic
 -f  - run in the foreground)

> I’m using tcpdump to sniff network but nothing is sent although the gdb debugger says that send_v2trap is OK.
> 
> Thanks by advance for your help.
> 
> Best Regards. 
> Ph. DENIS
> 
> _______________________________________________
> Net-snmp-coders mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.