Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change name in Zabbix to a description from Netbox #77

Closed
Winstonshead opened this issue Oct 16, 2024 · 9 comments · Fixed by #80
Closed

Change name in Zabbix to a description from Netbox #77

Winstonshead opened this issue Oct 16, 2024 · 9 comments · Fixed by #80
Assignees
Labels
bug Something isn't working

Comments

@Winstonshead
Copy link

Greetings!
I want to use some characters in device names in Netbox that cannot be used in host names in Zabbix, so I get an error, eventually the host is not added from Netbox.
I would like Zabbix to take the device description from Netbox and substitute it into the hostname field. How can I do this?
Thanks!

@TheNetworkGuy
Copy link
Owner

Hi! Can you give an example and some logging? The scenario that you are describing should be fixed with #58 .

@Winstonshead
Copy link
Author

Hi! Can you give an example and some logging? The scenario that you are describing should be fixed with #58 .

I use Cyrillic on Netbox
IMG_20241024_162959_341

@TheNetworkGuy
Copy link
Owner

TheNetworkGuy commented Oct 24, 2024

Thanks! After looking at it for a 2nd time there are a couple of characters that could be breaking the script. I'll check if i can add this to the list of exceptions, should be a pretty easy fix :)

Can you copy / paste the line specifically with the warning message? That will allow me to identify any characters which i did not register in the exceptions list.

@TheNetworkGuy TheNetworkGuy self-assigned this Oct 24, 2024
@TheNetworkGuy TheNetworkGuy added the bug Something isn't working label Oct 24, 2024
@TheNetworkGuy
Copy link
Owner

@Winstonshead If you have the time to copy / paste that warning message then that would help me out a lot! Thanks in advance.

@TheNetworkGuy
Copy link
Owner

I'll close this issue for now since its getting stale. You can always re-open this issue if you have more information.

@Winstonshead
Copy link
Author

@TheNetworkGuy I'm so sorry, had too many work last time, here it is:

2024-11-08 10:14:07,220 - Netbox-Zabbix-sync - DEBUG - Device Краснопролетарская 9: matched group Teraline Transport/MikroTik/RB-OSPF
2024-11-08 10:14:07,220 - Netbox-Zabbix-sync - DEBUG - Device Краснопролетарская 9: found template MikroTik hEX PoE lite by SNMP
2024-11-08 10:14:07,296 - Netbox-Zabbix-sync - WARNING - Device Краснопролетарская 9: hostname OUT of sync. Received value: V_Krasnoproletarskaya_9
2024-11-08 10:14:07,382 - Netbox-Zabbix-sync - ERROR - Device Краснопролетарская 9: Unable to update. Zabbix returned the following error: Invalid params. Incorrect characters used for host name "Краснопролетарская 9"..

It's log after I renamed "V_Krasnoproletarskaya_9" to "Краснопролетарская 9"
If I use "Краснопролетарская XX" when adding new host, it's just not works, host is not adding to zabbix

@TheNetworkGuy
Copy link
Owner

@Winstonshead No worries, that stuff tends to happen :) Thanks for your reply, i'll push it to the development branch on which i am currently working on!

@TheNetworkGuy TheNetworkGuy reopened this Nov 13, 2024
@TheNetworkGuy
Copy link
Owner

TheNetworkGuy commented Nov 13, 2024

Before:

2024-11-13 19:35:57,646 - Netbox-Zabbix-sync - DEBUG - Host Краснопролетарская 9: started operations on device.
2024-11-13 19:35:57,772 - Netbox-Zabbix-sync - DEBUG - Host Краснопролетарская 9: matched group Testsite/Generic/Switch
2024-11-13 19:35:57,772 - Netbox-Zabbix-sync - DEBUG - Host Краснопролетарская 9: found template TrueNAS CORE by SNMP
2024-11-13 19:35:57,813 - Netbox-Zabbix-sync - ERROR - Host Краснопролетарская 9: Couldn't create. Zabbix returned Invalid params. Incorrect characters used for host name "Краснопролетарская 9"..

And after:

2024-11-13 19:36:58,126 - Netbox-Zabbix-sync - INFO - Host Краснопролетарская 9 contains special characters. Using NETBOX_ID107 as name for the Netbox object and using Краснопролетарская 9 as visible name in Zabbix.
2024-11-13 19:36:58,126 - Netbox-Zabbix-sync - DEBUG - Host NETBOX_ID107: started operations on device.
2024-11-13 19:36:58,426 - Netbox-Zabbix-sync - DEBUG - Host NETBOX_ID107: matched group Testsite/Generic/Switch
2024-11-13 19:36:58,426 - Netbox-Zabbix-sync - DEBUG - Host NETBOX_ID107: found template TrueNAS CORE by SNMP
2024-11-13 19:36:58,774 - Netbox-Zabbix-sync - INFO - Host NETBOX_ID107: Created host in Zabbix.

I just tested this and the host seems to work fine in Zabbix :)

Screenshot from 2024-11-13 19-37-43

I'll post in this issue once the development branch has been pushed to the main branch! :)

@Winstonshead
Copy link
Author

Oh, cool! I will test later, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants