The Hoof & Paw
DocsCategoriesTagsView the current conditions from the WolfspyreLabs WeatherstationToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

How to enable SNMPD on Mac OSX

Enabling snmpd on OSX Hosts

These steps don’t require a system restart and are non-service affecting.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
agentAddress  udp:161
sysName       pewpewpew
sysLocation    ['30.3295110','-97.7560740']
sysContact     Me <pewpewpew@wolfspaw.com>
sysObjectID 1.3.6.1.4.1.50536.3.1
sysServices    76
rwcommunity "w01f5paw" default
view   default included   .1
view   default included   .1.3.6.1.2.1
#view   default included   .1.3.6.1.2.1.25.1

disk       /     10%
disk       /System/Volumes/Data  10%

load   12 10 5
#  Arbitrary extension commands
#
#extend-sh test3   /bin/sh /tmp/shtest

#"Macmini9,1"
extend .1.3.6.1.4.1.2021.7890.2 hardware /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin status info | /usr/bin/awk  '/TechnicalModelName/ {print $3}'
extend .1.3.6.1.4.1.2021.7890.3 vendor   /bin/echo 'Apple Inc'
extend .1.3.6.1.4.1.2021.7890.4 serial   /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin status info | /usr/bin/awk  '/hwSerialNumber/ {print $3}'
extend uptime /bin/cat /proc/uptime
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/local/bin/distro
# This line enables Observium's ifAlias description injection
pass_persist .1.3.6.1.2.1.31.1.1.1.18 /usr/local/bin/ifAlias_persist
  • Open a new terminal window.
  • Create a backup of the default SNMP configuration file:
    • sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
    • Create and edit a new SNMP configuration file:
      1
      2
      
      com2sec mynetwork 9.10.11.12/24 public
      rocommunity public default .1
      

Replace 9.10.11.12/24 with the network address and CIDR mask of the subnet relevant to you.

Replace the community string public with another string.

  • Enable the SNMP daemon:

    • sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist
  • Restarting SNMPD

    • Imagine a time when you make changes to the config… if you don’t want to reboot, here’s how to kick SNMPD to pickup the changes:

sudo launchctl unload /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist