HOWTO install net-snmp on osx
From Chaos
Contents |
Summary
The first thing I tried was using the pre-installed Net-SNMP (5.0.8) that Apple has built, and it didn't see all of my interfaces, and just generally sucked. So, upon further examination, I have decided to follow this HowTo on installing Net-SNMP 5.2.1 on OS X.
Details
Install Net-SNMP
1. First, we need to configure our net-snmp install:
root@localhost:~/net-snmp-5.2.1# ./configure --prefix=/usr --mandir=/usr/share/man \ --infodir=/usr/share/info \ --with-libwrap \ --with-defaults \ --prefix=/usr \ --with-persistent-directory=/var/db/ucd-snmp \ --with-mib-modules=host
2. Once the configure completes, I ran:
root@localhost:~/net-snmp-5.2.1# make && make install
3. If all goes well, you should see something like the following if you run 'snmpd -v':
root@localhost:~/net-snmp-5.2.1# snmpd -v NET-SNMP version: 5.2.1 Web: http://www.net-snmp.org/ Email: net-snmp-coders@lists.sourceforge.net
Setup snmpd.conf
1. This is what I use (generally) for my snmpd.conf. Please note that your settings might be different.
########################################################################### # # snmpd.conf # # - created by the snmpconf configuration program # ########################################################################### # SECTION: Access Control Setup # # This section defines who is allowed to talk to your running # snmp agent. # rocommunity: a SNMPv1/SNMPv2c read-only access community name # arguments: community [default|hostname|network/bits] [oid] rocommunity myrocommunity ########################################################################### # SECTION: Monitor Various Aspects of the Running Host # # The following check up on various aspects of a host. # disk: Check for disk space usage of a partition. # The agent can check the amount of available disk space, and make # sure it is above a set limit. # # disk PATH [MIN=100000] # # PATH: mount path to the disk in question. # MIN: Disks with space below this value will have the Mib's errorFlag set. # Can be a raw byte value or a percentage followed by the % # symbol. Default value = 100000. # # The results are reported in the dskTable section of the UCD-SNMP-MIB tree disk / disk /tmp disk /usr disk /var disk /var/backup ########################################################################### # SECTION: System Information Setup # # This section defines some of the information reported in # the "system" mib group in the mibII tree. # syslocation: The [typically physical] location of the system. # Note that setting this value here means that when trying to # perform an snmp SET operation to the sysLocation.0 variable will make # the agent return the "notWritable" error code. IE, including # this token in the snmpd.conf file will disable write access to # the variable. # arguments: location_string syslocation "My Data Center - Seattle, WA" # syscontact: The contact information for the administrator # Note that setting this value here means that when trying to # perform an snmp SET operation to the sysContact.0 variable will make # the agent return the "notWritable" error code. IE, including # this token in the snmpd.conf file will disable write access to # the variable. # arguments: contact_string syscontact "Your Name <you@youremail.com>"
2. Fire up snmpd:
root@app1:/usr/share/snmp/snmpd-confs# /usr/sbin/snmpd -c /usr/share/snmp/snmpd-confs/snmpd.conf
3. SNMPWalk the MIBs, to see what you get. You should get plenty of information:
root@otherserver:~/# snmpwalk -Os -c public -v 2c localhost | less