First install the SNMP daemon with these commands:
You will now find the SNMP configuration in /etc/snmp/snmpd.config. Make a backup of the original configuration file and open snmpd.config with an editor. Find the following entry:
Change the security setting paranoid to readonly or readwrite. Just like SNMP on Windows, adjust the community string if needed. Now restart the SNMP daemon with
and you have accomplished the basic setup for SNMP v1 and SNMP v2c.
It might be necessary to create a usable snmpd.config first. You can start a basic setup with this command:
These steps don’t require a system restart and are non-service affecting.
sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
sudo nano /etc/snmp/snmpd.conf
Enter the following in the new configuration file:
com2sec mynetwork <NETWORK/CIDR> public
rocommunity public default .1
Replace <NETWORK/CIDR> with the network address and CIDR mask of the subnet. Replace the community string “public” with another string if that’s your preference.
Press CTRL-X to save the configuration file and exit the nano editor.
sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist
Note: If you later change the SNMP settings on your Mac, you’ll need to run the following two commands instead of the launchctl command above:
sudo launchctl unload /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist