snmpd.conf 3.2 KB

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