How to configure the trapmon sampler for SNMP version 3
This article outlines how you would setup the trapmon sampler when SNMP version 3 traps are to be received. These instructions assume that the traps are to be collected on a RHEL based system.
Prequisites Copied
- A net-snmp installation - this will be used for creating the snmp configuration file.
# yum install -y net-snmp
Creating the configuration file Copied
When creating the configuration file you will need to supply a username, an authentication passphrase, an encryption passphrase, and you will need the engineID of the device sending the traps.
Creating the SNMP user Copied
Run the net-snmp-create-v3-user utility which will add a createUser line in the file /var/lib/net-snmp/snmpd.conf
e.g. For a read-only snmp user.
## net-snmp-create-v3-user -ro -a SHA -A authpassword -x AES -X encpassword snmpV3user
With the above input you should see the following message:
adding the following line to /var/lib/net-snmp/snmpd.conf:
createUser snmpV3user SHA "authpassword " AES "encpassword "
adding the following line to /etc/snmp/snmpd.conf:
rouser snmpV3user
This will have added the following line to /var/lib/net-snmp/snmpd.conf
createUser snmpV3user SHA authpassword AES encpassword
Adding the EngineID Copied
You now need to get the EngineID of the device sending the snmp traps and add this in /var/lib/net-snmp/snmpd.conf
How the engineID is determined will depend entirely on the particulars of the device.
Modify the createUser line in /var/lib/net-snmp/snmpd.conf Copied
You need to add the engineID to this line so it will now look like the example below where 80001f888015e0c94ccade7a65000000 is the hex engine id.
createUser -e 0x80001f888015e0c94ccade7a65000000 snmpV3user SHA authpassword AES encpassword
Convert the config file entry to the correct format Copied
Start and stop the snmpd service to convert the createUser entry to a usmUser entry.
# systemctl start snmpd
# systemctl stop snmpd
You should now have a line similar to that shown below in /var/lib/net-snmp/snmpd.conf
usmUser 1 3 0x80001f888015e0c94ccade7a65000000 "snmpV3user" "snmpV3user" NULL .1.3.6.1.6.3.10.1.1.3 0xb
8711c0e3c6b09d837b7d7438243bcf33fbd65f5 .1.3.6.1.6.3.10.1.2.4 0x05417c575eca0d5162dde2906abd316d ""
Configure the sampler Copied
To enable the trapmon sample to use snmp version 3 traps you must add add a configuration file entry in the Advanced tab in the GSE.
If you copy the /var/lib/net-snmp/snmpd.conf file to the netprobe directory you can specify it without a path, as shown below, otherwise you will need to specify an absolute path.
Example SNMP Trap command to generate a trap:
snmptrap -v 3 -e 80001f888015e0c94ccade7a6500000 -u snmpV3user -a SHA -A <authenticatedpassword> -x AES -X <encryptedpassword> 172.16.1.31:7007 '' 1.3.6.1.2.1.2.18.2.0.1
Note from above command 172.16.1.31 is the netprobe host – 7007 is the snmp port
Example dataview"