home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.81k stars 28.94k forks source link

Zabbix Integration: API Logon fails, Integration uses wrong Parameter for username? #90341

Open kladderadeng opened 1 year ago

kladderadeng commented 1 year ago

The problem

I tried to integrate my Zabbix 6.4 Server into Home Assistant as advised here.

To be more specific, my Integration in the configuration.yml looks like this: `zabbix: host: 192.168.0.6 username: redacted password: redacted include: domains:

When restarting Home Assistant, I get the following error message displayed as a notification in the GUI: Unable to login to the Zabbix API: {'code': -32602, 'message': 'Invalid params.', 'data': 'Invalid parameter "/": unexpected parameter "user".', 'json': "{'jsonrpc': '2.0', 'method': 'user.login', 'params': {'user': 'redacted', 'password': '********'}, 'id': '1'}"

I had a look at the Zabbix API manual and have the impression that the paramter for the Username is not "user" anymore, but "username" instead.

I think that can be fixed in the init.py, but I do not feel confident enough to make the change on my own and file a pull request, so hopefully someone more proficient with Pythin and Git could have a look at it?

What version of Home Assistant Core has the issue?

core-2023.3.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Zabbix

Link to integration documentation on our website

https://www.home-assistant.io/integrations/zabbix

Diagnostics information

No response

Example YAML snippet

configuration.yml
zabbix:
  host: 192.168.0.6
  username: redacted
  password: redacted
  include:
    domains:
      - 123test

Anything in the logs that might be useful for us?

Unable to prepare setup for platform zabbix.sensor: Unable to set up component.
08:19:09 – (FEHLER) setup.py
Setup failed for zabbix: Integration failed to initialize.
08:19:09 – (FEHLER) setup.py
Unable to login to the Zabbix API: {'code': -32602, 'message': 'Invalid params.', 'data': 'Invalid parameter "/": unexpected parameter "user".', 'json': "{'jsonrpc': '2.0', 'method': 'user.login', 'params': {'user': 'redacted', 'password': '********'}, 'id': '1'}"}
08:19:09 – (FEHLER) zabbix

Additional information

No response

home-assistant[bot] commented 1 year ago

zabbix documentation zabbix source

yeyeoke commented 1 year ago

I have the same problem since upgrading Zabbix to 6.4, worked fine in 6.2.

Bagunda commented 1 year ago

I have the same problem. For the first time I tried to integrate zabbix into the home assistant. Everything is updated

dsteinkopf commented 1 year ago

FYI: More discussion about the same problem here: #86879

Bagunda commented 1 year ago

FYI: More discussion about the same problem here: #86879

I confirm! Changing line 210 from self.user.login(user=user... to self.user.login(username=user... works! But I don't have pyzabbix folder in /usr/local/lib/python3.9/dist-packages/

I searched the file in system: find / -name pyzabbix Found the folder like this: /var/lib/docker/overlay2/cd673b94391f70edf489bcb04159e46bfff131e180cf089553da0a325a78ab8a/merged/usr/local/lib/python3.10/site-packages/pyzabbix and there is a file api.py in which I changed line 210. zabbix_api

configuration.yaml:

zabbix:
  host: 91.235.ip.ip
  ssl: false
  username: HomasTitus
  password: KCbO1XZx
  publish_states_host: HomasTitus
  exclude:
    domains:
      - device_tracker
    entities:
      - sun.sun
      - sensor.time
issue-triage-workflows[bot] commented 11 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

HA-TB303 commented 11 months ago

Still an issue...:

Unable to login to the Zabbix API: {'code': -32602, 'message': 'Invalid params.', 'data': 'Invalid parameter "/": unexpected parameter "user".', 'json': "{'jsonrpc': '2.0', 'method': 'user.login', 'params': {'user': 'x2com.homeassistant', 'password': '********'}, 'id': '1'}"}
WWE-Corey commented 10 months ago

Still an issue. Just installed today the Zabbix integration today on the latest HA release.

hatl commented 10 months ago

still open - tried with the latest versions of home-assistant and zabbix

Mittlebenskrise commented 9 months ago

Same problem here. The error in the log is

` Logger: homeassistant.components.zabbix Source: components/zabbix/init.py:96 Integration: Zabbix (documentation, issues) First occurred: 10:54:33 (20 occurrences) Last logged: 11:23:26

HTTPError when connecting to Zabbix API: HTTP Error 412: Precondition Failed HTTP Error 412: Precondition Failed Retrying in 60 seconds. `

The Zabbix documentation states that user.authenticate is deprecated (see https://www.zabbix.com/documentation/2.0/en/manual/appendix/api/user/authenticate) and that API calls must set the Content-Type header to application/json (not sure, what exactly causes the issue).

issue-triage-workflows[bot] commented 6 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

13werwolf13 commented 6 months ago

I think it’s too early to close the issue in its current form since the module remains broken

issue-triage-workflows[bot] commented 3 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

WWE-Corey commented 3 months ago

Does anyone have this working? I have the latest versions of everything and I am still getting the following error in HA.

Unable to login to the Zabbix API: {'code': -32602, 'message': 'Invalid params.', 'data': 'Invalid parameter "/": unexpected parameter "user".', 'json': "{'jsonrpc': '2.0', 'method': 'user.login', 'params': {'user': 'homeassistant', 'password': '********'}, 'id': '1'}"}
dsteinkopf commented 3 months ago

see #86879

WWE-Corey commented 3 months ago

I'm sure this is an operator malfunction but when I vi api.py all I get is:

image

issue-triage-workflows[bot] commented 4 weeks ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

13werwolf13 commented 4 weeks ago

Situation Not Resolved

gshafer commented 3 weeks ago

I also have the same issue.