Install WSL
The net-snmp package works well on Linux, so let's use the Windows Subsystem for Linux (WSL) to use it, see:
Install net-snmp
Open a bash command prompt by running the Debian
program from the Start menu. Enter the commands below to update the package manaer and install net-snmp. If prompted by sudo, enter the password for your user account (created during the WSL install).
% sudo apt-get update
% sudo apt install snmp snmptrapd
Create an snmptrapd config file
snmptrapd
needs a configuration file. This file must be under /root/.snmp because the command is run as root. Perform these commands:
% sudo mkdir /root/.snmp
% echo disableAuthorization yes | sudo tee /root/.snmp/snmptrapd.conf
Run snmptrapd
Enter this command to start the trap daemon in the foreground:
% sudo snmptrapd -f -L o
NET-SNMP version 5.7.3
Generate a trap
Open another bash
window. Enter this command:
% sudo snmptrap -v 2c -c public localhost SNMPv2-MIB::coldStart 0 .1 string hi
Expect this output in the snmptrapd window:
2020-05-19 20:43:25 localhost [UDP: [127.0.0.1]:52869->[127.0.0.1]:162]:
iso.3.6.1.6.3.1.1.4.1.0 = OID: ccitt.0 ccitt.1 = STRING: "hi"