Home » Default » 将Zabbix更新到6.4.0,插件提示:Invalid params. Invalid parameter "/": unexpected parameter "user".

Invalid params. Invalid parameter "/": unexpected parameter "user".

Software versions

Grafana Zabbix Grafana-Zabbix Plugin
9.4.3 6.4.0 4.2.10

目前Github上作者好像还没有发布修补版本,不过网友回复里有一个解决方案:

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

用下来倒是可以的。
https://github.com/alexanderzobnin/grafana-zabbix/issues/1583

标签: Grafana ZABBIX Grafana-Zabbix Plugin

添加新评论

V