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

Authentication broken for ancient Zabbix since support added for Zabbix 6.4 #1616

Closed
colinleroy opened this issue Apr 7, 2023 · 6 comments
Closed

Comments

@colinleroy
Copy link

colinleroy commented Apr 7, 2023

Zabbix changed their user.login API endpoint to use "username" instead of "user" in 6.4rc, and you added support for it.
You added a isDeprecatedUserParamError check in order to be retro-compatible, and you look for 'unexpected parameter "user' in the error string. So far so good.

But ancient Zabbix installs are now broken, because when getting a user.login request with "username" instead of "user", they throw a generic error:

$ cat login.json; curl  --header 'Content-Type: application/json-rpc' -k https://zabbix-3.0-instance/zabbix/api_jsonrpc.php -d @login.json 
{
  "jsonrpc": "2.0",
  "method": "user.login",
  "params": {
    "username": "api_grafana",
    "password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  },
  "id": 1
}

{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Login name or password is incorrect."},"id":1}

Sadly, I have no idea at what point Zabbix changed from that generic error to the one where they check the parameter names.

Possibly it would be cleaner to check the apiinfo.version endpoint before trying to user.login, and set the parameter name accordingly. Unfortunately, I suck at go and don't think I can provide a good pull request.

Hope this helps!

@theguimaraes
Copy link

I have the same issue here.

Grafana 9.4.3 and i can't connect to one of my old Zabbix 3.0

Plugin version 4.3.0 and 4.3.1, only connect to my new Zabbix 6.0, but can't connect to the 3.0

Plugin version 4.2.10 and lower, i can connect to my old Zabbix 3.0, but can't connect to the new 6.0. I receive a Error: Invalid params. Invalid parameter "/": unexpected parameter "user".

@renatotoniolo
Copy link

I'm having the same problem, my Zabbix 3.0 in which I'm migrating to a new Zabbix 6.4 in parallel, I'm using two datasources to keep the alerts in a single dashboard and I'm having the same problem.

@alexanderzobnin
Copy link
Collaborator

Fixed in 4.3 #1544

@colinleroy
Copy link
Author

Fixed in 4.3 #1544

No, this is a different issue. The 4.3 makes the plugin work on Zabbix 6.4, but breaks the plugin with Zabbix 3.0

@doug260188
Copy link

Alguem ja achou a solução? Pois ainda sofro com esse erro!

wiltonsr added a commit to wiltonsr/grafana-zabbix that referenced this issue Nov 26, 2024
- Remove Authenticate and isDeprecatedUserParamError methods
- Using the Zabbix API version determines the use of Login or LoginDeprecated
- This will prevent errors login in old Zabbix 3 as reported in grafana#1616
@wiltonsr
Copy link

Hello, @alexanderzobnin

First of all, thanks for this great plugin.

I provided a PR with a possible fix to this issue.

It was tested using Zabbix 3.0.32.

Image

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

6 participants