BSNMP service not starting up
-
Hi,
snmpd keeps crashing on startup; caught the following in the system logs:
Apr 20 10:46:43 snmpd[25257]: assignment to begemotTrapSinkComm.192.168.4.20.162 returns 10 Apr 20 10:46:43 snmpd[25257]: in file /var/etc/snmpd.conf line 17 Apr 20 10:46:43 snmpd[25257]: error in config file
my /etc/snmpd.conf:
# cat /etc/snmpd.config # $FreeBSD: src/etc/snmpd.config,v 1.9.8.1 2009/04/15 03:14:26 kensmith Exp $ # # Example configuration file for bsnmpd(1). # # # Set some common variables # location := "ABC" contact := "Meharban S. Hundal" system := 1 # FreeBSD traphost := "192.168.40.200" trapport := "162" # Change this! read := "public" # Uncomment begemotSnmpdCommunityString.0.2 below that sets the community # string to enable write access. write := "geheim" trap := "mytrap" # # Configuration # %snmpd begemotSnmpdDebugDumpPdus = 2 begemotSnmpdDebugSyslogPri = 7 # # Set the read and write communities. # # The default value of the community strings is NULL (note, that this is # different from the empty string). This disables both read and write access. # To enable read access only the read community string must be set. Setting # the write community string enables both read and write access with that # string. # # Be sure to understand the security implications of SNMPv2 - the community # strings are readable on the wire! # begemotSnmpdCommunityString.0.1 = $(read) # begemotSnmpdCommunityString.0.2 = $(write) begemotSnmpdCommunityDisable = 0 # open standard SNMP ports begemotSnmpdPortStatus.0.0.0.0.161 = 1 # open a unix domain socket begemotSnmpdLocalPortStatus."/var/run/snmpd.sock" = 1 begemotSnmpdLocalPortType."/var/run/snmpd.sock" = 4 # send traps to the traphost begemotTrapSinkStatus.[$(traphost)].$(trapport) = 4 begemotTrapSinkVersion.[$(traphost)].$(trapport) = 2 begemotTrapSinkComm.[$(traphost)].$(trapport) = $(trap) sysContact = $(contact) sysLocation = $(location) sysObjectId = 1.3.6.1.4.1.12325.1.1.2.1.$(system) snmpEnableAuthenTraps = 2 # # Load MIB-2 module # begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so" # Force a polling rate for the 64-bit interface counters in case # the automatic computation is wrong (which may be the case if an interface # announces the wrong bit rate via its MIB). %mibII begemotIfForcePoll = 2000 # # Netgraph module # begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so" # %netgraph begemotNgControlNodeName = "snmpd" # # pf(4) module # begemotSnmpdModulePath."pf" = "/usr/lib/snmp_pf.so" # # Host resources module # This requires the mibII module. # begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so" # # Bridge module # This requires the mibII module. # begemotSnmpdModulePath."bridge" = "/usr/lib/snmp_bridge.so" #
my /var/etc/snmpd.conf file:
# cat /var/etc/snmpd.conf location := "ABC" contact := "Meharban S Hundal" read := "public" # SNMP Trap support. traphost := 192.168.40.200 trapport := 162 trap := "" system := 1 # pfSense %snmpd begemotSnmpdDebugDumpPdus = 2 begemotSnmpdDebugSyslogPri = 7 begemotSnmpdCommunityString.0.1 = $(read) begemotTrapSinkStatus.[$(traphost)].$(trapport) = 4 begemotTrapSinkVersion.[$(traphost)].$(trapport) = 2 begemotTrapSinkComm.[$(traphost)].$(trapport) = $(trap) begemotSnmpdCommunityDisable = 1 begemotSnmpdPortStatus.0.0.0.0.161 = 1 begemotSnmpdLocalPortStatus."/var/run/snmpd.sock" = 1 begemotSnmpdLocalPortType."/var/run/snmpd.sock" = 4 # These are bsnmp macros not php vars. sysContact = $(contact) sysLocation = $(location) sysObjectId = 1.3.6.1.4.1.12325.1.1.2.1.$(system) snmpEnableAuthenTraps = 2 begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so" begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so" %netgraph begemotNgControlNodeName = "snmpd" begemotSnmpdModulePath."pf" = "/usr/lib/snmp_pf.so" begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so" #
tried the following from command prompt and system log shows the same exact crash/no start info as above
/usr/sbin/bsnmpd -c /var/etc/snmpd.conf -p /var/run/snmpd.pid
any help/hints/tips are greatly appreciated :)
-
Try to change
trap := ""
to```
trap := "mytrap"in /var/etc/snmpd.conf
-
Or just fill in the "trap string" in the GUI. I thought this had input validation to prevent it being left blank, but I guess not :-)
from /etc/inc/services.inc line 701:
trap := "{$config['snmpd']['trapstring']}"
-
thanks guys, that worked.
I am just a little confused as to what this is and why this is need.
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.