snmpd.conf 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. {%- import "globals.sls" as globals with context %}
  2. {%- set node_config = salt['pillar.get'] ('nodes:' ~ grains['id']) %}
  3. {%- set ro_community = salt['pillar.get'] ('ffho:snmp:ro_community', "Configure ffho:snmp:ro_community 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 ops@ffho.net
  21. sysServices 72
  22. #
  23. # Network interfaces
  24. #
  25. {%- if 'gateway' in globals.ROLES %}
  26. # Set B.A.T.M.A.N. related devices to 100 MBit/s
  27. interface bat0 6 100000000
  28. interface inter-gw-vpn 6 100000000
  29. interface mesh-vpn-v4 6 100000000
  30. interface mesh-vpn-v6 6 100000000
  31. {%- endif %}
  32. {%- set ovpn_networks = [] %}
  33. {%- for netname, network in salt['pillar.get']('ovpn', {}).items () if grains['id'] in network %}
  34. {%- do ovpn_networks.append (netname) %}
  35. {%- endfor %}
  36. {%- for netname in ovpn_networks|sort %}
  37. {%- set network = salt['pillar.get']('ovpn:' ~ netname) %}
  38. {%- set network_config = network.get ('config') %}
  39. {%- set host_stanza = network.get (grains['id']) %}
  40. {%- set host_config = host_stanza.get ('config', {}) %}
  41. {%- set interface = host_config.get ('interface', network_config.get ('interface')) %}
  42. {%- if loop.first %}
  43. # OpenVPN interfaces
  44. {%- endif %}
  45. interface {{ interface }} 6 100000000
  46. {%- endfor %}
  47. #
  48. # Try to figure out meaningful interface descriptions/aliases
  49. pass .1.3.6.1.2.1.31.1.1.1.18 /etc/snmp/ifAlias
  50. #
  51. # Disk Monitoring
  52. #
  53. # 10MBs required on root disk, 5% free on /var, 10% free on all other disks
  54. disk / 10000
  55. disk /var 5%
  56. includeAllDisks 10%
  57. # Walk the UCD-SNMP-MIB::dskTable to see the resulting output
  58. # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
  59. #
  60. # System Load
  61. #
  62. # Unacceptable 1-, 5-, and 15-minute load averages
  63. load 12 10 5
  64. # Walk the UCD-SNMP-MIB::laTable to see the resulting output
  65. # Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
  66. #
  67. # Event MIB - automatically generate alerts
  68. #
  69. # Remember to activate the 'createUser' lines above
  70. iquerySecName internalUser
  71. rouser internalUser
  72. # generate traps on UCD error conditions
  73. defaultMonitors no
  74. # generate traps on linkUp/Down
  75. linkUpDownNotifications no
  76. master agentx