snmpd.conf 3.1 KB

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