snmpd.conf 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. # Try to figure out meaningful interface descriptions/aliases
  50. pass .1.3.6.1.2.1.31.1.1.1.18 /etc/snmp/ifAlias
  51. #
  52. # Disk Monitoring
  53. #
  54. # 10MBs required on root disk, 5% free on /var, 10% free on all other disks
  55. disk / 10000
  56. disk /var 5%
  57. includeAllDisks 10%
  58. # Walk the UCD-SNMP-MIB::dskTable to see the resulting output
  59. # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
  60. #
  61. # System Load
  62. #
  63. # Unacceptable 1-, 5-, and 15-minute load averages
  64. load 12 10 5
  65. # Walk the UCD-SNMP-MIB::laTable to see the resulting output
  66. # Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
  67. #
  68. # Event MIB - automatically generate alerts
  69. #
  70. # Remember to activate the 'createUser' lines above
  71. iquerySecName internalUser
  72. rouser internalUser
  73. # generate traps on UCD error conditions
  74. defaultMonitors no
  75. # generate traps on linkUp/Down
  76. linkUpDownNotifications no
  77. master agentx