Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    BSNMP service not starting up

    Scheduled Pinned Locked Moved SNMP
    4 Posts 3 Posters 8.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mshundal
      last edited by

      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 :)

      1 Reply Last reply Reply Quote 0
      • E
        Eugene
        last edited by

        Try to change

        trap := ""
        

        to```
        trap := "mytrap"

        in /var/etc/snmpd.conf

        http://ru.doc.pfsense.org

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          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']}"
          

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • M
            mshundal
            last edited by

            thanks guys, that worked.

            I am just a little confused as to what this is and why this is need.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.