-
Devices are unique within a tenant. But is it also possible to say that all devices and VMs should have unique names? Hence the question whether there is a function / configuration field in which the name Device Name and VM Name must always be unique. I've already told you where to do this. I just don't know how to do it.
https://docs.netbox.dev/en/stable/customization/custom-validation/ Addendum: I have just found something that looks like what I am looking for. However, I have no idea where to write such a validation class: |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 8 replies
-
You write your own custom validator (as a py file) and make it available to Netbox. Whether that be through a datasource or uploading directly to the server. For example, here's a custom validator I have that I've put at
Then in the config I have the following for custom validators:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I have no idea, but I know a lot about it. 😄 Python File
Custom validators
The information to be provided must be derived from the path of these files and their classes. You will find the names from the script again and can adapt this to the topic of virtual machines. |
Beta Was this translation helpful? Give feedback.
-
Oh man, it doesn't work like that. |
Beta Was this translation helpful? Give feedback.
-
My thanks go to: Final version Description WebUI: Configuration History --> Custom vakidators
/opt/netbox/validators/custom.py
|
Beta Was this translation helpful? Give feedback.
-
Does anyone happen to know how to check a customer field for uniqueness? Customer Fields Name: DCIM_Device_InventoryNo |
Beta Was this translation helpful? Give feedback.
My thanks go to:
@domainzero --> Creator of the base script on which I have built.
@Mailstorm-ctrl --> Who helped me reach my goal.
@candlerb --> Who helped me reach my goal.
Final version
You can find everything you need to understand it in the entries above.
Description
This version allows the name of a virtual machine and of a device to appear only once in the entire Netbox system. Changing the VM/device also works in this version. (The comments in the script are in German. Increases the Google hits for German ;)
WebUI: Configuration History --> Custom vakidators