Ultra-minimal / aggressive /etc/snmp/snmpd.conf

echo '
# map community -> security name
com2sec readonly  default         public

# map security name -> group (both v1 and v2c)
group   MyROGroup   v1             readonly
group   MyROGroup   v2c            readonly

# define view "restricted": include everything then exclude .1.3.6.1.4.1.8072
view restricted included .1
view restricted excluded .1.3.6.1.4.1.8072

# give MyROGroup read access to the "restricted" view
# syntax: access  <group>  <context>  <secModel>  <secLevel>  <match>  <readView>  <writeView>  <notifyView>
access MyROGroup "" any noauth exact restricted none none
' | sudo tee /etc/snmp/snmpd.conf
sudo systemctl restart snmpd
echo '
# Listen on all interfaces
agentAddress udp:161

# SNMPv2c read-only community (change "public")
rocommunity public

# Expose everything under .1 (entire MIB tree)
view all included .1

# Apply the view globally
rouser snmpuser
vacmViewName snmpdView
view snmpdView included .1

# All disks and processes
includeAllDisks 1
proc all

# Basic system metadata
sysLocation "Server"
sysContact "admin"
' | sudo tee /etc/snmp/snmpd.conf
sudo systemctl restart snmpd

No comments: