G0nz0uk

config.py

Sep 25th, 2025
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 6.47 KB | None | 0 0
  1. ## Template logic.
  2. # Set to true to enable the template source information
  3. # coming from config context instead of a custom field.
  4. templates_config_context = False
  5.  
  6. # Set to true to give config context templates a
  7. # higher priority then custom field templates
  8. templates_config_context_overrule = False
  9.  
  10. # Set template and device NetBox "custom field" names
  11. # Template_cf is not used when templates_config_context is enabled
  12. template_cf = "zabbix_template"
  13. device_cf = "zabbix_hostid"
  14.  
  15. ## Enable clustering of devices with virtual chassis setup
  16. clustering = False
  17.  
  18. ## Enable hostgroup generation. Requires permissions in Zabbix
  19. create_hostgroups = True
  20.  
  21. ## Create journal entries
  22. create_journal = False
  23.  
  24. ## Virtual machine sync
  25. # Set sync_vms to True in order to use this new feature
  26. # Use the hostgroup vm_hostgroup_format mapper for specific
  27. # hostgroup atributes of VM's such as cluster_type and cluster
  28. sync_vms = False
  29. # Check the README documentation for values to use in the VM hostgroup format.
  30. vm_hostgroup_format = "cluster_type/cluster/role"
  31.  
  32. ## Proxy Sync
  33. # Set to true to enable removal of proxy's under hosts. Use with caution and make sure that you specified
  34. # all the required proxy's in the device config context before enabeling this option.
  35. # With this option disabled proxy's will only be added and modified for Zabbix hosts.
  36. full_proxy_sync = False
  37.  
  38. ## NetBox to Zabbix device state convertion
  39. zabbix_device_removal = ["Decommissioning", "Inventory"]
  40. zabbix_device_disable = ["Offline", "Planned", "Staged", "Failed"]
  41.  
  42. ## Hostgroup mapping
  43. # See the README documentation for available options
  44. # You can also use CF (custom field) names under the device. The CF content will be used for the hostgroup generation.
  45. #
  46. # When using region in the group name, the default behaviour is to use name of the directly assigned region.
  47. # By setting traverse_regions to True the full path of all parent regions will be used in the hostgroup, e.g.:
  48. #
  49. # 'Global/Europe/Netherlands/Amsterdam' instead of just 'Amsterdam'.
  50. #
  51. # traverse_site_groups controls the same behaviour for any assigned site_groups.
  52. hostgroup_format = "site/manufacturer/role"
  53. traverse_regions = False
  54. traverse_site_groups = False
  55.  
  56. ## Filtering
  57. # Custom device filter, variable must be present but can be left empty with no filtering.
  58. # A couple of examples:
  59. #  nb_device_filter = {} #No filter
  60. #  nb_device_filter = {"tag": "zabbix"} #Use a tag
  61. #  nb_device_filter = {"site": "HQ-AMS"} #Use a site name
  62. #  nb_device_filter = {"site": ["HQ-AMS", "HQ-FRA"]} #Device must be in either one of these sites
  63. #  nb_device_filter = {"site": "HQ-AMS", "tag": "zabbix", "role__n": ["PDU", "console-server"]} #Device must be in site HQ-AMS, have the tag zabbix and must not be part of the PDU or console-server role
  64.  
  65. # Default device filter, only get devices which have a name in NetBox:
  66. nb_device_filter = {"name__n": "null"}
  67. # Default filter for VMs
  68. nb_vm_filter = {"name__n": "null"}
  69.  
  70. ## Inventory
  71. # See https://www.zabbix.com/documentation/current/en/manual/config/hosts/inventory#building-inventory
  72. # Choice between disabled, manual or automatic.
  73. # Make sure to select at least manual or automatic in use with the inventory_sync function.
  74. inventory_mode = "disabled"
  75.  
  76. # To allow syncing of NetBox device properties, set inventory_sync to True
  77. inventory_sync = False
  78.  
  79. # inventory_map is used to map NetBox properties to Zabbix Inventory fields.
  80. # For nested properties, you can use the '/' seperator.
  81. # For example, the following map will assign the custom field 'mycustomfield' to the 'alias' Zabbix inventory field:
  82. #
  83. # device_inventory_map = { "custom_fields/mycustomfield/name": "alias"}
  84. #
  85. # The following maps should provide some nice defaults:
  86. device_inventory_map = { "asset_tag": "asset_tag",
  87.                          "virtual_chassis/name": "chassis",
  88.                          "status/label": "deployment_status",
  89.                          "location/name": "location",
  90.                          "latitude": "location_lat",
  91.                          "longitude": "location_lon",
  92.                          "comments": "notes",
  93.                          "name": "name",
  94.                          "rack/name": "site_rack",
  95.                          "serial": "serialno_a",
  96.                          "device_type/model": "type",
  97.                          "device_type/manufacturer/name": "vendor",
  98.                          "oob_ip/address": "oob_ip" }
  99.  
  100. # We also support inventory mapping on Virtual Machines.
  101. vm_inventory_map = { "status/label": "deployment_status",
  102.                      "comments": "notes",
  103.                      "name": "name" }
  104.  
  105. # To allow syncing of usermacros from NetBox, set to True.
  106. # this will enable both field mapping and config context usermacros.
  107. #
  108. # If set to "full", it will force the update of secret usermacros every run.
  109. # Please see the README.md for more information.
  110. usermacro_sync = False
  111.  
  112. # device usermacro_map to map NetBox fields to usermacros.
  113. device_usermacro_map = {"serial": "{$HW_SERIAL}",
  114.                         "role/name": "{$DEV_ROLE}",
  115.                         "url": "{$NB_URL}",
  116.                         "id": "{$NB_ID}"}
  117.  
  118. # virtual machine usermacro_map to map NetBox fields to usermacros.
  119. vm_usermacro_map = {"memory": "{$TOTAL_MEMORY}",
  120.                     "role/name": "{$DEV_ROLE}",
  121.                     "url": "{$NB_URL}",
  122.                     "id": "{$NB_ID}"}
  123.  
  124. # To sync host tags to Zabbix, set to True.
  125. tag_sync = False
  126.  
  127. # Setting tag_lower to True will lower capital letters ain tag names and values
  128. # This is more inline with the Zabbix way of working with tags.
  129. #
  130. # You can however set this to False to ensure capital letters are synced to Zabbix tags.
  131. tag_lower = True
  132.  
  133. # We can sync NetBox device/VM tags to Zabbix, but as NetBox tags don't follow the key/value
  134. # pattern, we need to specify a tag name to register the NetBox tags in Zabbix.
  135. #
  136. #
  137. #
  138. # If tag_name is set to False, we won't sync NetBox device/VM tags to Zabbix.
  139. tag_name = 'NetBox'
  140.  
  141. # We can choose to use 'name', 'slug' or 'display' NetBox tag properties as a value in Zabbix.
  142. # 'name'is used by default.
  143. tag_value = "name"
  144.  
  145. # device tag_map to map NetBox fields to host tags.
  146. device_tag_map = {"site/name": "site",
  147.                   "rack/name": "rack",
  148.                   "platform/name": "target"}
  149.  
  150. # Virtual machine tag_map to map NetBox fields to host tags.
  151. vm_tag_map = {"site/name": "site",
  152.               "cluster/name": "cluster",
  153.               "platform/name": "target"}
Advertisement
Add Comment
Please, Sign In to add comment