TheNetworkGuy / netbox-zabbix-sync

Python script to synchronise Netbox devices to Zabbix.
MIT License
109 stars 27 forks source link

Updated without changes in customfields #33

Closed Domisiding closed 1 year ago

Domisiding commented 1 year ago

Hello, with the current sync, Netbox is running an update, but nothing is entered.

zabbix-sync

TheNetworkGuy commented 1 year ago

Hmm interesting, i'll take a look at the script later this evening. I presume that you didn't specify a Zabbix Template under the device type?

Domisiding commented 1 year ago

Hi, it creates everything on Zabbix side and also sends an update request to the Netbox only without changes. In the device type is everything required inside, the script works fine except for the entry of the HostID in the device itself.

Domisiding commented 1 year ago

Just checked again to be sure. The fields are correct in the config and still an empty changelog with no changes is sent.

zabbix-sync-hostid zabbix-sync-template

TheNetworkGuy commented 1 year ago

Very odd. Which version of Netbox and Zabbix are you running and can you do a git pull to make sure that we are running the same code?

I am unable to replicate this behavior with Zabbix 6.0.14, Netbox 3.4.7 and the latest version of this script.

What do the logs tell you about this device using the -v flag? And is there a log entry under the journal within Netbox?

Domisiding commented 1 year ago

We are running the latest version of Zabbix 6.4.1 and NetBox 3.4.7. We have the debugs on and there is no error, but since the servers are internal it runs over http.

TheNetworkGuy commented 1 year ago

Okay can you show me the following information and check the following questions:

  1. Does this behaviour occur on Netbox devices or on just one?
  2. Since the communication is established and reading information is no problem, is the "write enabled" option selected under your API key? And does the user who owns this API key have proper permissions to modify the devices in Netbox?
  3. Does the user have read access to device types, devices and custom fields and edit permissions to device custom fields?
  4. Please provide output of the script with -v when the host is created.

I suspect that this must be some user error since i cannot replicate this behavior on multiple installations.

Since the servers are internal it runs over http: this shouldn't make a difference. I run test setups all the time over HTTP as well. However if you are able to replicate the setup on for example a docker based platform than you could debug some more on your side as well.

Domisiding commented 1 year ago

Hey, Sorry for the late reply.

  1. This error is with every device in the netbox. Everywhere a changelog is created by the user without a change.

  2. I have tested it with several API tokens and all of them have the write permission. Even with my account where I create devices the API key does not work.

  3. Yes, I can manually edit the field with the account when I log in.

  4. Debug Log

Domisiding commented 1 year ago

I have just seen that the Netbox still runs on the 3.4.3

Domisiding commented 1 year ago

This is the output with our debugs that we created. It recognizes that there is nothing in the field and after setting and saving it says the content is the ID, but once we look on the web there is nothing and no changes have been made according to the changelog above.

PPNH-Debugs

What we just noticed while debugging, no journal is created, but the function is called and there is also no debug from the function

TheNetworkGuy commented 1 year ago

So coming back on this issue after my holiday. I'm sorry but i cannot reproduce this error. There aren't any users who are experiencing the same error as you do.

Due to this i want to close this issue. Should more users report with the same issue then i can hopefully gather multiple points of data to replicate / fix your issue.

Domisiding commented 11 months ago

We have written our own patch, with which it now works. Just in case other people have the problem. @TheNetworkGuy function.txt