Skip to content
Oliver Gorwits edited this page Dec 30, 2018 · 3 revisions

View configuration paths used in the build

snmpd -f -Lo -Dread_config -H 2>&1 | grep "config path" | head -1

For example (on MacOS):

read_config:path:
config path used for snmpd:
/etc/snmp:/usr/share/snmp:/usr/lib/snmp:/Users/oliver/.snmp
(persistent path:/var/db/net-snmp)`

Or even better, use net-snmp-config:

--configure-options   display original configure arguments
--prefix              display the installation prefix
--snmpd-module-list   display the modules compiled into the agent
--default-mibs        display default list of MIBs
--default-mibdirs     display default list of MIB directories
--snmpconfpath        display default SNMPCONFPATH
--persistent-directory display default persistent directory
--perlprog            display path to perl for the perl modules

Interesting environment variables

  • SNMPCONFPATH

  • SNMP_PERSISTENT_DIR

  • MIBDIRS

  • MIB

MacOS Mojave Build Environment

  1. Install the XCode command line toolset, either by running:

    xcode-select --install
  2. Install Homebrew: https://brew.sh/

  3. Install net-snmp: brew install net-snmp

  4. Install PhantomJS: brew cask install phantomjs

  5. Install Perlbrew: https://perlbrew.pl/

  6. Build a Perl and set it as the new default for your user:

    perlbrew install perl-5.28.1
    perlbrew switch perl-5.28.1
  7. Configure your environment:

    cat >> ~/.profile
    export ND_PHANTOMJS='/usr/local/bin/phantomjs'
    # net-snmp 5.8 from homebrew
    PATH="/usr/local/opt/net-snmp/bin:$PATH"
    PATH="/usr/local/opt/net-snmp/sbin:$PATH"
    LDFLAGS="-L/usr/local/opt/net-snmp/lib"
    CPPFLAGS="-I/usr/local/opt/net-snmp/include"
    # perl 5.28.1 instead of system perl
    source ~/perl5/perlbrew/etc/bashrc

That’s it. You should not need local::lib with this setup as perlbrew runs one for perl-5.28.1 for you automagically.

Clone this wiki locally