Skip to content

Invalid params. Invalid parameter "/": unexpected parameter "user". (with Zabbix 6.4.0) #1583

Closed
@javivu

Description

@javivu

Describe the bug
Updated Zabbix to 6.4.0 and the Zabbix plugin no work anymore

Screenshots
image

Software versions

Grafana Zabbix Grafana-Zabbix Plugin
9.4.3 6.4.0 4.2.10

Activity

changed the title [-]Invalid params. Invalid parameter "/": unexpected parameter "user".[/-] [+]Invalid params. Invalid parameter "/": unexpected parameter "user". (with Zabbix 6.4.0)[/+] on Mar 7, 2023
evertonpaiva

evertonpaiva commented on Mar 8, 2023

@evertonpaiva

Same issue here. I'm using exactly the same versions.

javivu

javivu commented on Mar 8, 2023

@javivu
Author

I know what the problem is, in Zabbix 6.4 the "user" param has changed to "username", but I don't know how to solve it.

alexdu828

alexdu828 commented on Mar 8, 2023

@alexdu828

I also encountered the same problem

Zabbix Version:6.4.0
Grafana oss version:9.4.3
plugins version:alexanderzobnin-zabbix-app @ 4.2.10

image

marioandrepereira

marioandrepereira commented on Mar 8, 2023

@marioandrepereira

Estou com o mesmo problema, achei um repo que ele mandou um .zip mas quando instalado o grafana não reconhecia.

marioandrepereira

marioandrepereira commented on Mar 8, 2023

@marioandrepereira
marioandrepereira

marioandrepereira commented on Mar 8, 2023

@marioandrepereira
bpress

bpress commented on Mar 8, 2023

@bpress

The current official release 4.2.10 still uses "user" instead of "username" when talking to Zabbix and requesting a "user.login" api call.

I have not been able to recompile the plugin with the proper fix which seems to be included in the master branch.

However I managed to patch an ugly but effective workaround in Zabbix 6.4 php frontend rather than the plugin itself.

I know, this sounds orrible and any apt update will break it and require a new patching, but right now I have zero time to think to anything better.

I patched the file

/usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php

like this:

--- /usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php.orig	2023-03-08 16:23:26.555055621 +0100
+++ /usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php	2023-03-08 16:22:46.378217849 +0100
@@ -128,6 +128,13 @@
 				$newTransaction = true;
 			}

+			// UGLY GRAFANA DATASOURCE HACK
+			// rename "user" param to "username" when present
+			if ($params['user'] ?? null) {
+				$params['username'] = $params['user'];
+				unset($params['user']);
+			}
+
 			$result = call_user_func_array([$this->serviceFactory->getObject($api), $method], [$params]);

 			// if the method was called successfully - commit the transaction

maybe this helps

javivu

javivu commented on Mar 8, 2023

@javivu
Author

The current official release 4.2.10 still uses "user" instead of "username" when talking to Zabbix and requesting a "user.login" api call.

I have not been able to recompile the plugin with the proper fix which seems to be included in the master branch.

However I managed to patch an ugly but effective workaround in Zabbix 6.4 php frontend rather than the plugin itself.

I know, this sounds orrible and any apt update will break it and require a new patching, but right now I have zero time to think to anything better.

I patched the file

/usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php

like this:

--- /usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php.orig	2023-03-08 16:23:26.555055621 +0100
+++ /usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php	2023-03-08 16:22:46.378217849 +0100
@@ -128,6 +128,13 @@
 				$newTransaction = true;
 			}

+			// UGLY GRAFANA DATASOURCE HACK
+			// rename "user" param to "username" when present
+			if ($params['user'] ?? null) {
+				$params['username'] = $params['user'];
+				unset($params['user']);
+			}
+
 			$result = call_user_func_array([$this->serviceFactory->getObject($api), $method], [$params]);

 			// if the method was called successfully - commit the transaction

maybe this helps

For my case, is a "acceptable" temporal workaround!! Thanks!

cafetera

cafetera commented on Mar 8, 2023

@cafetera

Wow, I've been breaking my head for last couple of days, tons of issues trying recompile the source for Alexanders...

You are a genius!

marioandrepereira

marioandrepereira commented on Mar 8, 2023

@marioandrepereira
/usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php	2023-03-08 16:22:46.378217849 +0100

Tu é um mestre

mfsirilo

mfsirilo commented on Mar 9, 2023

@mfsirilo

Thankyou!!! @bpress

GideonChami

GideonChami commented on Mar 9, 2023

@GideonChami

@bpress thank you very much!

pqvindesland

pqvindesland commented on Mar 9, 2023

@pqvindesland

i´m on Zabbix 6.0.13 and I think that I am seeing the same issue in Apache's error_log I have
AH01071: Got error 'PHP message: PHP Notice: Parameter "/user" is deprecated. in /usr/share/zabbix/include/classes/validators/CApiInputValidator.php on line 1324

Also I am not seeing any data but it pulls in groups and hostnames but no actual data, is that expected with this issue?

The company that I work for doesn't allow me to run the patch command, can I add the modifications manually to CLocalApiClient.php ?

bpress

bpress commented on Mar 9, 2023

@bpress

i´m on Zabbix 6.0.13 and I think that I am seeing the same issue in Apache's error_log I have AH01071: Got error 'PHP message: PHP Notice: Parameter "/user" is deprecated. in /usr/share/zabbix/include/classes/validators/CApiInputValidator.php on line 1324

Also I am not seeing any data but it pulls in groups and hostnames but no actual data, is that expected with this issue?

The company that I work for doesn't allow me to run the patch command, can I add the modifications manually to CLocalApiClient.php ?

@pqvindesland I don't think your lack of data is related to this issue. AFAIK Zabbix 6.0 gives only a deprecation warning but still accepts "user"; the change I made is only for 6.4. I have no idea on why you don't get actual data.
[Offtopic] I had a similar problem: I upgraded grafana from 8.x to 9.4 and Zabbix from 5.4 to 6.4. During this process I got almost all panels in dashboards with "no data" and the infamous corner red triangle: this seems to be related to the way each panel was linked to the zabbix datasource. I had to export the json for all the dashboards, manually edit it by removing all "uid" references for each panel or metric query (whole lines deleted), then reimport the json. UIDs got regenerated and the dashboards were restored.

30 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @evertonpaiva@alexanderzobnin@isaqueprofeta@bpress@cafetera

        Issue actions

          Invalid params. Invalid parameter "/": unexpected parameter "user". (with Zabbix 6.4.0) · Issue #1583 · grafana/grafana-zabbix