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

Zabbix 5.4 template import fails with Invalid parameter "/1/uuid" #451

Closed
nerijus opened this issue Sep 7, 2021 · 4 comments
Closed

Zabbix 5.4 template import fails with Invalid parameter "/1/uuid" #451

nerijus opened this issue Sep 7, 2021 · 4 comments

Comments

@nerijus
Copy link

nerijus commented Sep 7, 2021

Using community.zabbix 1.4.0, zabbix 5.4.4. After I deleted existing template (reported in issue #449), when trying to import a template, I get:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: zabbix_api.ZabbixAPIException: ('Error -32602: Invalid params., Invalid parameter "/1/uuid": UUIDv4 is expected. while sending {"jsonrpc": "2.0", "method": "configuration.import", "params": {"format": "json", "source": "{\\"zabbix_export\\": {\\"version\\": \\"5.4\\", \\"date\\": \\"2021-09-02T16:06:53Z\\", \\"groups\\": [{\\"uuid\\": \\"6aa69e1012224d919584d9214bbbae75\\", \\"name\\": \\"nginx-common\\"}], \\"templates\\": [{\\"uuid\\": \\"00f082a4bd8d5fabb2a361899a3c21c0\\", \\"template\\": \\"check dev-games-backend.example.com_v1_ab-kiron-vf_version HIGH\\", \\"name\\": \\"check dev-games-backend.example.com/v1/ab-kiron-vf/version [HIGH]\\", \\"groups\\": [{\\"name\\": \\"nginx-common\\"}], \\"httptests\\": [{\\"uuid\\": \\"fc5212ff929758b58f5e3d21418c6d01\\", \\"name\\": \\"dev-games-backend/v1/ab-kiron-vf/version\\", \\"attempts\\": \\"3\\", \\"verify_host\\": \\"YES\\", \\"steps\\": [{\\"name\\": \\"/v1/ab-kiron-vf/version\\", \\"url\\": \\"https://{HOST.CONN}/v1/ab-kiron-vf/version\\", \\"headers\\": [{\\"name\\": \\"Host\\", \\"value\\": \\"dev-games-backend.example.com\\"}], \\"timeout\\": \\"15s\\", \\"required\\": \\"\\", \\"status_codes\\": \\"200\\"}]}]}, {\\"uuid\\": \\"2df7a5c45c525cb6bd26a6c7fe81e5be\\", \\"template\\": \\"check dev-games-backend.example.com_v1_ab-kiron-vf_version DISASTER\\", \\"name\\": \\"check dev-games-backend.example.com/v1/ab-kiron-vf/version [DISASTER]\\", \\"groups\\": [{\\"name\\": \\"nginx-common\\"}], \\"items\\": [], \\"discovery_rules\\": [], \\"httptests\\": [{\\"uuid\\": \\"fc5212ff929758b58f5e3d21418c6d01\\", \\"name\\": \\"dev-games-backend/v1/ab-kiron-vf/version\\", \\"attempts\\": \\"3\\", \\"verify_host\\": \\"YES\\", \\"steps\\": [{\\"name\\": \\"/v1/ab-kiron-vf/version\\", \\"url\\": \\"https://{HOST.CONN}/v1/ab-kiron-vf/version\\", \\"headers\\": [{\\"name\\": \\"Host\\", \\"value\\": \\"dev-games-backend.example.com\\"}], \\"timeout\\": \\"15s\\", \\"required\\": \\"\\", \\"status_codes\\": \\"200\\"}]}]}], \\"triggers\\": [{\\"uuid\\": \\"00f082a4bd8d5fabb2a361899a3c21c0\\", \\"expression\\": \\"min(check dev-games-backend.example.com_v1_ab-kiron-vf_version HIGH:web.test.fail[dev-games-backend/v1/ab-kiron-vf/version],5m)<>0\\", \\"name\\": \\"{HOST.HOST} failed nginx proxy \\\\\\"https://dev-games-backend.example.com/v1/ab-kiron-vf/version\\\\\\" health-check\\", \\"priority\\": \\"HIGH\\"}, {\\"uuid\\": \\"2df7a5c45c525cb6bd26a6c7fe81e5be\\", \\"expression\\": \\"min(check dev-games-backend.example.com_v1_ab-kiron-vf_version DISASTER:web.test.fail[dev-games-backend/v1/ab-kiron-vf/version],#2)<>0\\", \\"name\\": \\"{HOST.HOST} failed nginx proxy \\\\\\"https://dev-games-backend.example.com/v1/ab-kiron-vf/version\\\\\\" health-check\\", \\"priority\\": \\"DISASTER\\"}]}}", "rules": {"discoveryRules": {"createMissing": true, "updateExisting": true, "deleteMissing": true}, "graphs": {"createMissing": true, "updateExisting": true, "deleteMissing": true}, "groups": {"createMissing": true}, "httptests": {"createMissing": true, "updateExisting": true, "deleteMissing": true}, "items": {"createMissing": true, "updateExisting": true, "deleteMissing": true}, "templates": {"createMissing": true, "updateExisting": true}, "templateLinkage": {"createMissing": true, "deleteMissing": true}, "triggers": {"createMissing": true, "updateExisting": true, "deleteMissing": true}, "valueMaps": {"createMissing": true, "updateExisting": true}, "templateDashboards": {"createMissing": true, "updateExisting": true, "deleteMissing": true}}}, "auth": "3edcbd4e5b495d6b5aa6018f0406ce48", "id": 6}', -32602)

I enabled debug logging in python3-zabbix-api-0.5.4 module by doing:

--- zabbix_api.py.orig  2019-04-18 14:32:27.000000000 +0300
+++ zabbix_api.py       2021-09-07 16:58:11.851895170 +0300
@@ -49,6 +49,7 @@

 default_log_handler = logging.StreamHandler(sys.stdout)
 __logger = logging.getLogger("zabbix_api")
+__logger.setLevel(logging.DEBUG)
 __logger.addHandler(default_log_handler)
 __logger.log(10, "Starting logging")

@@ -133,7 +134,7 @@
     # **kwargs: Data to pass to each api module

     def __init__(self, server='http://localhost/zabbix', user=httpuser, passwd=httppasswd,
-                 log_level=logging.WARNING, timeout=10, r_query_len=10, validate_certs=True, **kwargs):
+                 log_level=logging.DEBUG, timeout=10, r_query_len=10, validate_certs=True, **kwargs):
         """ Create an API object.  """
         self._setuplogging()
         self.set_log_level(log_level)

But I still do not see where Invalid parameter "/1/uuid" comes from, I do not see anything passed as "/1/uuid" anywhere.

@D3DeFi
Copy link
Contributor

D3DeFi commented Sep 12, 2021

Nice! This is it! I cannot actually believe they have silently changed ids to uuids without noting anything in the changelog! Working with Zabbix API is a real pleasure sometimes :)

This is reason why any template imports fail. We are actually trying to create new template with random assigned uuid when one already exists under different uuid, thus the error AlreadyExists.

In its basis this is duplicate with #412 and #449

@szuro
Copy link
Contributor

szuro commented Sep 15, 2021

@D3DeFi it was in both changelog
obraz
and "what's new" page:
obraz

@D3DeFi
Copy link
Contributor

D3DeFi commented Sep 15, 2021

Ok, my bad. Usually, when first reports start to pop up, we tend to look here, since we are working with API directly:
https://www.zabbix.com/documentation/current/manual/api/changes_5.4

So in a sense, it is an undocumented change from our point of view. It is also questionable if breaking changes like this should at all be a part of the minor releases.

This collection definitely struggles to even keep up with older releases that haven't yet been fully integrated to our modules (5.4.0), there is no way we can prepare for future releases (6.0) in advance. I've noticed that Zabbix tends to abuse X.4.Z releases to somehow beta test next X release and changes are happening very quickly in that time window with each Z. Migrating modules from 5.2 to 5.4 is usually more work than from 5.4 to 6.0. At least it was like that with 4.4 release.

Anyway, this issue still needs some notice and I barely manage to do basic maintenance over the repository. There used to be 2 of us working on modules, but now it is like 10% of that, so please if you have time to look at this, feel free. I will be happy to review & merge.

@nerijus
Copy link
Author

nerijus commented Sep 20, 2021

The problem was that I generated UUIDv5, while zabbix expects UUIDv4. After changing to UUIDv4 I was able to import template.

@nerijus nerijus closed this as completed Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants