snmpd.conf 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. {%- set sites_config = salt['pillar.get'] ('sites', {}) %}
  7. {%- set ifaces = salt['ffho_net.get_interface_config'] (node_config, sites_config) %}
  8. #
  9. # /etc/snmp/snmpd.conf (Salt managed)
  10. #
  11. sysLocation {{ sys_location }}
  12. sysContact {{ sys_contact }}
  13. sysServices 72
  14. # Listen for connections from the local system
  15. agentAddress udp:127.0.0.1:161
  16. agentAddress udp6:[::1]:161
  17. # Listen for connections on Loopback-IPs
  18. agentAddress udp:{{ salt['ffho_net.get_loopback_ip'] (node_config, grains['id'], 'v4') }}:161
  19. agentAddress udp6:[{{ salt['ffho_net.get_loopback_ip'] (node_config, grains['id'], 'v6') }}]:161
  20. # We accept requests from those fine boxes
  21. rocommunity {{ ro_community }} 127.0.0.1
  22. rocommunity6 {{ ro_community }} ::1
  23. {%- for entry in nms_list %}
  24. {%- if ':' in entry %}
  25. rocommunity6 {{ ro_community }} {{ entry }}
  26. {%- else %}
  27. rocommunity {{ ro_community }} {{ entry }}
  28. {%- endif %}
  29. {%- endfor %}
  30. #
  31. # Network interfaces
  32. #
  33. # Set bandwidth of VLAN, B.A.T.M.A.N., bridge and vEth interface to 100Mb/s
  34. # The default is 10Mb/s which makes LibreNMS whine quite a lot if there is
  35. # a little traffic. 100Mb/s currently seems a decent idea for us but is not
  36. # an ideal value for everyone.
  37. {%- for iface in ifaces|sort %}
  38. {%- set config = ifaces.get (iface) %}
  39. {%- if 'vlan-raw-device' in config or "batman" in config or "bridge" in config or config.get ('link-type', '') == 'veth' %}
  40. interface {{ iface }} 6 100000000
  41. {%- endif %}
  42. {%- endfor %}
  43. {%- if "fastd" in node_config.get ('roles') %}
  44. {%- for site in node_config.get ('sites') %}
  45. interface {{ site }}_intergw 6 100000000
  46. {%- endfor %}
  47. {%- endif %}
  48. {%- set ovpn_networks = [] %}
  49. {%- for netname, network in salt['pillar.get']('ovpn', {}).items () if grains['id'] in network %}
  50. {%- do ovpn_networks.append (netname) %}
  51. {%- endfor %}
  52. {%- for netname in ovpn_networks|sort %}
  53. {%- set network = salt['pillar.get']('ovpn:' ~ netname) %}
  54. {%- set network_config = network.get ('config') %}
  55. {%- set host_stanza = network.get (grains['id']) %}
  56. {%- set host_config = host_stanza.get ('config', {}) %}
  57. {%- set interface = host_config.get ('interface', network_config.get ('interface')) %}
  58. {%- if loop.first %}
  59. # OpenVPN interfaces
  60. {%- endif %}
  61. interface {{ interface }} 6 100000000
  62. {%- endfor %}
  63. #
  64. # Disk Monitoring
  65. #
  66. # 10MBs required on root disk, 5% free on /var, 10% free on all other disks
  67. disk / 10000
  68. disk /var 5%
  69. includeAllDisks 10%
  70. # Walk the UCD-SNMP-MIB::dskTable to see the resulting output
  71. # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
  72. #
  73. # System Load
  74. #
  75. # Unacceptable 1-, 5-, and 15-minute load averages
  76. load 12 10 5
  77. # Walk the UCD-SNMP-MIB::laTable to see the resulting output
  78. # Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
  79. #
  80. # Event MIB - automatically generate alerts
  81. #
  82. # Remember to activate the 'createUser' lines above
  83. iquerySecName internalUser
  84. rouser internalUser
  85. # generate traps on UCD error conditions
  86. defaultMonitors no
  87. # generate traps on linkUp/Down
  88. linkUpDownNotifications no
  89. master agentx