snmpd.conf 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. {%- import "globals.sls" as globals with context %}
  2. {%- set ro_community = salt['pillar.get'] ('ffho:snmp:ro_community', "Configure ffho:snmp:ro_community in pillar...") %}
  3. #
  4. # /etc/snmp/snmpd.conf (Salt managed)
  5. #
  6. # Listen for connections from the local system
  7. agentAddress udp:127.0.0.1:161
  8. agentAddress udp6:[::1]:161
  9. # Listen for connections on Loopback-IPs
  10. {%- for ipv4 in grains['ipv4'] %}
  11. {%- if ipv4.startswith ('10.132.255.') %}
  12. agentAddress udp:{{ ipv4 }}:161
  13. {%- endif %}
  14. {%- endfor %}
  15. {%- for ipv6 in grains['ipv6'] %}
  16. {%- if ipv6.startswith ('2a03:2260:2342:ffff:') or ipv6.startswith ('fdca:ffee:ff12:ffff:') %}
  17. agentAddress udp6:[{{ ipv6 }}]:161
  18. {%- endif %}
  19. {%- endfor %}
  20. rocommunity {{ ro_community }} 127.0.0.1
  21. rocommunity {{ ro_community }} 10.132.251.161
  22. rocommunity6 {{ ro_community }} ::1
  23. rocommunity6 {{ ro_community }} fdca:ffee:ff12:a251::161
  24. sysLocation {{ globals.SYS_LOCATION }}
  25. sysContact ops@ffho.net
  26. sysServices 72
  27. #
  28. # Network interfaces
  29. #
  30. {%- if 'gateway' in globals.ROLES %}
  31. # Set B.A.T.M.A.N. related devices to 100 MBit/s
  32. interface bat0 6 100000000
  33. interface inter-gw-vpn 6 100000000
  34. interface mesh-vpn-v4 6 100000000
  35. interface mesh-vpn-v6 6 100000000
  36. {%- endif %}
  37. {%- set ovpn_networks = [] %}
  38. {%- for netname, network in salt['pillar.get']('ovpn', {}).items () if grains['id'] in network %}
  39. {%- do ovpn_networks.append (netname) %}
  40. {%- endfor %}
  41. {%- for netname in ovpn_networks|sort %}
  42. {%- set network = salt['pillar.get']('ovpn:' ~ netname) %}
  43. {%- set network_config = network.get ('config') %}
  44. {%- set host_stanza = network.get (grains['id']) %}
  45. {%- set host_config = host_stanza.get ('config', {}) %}
  46. {%- set interface = host_config.get ('interface', network_config.get ('interface')) %}
  47. {%- if loop.first %}
  48. # OpenVPN interfaces
  49. {%- endif %}
  50. interface {{ interface }} 6 100000000
  51. {%- endfor %}
  52. #
  53. # Try to figure out meaningful interface descriptions/aliases
  54. pass .1.3.6.1.2.1.31.1.1.1.18 /etc/snmp/ifAlias
  55. #
  56. # Disk Monitoring
  57. #
  58. # 10MBs required on root disk, 5% free on /var, 10% free on all other disks
  59. disk / 10000
  60. disk /var 5%
  61. includeAllDisks 10%
  62. # Walk the UCD-SNMP-MIB::dskTable to see the resulting output
  63. # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
  64. #
  65. # System Load
  66. #
  67. # Unacceptable 1-, 5-, and 15-minute load averages
  68. load 12 10 5
  69. # Walk the UCD-SNMP-MIB::laTable to see the resulting output
  70. # Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
  71. #
  72. # Event MIB - automatically generate alerts
  73. #
  74. # Remember to activate the 'createUser' lines above
  75. iquerySecName internalUser
  76. rouser internalUser
  77. # generate traps on UCD error conditions
  78. defaultMonitors no
  79. # generate traps on linkUp/Down
  80. linkUpDownNotifications no
  81. master agentx