How to Install and Configure SNMP on macOS Monterey for Nagios Monitoring


Prerequisites
Before starting, ensure you have:
- A macOS system running macOS 12 Monterey or later on Apple Silicon.
- Administrator privileges (sudo access).
- An active Nagios Core or Nagios XI server to receive monitoring data.
- Basic familiarity with the Terminal and command-line tools.
Step 1: Verify SNMP Availability
macOS includes a built-in SNMP daemon (snmpd), but it’s not enabled by default. You don’t need to install it separately—only configure and activate it.
1.1 Check SNMP Version
Open Terminal and verify that SNMP tools are present:
snmpd --version
You should see output like NET-SNMP version: 5.x.x. If not, macOS Monterey includes it natively, and we’ll proceed to configure it.
Step 2: Configure SNMP on macOS
The SNMP configuration file is located at /etc/snmp/snmpd.conf, but it may not exist yet. We’ll create and edit it.
2.1 Create or Edit the SNMP Configuration File
Run the following command to edit the configuration file:
sudo mkdir -p /etc/snmp
sudo nano /etc/snmp/snmpd.conf
2.2 Add Basic Configuration
Paste the following minimal configuration into /etc/snmp/snmpd.conf:
# Set a read-only community string (replace "public" with a secure value)
rocommunity Str0ngC0mmunity!
# Restrict access to your Nagios server's IP
rocommunity Str0ngC0mmunity! <Nagios_IP_address>
# Define system information
sysLocation "Your Location"
sysContact "Your Name <your.email@example.com>"
sysName "YourMacHostname"
- Replace Str0ngC0mmunity! with a secure community string (like a password for SNMP).
- Replace <Nagios_IP_address> with the IP of your Nagios server.
- Customize sysLocation, sysContact, and sysName as needed.
Save and exit (Ctrl+X, then Y, then Enter).
2.3 Set Permissions
Ensure the file is readable by the SNMP daemon:
sudo chmod 600 /etc/snmp/snmpd.conf
Step 3: Enable SNMP Service
macOS uses launchd to manage services, including snmpd. The SNMP daemon is pre-installed but disabled by default.
3.1 Locate the SNMP Daemon
The SNMP service is controlled by /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist. You don’t need to create this file—it’s already present.
3.2 Enable the SNMP Service
Load and start the service:
sudo launchctl list | grep snmpd
You should see org.net-snmp.snmpd listed with a PID (process ID).
Step 4: Test SNMP Locally
4.1 Test SNMP Queries
Use the snmpwalk command to verify SNMP is working locally:
snmpwalk -v2c -c Str0ngC0mmunity! localhost
- Replace Str0ngC0mmunity! with your community string.
- You should see a list of SNMP data (e.g., system info). If you get a timeout or error, check your configuration and ensure snmpd is running.
4.2 Check Listening Port
SNMP uses UDP port 161. Verify it’s listening:
sudo netstat -an | grep 161
You should see output like udp4 0 0 *.161 *.*.
Step 5: Allow SNMP Through Firewall (Optional)
If macOS Monterey’s firewall is enabled, you need to allow SNMP traffic.
5.1 Open Firewall Settings
Go to System Preferences > Security & Privacy > Firewall, unlock it, and click Firewall Options.
5.2 Add SNMP Exception
Add /usr/sbin/snmpd to the list of allowed applications, or manually allow UDP port 161 via Terminal:
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/sbin/snmpd
Step 6: Test from Nagios Server
From your Nagios server, test connectivity:
snmpwalk -v2c -c Str0ngC0mmunity! <your_mac_ip>
Replace Str0ngC0mmunity! with your community string and <your_mac_ip> with your macOS system’s IP.
If successful, you’ll see SNMP data returned.
Step 7: Add SNMP to Nagios
On your Nagios XI web GUI:
- Navigate to Configure > Configuration Wizards.

- Select SNMP (or Network Device if no specific SNMP wizard exists).
- Enter the following:
- IP Address: Your macOS system’s IP.

- Community String: Str0ngC0mmunity! (or your custom value).
- Follow the wizard to select metrics (e.g., CPU, memory, disk usage).

- Click Finish to complete the setup.
For Nagios Core, edit your configuration files (e.g., /usr/local/nagios/etc/objects/) manually:
define host {
use generic-host
host_name macos-monterey
alias MacOS Monterey
address <your_mac_ip>
}
define service {
use generic-service
host_name macos-monterey
service_description CPU Usage
check_command check_snmp!-C Str0ngC0mmunity! -o .1.3.6.1.4.1.2021.11.10.0
}
Adjust OIDs (Object Identifiers) for specific metrics as needed.
Conclusion
By following these steps, you’ve successfully enabled and configured SNMP on macOS Monterey for Apple Silicon. Your Nagios monitoring server can now collect system metrics via SNMP in real time.
For further support, refer to:
- Nagios Support Forum: https://support.nagios.com/forum/
- Nagios Knowledge Base: https://support.nagios.com/kb/
- macOS SNMP Documentation: man snmpd in Terminal