snmpd.conf 3.0 KB

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