-
Notifications
You must be signed in to change notification settings - Fork 289
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
httpapi not working with Zabbix 7.2.0 #1431
Comments
This is my first issue ever on Github, I have read the issue guidelines, did not find any previous reports of this and tried to do it right, but if I missed something I apologize. I have also made a patch that seems to be working for me, but as I am unable to test it properly, I did not make it into a pull request. I am not really sure whether this will work with different Zabbix versions and/or if this breaks anything else but it seems to be working for me. Also I am not sure whether it is OK to add dependency on *** plugins/httpapi/zabbix.py.orig 2024-12-15 14:38:07.708512502 +0000
--- plugins/httpapi/zabbix.py 2024-12-15 14:23:24.858674887 +0000
***************
*** 52,57 ****
--- 52,58 ----
import json
import base64
+ import re
from uuid import uuid4
***************
*** 134,146 ****
if not data:
data = {}
- if self.connection._auth:
- data['auth'] = self.connection._auth['auth']
-
hdrs = {
'Content-Type': 'application/json-rpc',
'Accept': 'application/json',
}
http_login_user = self.get_option('http_login_user')
http_login_password = self.get_option('http_login_password')
if http_login_user and http_login_user != '-42':
--- 135,152 ----
if not data:
data = {}
hdrs = {
'Content-Type': 'application/json-rpc',
'Accept': 'application/json',
}
+
+ if hasattr(self.connection, 'zbx_api_version') and re.match('^7\..*$', self.connection.zbx_api_version):
+ if self.connection._auth:
+ hdrs['Authorization'] = ('Bearer %s' % (self.connection._auth['auth']))
+ else:
+ if self.connection._auth:
+ data['auth'] = self.connection._auth['auth']
+
http_login_user = self.get_option('http_login_user')
http_login_password = self.get_option('http_login_password')
if http_login_user and http_login_user != '-42': |
There are more changes for deprecated params required which were removed on 7.2 release. |
Just found a list of I hope all deprecated params removed in 7.2: https://www.zabbix.com/documentation/7.2/en/manual/api/changes |
SUMMARY
Authentication (both user/password and API token) not working with Zabbix 7.2.0.
This is happening because
auth
payload property has been deprecated ever since Zabbix 6.4 and finally removed in Zabbix 7.2.ISSUE TYPE
COMPONENT NAME
httpapi
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version
I'm doing this on Ubuntu 22.04 but I believe it will behave the same on any other OS
STEPS TO REPRODUCE
Try to add new host to Zabbix (but will likely happen with any other API call against Zabbix). Tested both username/password and API auth key
EXPECTED RESULTS
Host is added to Zabbix server
ACTUAL RESULTS
Task fails with error:
'message': 'Invalid request.', 'data': 'Invalid parameter \"/\": unexpected parameter \"auth\".'}
The text was updated successfully, but these errors were encountered: