martinm76 / zabbix-pdf-report

Reporting tool in PHP for the Zabbix Monitoring Platform. Rather versatile reporting on hosts and host groups.
https://www.zabbix.com/forum/zabbix-cookbook/25368-zabbix-dynamic-pdf-report-generation?filter_time=time_lastmonth
GNU General Public License v3.0
52 stars 56 forks source link

Operation in Zabbix 6.4 #33

Closed amarodefarias closed 1 year ago

amarodefarias commented 1 year ago

First of all, congratulations for the beautiful work. I know it's a very recent version. But was there working in version 6.4?

In my environment the following error message appears. I believe there has been a change in the form of login

CURL URL: https://localhost/zabbix/api_jsonrpc.php CURL Options: Array ( [19913] => 1 [13] => 30 [78] => 5 [81] => [64] => [52] => 1 [74] => 1 [10023] => Array ( [0] => Content-Type: application/json-rpc [1] => User-Agent: ZabbixAPI v1.0 - http://andrewfarley.com/zabbix_php_api ) [10036] => POST [10015] => {"auth":null,"method":"user.login","id":1,"params":{"password":"XXXX@XXX","user":"XXXXX"},"jsonrpc":"2.0"} [10102] => gzip ) Got response from API: ({"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Invalid parameter \"/\": unexpected parameter \"user\"."},"id":1}) Response decoded: (Array ( [jsonrpc] => 2.0 [error] => Array ( [code] => -32602 [message] => Invalid params. [data] => Invalid parameter "/": unexpected parameter "user". ) [id] => 1 ) __login() Got response from API: () Unable to login: Array ( [code] => -32602 [message] => Invalid params. [data] => Invalid parameter "/": unexpected parameter "user". )

martinm76 commented 1 year ago

I have not had a chance to try 6.4 yet, but there is a setting in config.ini.php where you determine basically if debugging is always on (seemed to be required in earlier versions). I believe it's something like Zabbiz version and needs to be 5 or above to disable debugging output (that was never shown on screen on the earlier versions). It may not be enough, bit verify that one first 🙂

martinm76 commented 1 year ago

Didn't mean to close it. Sorry

amarodefarias commented 1 year ago

Thanks for the quick turnaround. But the question was not about displaying the debug mode (and I'm glad it exists) but the message I sent initially I just changed the user and password and kept it as faithful as possible. Note at the end Invalid parameter "/": unexpected parameter "user". I think that for this latest version there was some change in the way of login. But it's all still very new. I'm sorry for my English

I have not had a chance to try 6.4 yet, but there is a setting in config.ini.php where you determine basically if debugging is always on (seemed to be required in earlier versions). I believe it's something like Zabbiz version and needs to be 5 or above to disable debugging output (that was never shown on screen on the earlier versions). It may not be enough, bit verify that one first 🙂

ironbishop commented 1 year ago

The API was changed in version 5.4, user was changed to username.

See

amarodefarias commented 1 year ago

The API was changed in version 5.4, user was changed to username.

See

* https://www.zabbix.com/documentation/5.4/en/manual/api/changes_5.2_-_5.4

* https://support.zabbix.com/browse/ZBXNEXT-6474

But in versions 5.4, 6.0 and 6.2 it is working normally. There was some change in 6.4

ironbishop commented 1 year ago

yep

ZBXNEXT-8085 user.get, user.create, user.update: dropped support for deprecated property alias. ZBXNEXT-8085 user.create, user.update: dropped support for deprecated parameter user_medias. ZBXNEXT-8085 user.login: dropped support for deprecated parameter user.

amarodefarias commented 1 year ago

yep

ZBXNEXT-8085 user.get, user.create, user.update: dropped support for deprecated property alias. ZBXNEXT-8085 user.create, user.update: dropped support for deprecated parameter user_medias. ZBXNEXT-8085 user.login: dropped support for deprecated parameter user.

Hum... I believe that the modification in the login has to be carried out considering that then

coffnix commented 1 year ago

I suggest create new branch to work on zabbix 6.4 :D

Tenchi1989 commented 1 year ago

My internal is ubuntu 22.04 with zabbix 6.4, I managed to install but when opening the web environment and starting the session, a blank screen appears with this error: Unable to login: Array ( [code] => -32602 [message] => Invalid params. [data] => Invalid parameter "/": unexpected parameter "user". )

martinm76 commented 1 year ago

I'll try to get a 6.4 test system running soon and look into this.

ons. 26. apr. 2023 20.57 skrev Tenchi1989 @.***>:

My internal is ubuntu 22.04 with zabbix 6.4, I managed to install but when opening the web environment and starting the session, a blank screen appears with this error: Unable to login: Array ( [code] => -32602 [message] => Invalid params. [data] => Invalid parameter "/": unexpected parameter "user". )

— Reply to this email directly, view it on GitHub https://github.com/martinm76/zabbix-pdf-report/issues/33#issuecomment-1523900547, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWMJDW6SOFI3GHDIZPBJGDXDFV27ANCNFSM6AAAAAAVVQAPTU . You are receiving this because you were assigned.Message ID: @.***>

iny commented 1 year ago

Is there any progress? @martinm76

martinm76 commented 1 year ago

Sorry, I am currently rather busy with other work tasks. I hope to have a chance at looking at it within the next few days.

On Tue, 16 May 2023 at 21:38, Ida Sörndal @.***> wrote:

Is there any progress? @martinm76 https://github.com/martinm76

— Reply to this email directly, view it on GitHub https://github.com/martinm76/zabbix-pdf-report/issues/33#issuecomment-1550254771, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWMJDQE7XVC2A7RJ4Q4G53XGPJSTANCNFSM6AAAAAAVVQAPTU . You are receiving this because you were mentioned.Message ID: @.***>

-- Venlig hilsen/Best Regards,

/Martin Møller

iny commented 1 year ago

Thanks in advance for your help, I hope the problem can be solved :) @martinm76

amarodefarias commented 1 year ago

Hello @martinm76 do you have any news about the case?

martinm76 commented 1 year ago

I'm having a hard time finding the free time currently. If one of you figure out what needs to be done, I can make the change / apply your pull request. I have some vacation in a few weeks. Maybe I can get to it then.

On Tue, 20 Jun 2023 at 12:34, amarodefarias @.***> wrote:

Hello @martinm76 https://github.com/martinm76 do you have any news about the case?

— Reply to this email directly, view it on GitHub https://github.com/martinm76/zabbix-pdf-report/issues/33#issuecomment-1598525340, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWMJDSPOETQZBZQ3IEOKTDXMF4DHANCNFSM6AAAAAAVVQAPTU . You are receiving this because you were mentioned.Message ID: @.***>

-- Venlig hilsen/Best Regards,

/Martin Møller

victorhugopa commented 1 year ago

To work in 6.4: Line 285 from zabbix-pdf-report-master\inc\ZabbixAPI.class.php:

$data = $this->callAPI('user.login', array( 'password' => $this->password, 'user' => $this->username )); to: $data = $this->callAPI('user.login', array( 'password' => $this->password, 'username' => $this->username ));

martinm76 commented 1 year ago

Thank you. I'll try to get this updated in the next 24 hours. I'll have to see how I can reasonably support both options.

On Thu, 22 Jun 2023 at 19:02, Victor Hugo Assunção @.***> wrote:

To work in 6.4: Line 285 from zabbix-pdf-report-master\inc\ZabbixAPI.class.php:

$data = $this->callAPI('user.login', array( 'password' => $this->password, 'user' => $this->username )); to: $data = $this->callAPI('user.login', array( 'password' => $this->password, 'username' => $this->username ));

— Reply to this email directly, view it on GitHub https://github.com/martinm76/zabbix-pdf-report/issues/33#issuecomment-1603018159, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWMJDXZC47SEK5FNQOMV23XMR3DBANCNFSM6AAAAAAVVQAPTU . You are receiving this because you were mentioned.Message ID: @.***>

-- Venlig hilsen/Best Regards,

/Martin Møller

amarodefarias commented 1 year ago

To work in 6.4: Line 285 from zabbix-pdf-report-master\inc\ZabbixAPI.class.php:

$data = $this->callAPI('user.login', array( 'password' => $this->password, 'user' => $this->username )); to: $data = $this->callAPI('user.login', array( 'password' => $this->password, 'username' => $this->username ));

Thank you very much. Worked perfectly!

martinm76 commented 1 year ago

I have committed an update that hopefully detects your version of Zabbix and uses the correct way to login depending on that outcome. I'm not able to test it right now, so I hope I can get some report back here it it's working or some error occurs.

amarodefarias commented 1 year ago

I have committed an update that hopefully detects your version of Zabbix and uses the correct way to login depending on that outcome. I'm not able to test it right now, so I hope I can get some report back here it it's working or some error occurs.

I tested this last change you made in my environment. Follow the error message

Unable to login: Array ( [code] => -32602 [message] => Invalid params. [data] => Invalid parameter "/": unexpected parameter "user". )

The change made by @victorhugopa worked perfectly

martinm76 commented 1 year ago

Ah, okay. So I have missed that is still sends and 'auth' message with the apiinfo.version call. I'll see if I can fix that and if it makes more sense to have the apiinfo as a separate function ... Thank you for testing!

On Sat, 24 Jun 2023 at 15:54, amarodefarias @.***> wrote:

I have committed an update that hopefully detects your version of Zabbix and uses the correct way to login depending on that outcome. I'm not able to test it right now, so I hope I can get some report back here it it's working or some error occurs.

I tested this last change you made in my environment. Follow the error message

Unable to login: Array ( [code] => -32602 [message] => Invalid params. [data] => Invalid parameter "/": unexpected parameter "user". )

The change made by @victorhugopa https://github.com/victorhugopa worked perfectly

— Reply to this email directly, view it on GitHub https://github.com/martinm76/zabbix-pdf-report/issues/33#issuecomment-1605515892, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWMJDWZURZSSE2I6YEDRFLXM3WSTANCNFSM6AAAAAAVVQAPTU . You are receiving this because you were mentioned.Message ID: @.***>

-- Venlig hilsen/Best Regards,

/Martin Møller

martinm76 commented 1 year ago

I didn't get around to push the update yesterday, but have done so now. Hopefully no syntax errors. Can you test again? If debugging is enabled, a few more things should be printed.

On Sat, 24 Jun 2023 at 18:16, Martin Møller @.***> wrote:

Ah, okay. So I have missed that is still sends and 'auth' message with the apiinfo.version call. I'll see if I can fix that and if it makes more sense to have the apiinfo as a separate function ... Thank you for testing!

On Sat, 24 Jun 2023 at 15:54, amarodefarias @.***> wrote:

I have committed an update that hopefully detects your version of Zabbix and uses the correct way to login depending on that outcome. I'm not able to test it right now, so I hope I can get some report back here it it's working or some error occurs.

I tested this last change you made in my environment. Follow the error message

Unable to login: Array ( [code] => -32602 [message] => Invalid params. [data] => Invalid parameter "/": unexpected parameter "user". )

The change made by @victorhugopa https://github.com/victorhugopa worked perfectly

— Reply to this email directly, view it on GitHub https://github.com/martinm76/zabbix-pdf-report/issues/33#issuecomment-1605515892, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWMJDWZURZSSE2I6YEDRFLXM3WSTANCNFSM6AAAAAAVVQAPTU . You are receiving this because you were mentioned.Message ID: @.***>

-- Venlig hilsen/Best Regards,

/Martin Møller

-- Venlig hilsen/Best Regards,

/Martin Møller

amarodefarias commented 1 year ago

I didn't get around to push the update yesterday, but have done so now. Hopefully no syntax errors. Can you test again? If debugging is enabled, a few more things should be printed.

Very good. Beautiful work! In my environment it worked perfectly. Congratulations!

martinm76 commented 1 year ago

Yay! Glad to hear it ;)

On Sun, 25 Jun 2023 at 20:16, amarodefarias @.***> wrote:

I didn't get around to push the update yesterday, but have done so now. Hopefully no syntax errors. Can you test again? If debugging is enabled, a few more things should be printed.

Very good. Beautiful work! In my environment it worked perfectly. Congratulations!

— Reply to this email directly, view it on GitHub https://github.com/martinm76/zabbix-pdf-report/issues/33#issuecomment-1606208917, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWMJDWRZQHGIFANSN6SEGTXNB6A7ANCNFSM6AAAAAAVVQAPTU . You are receiving this because you were mentioned.Message ID: @.***>

-- Venlig hilsen/Best Regards,

/Martin Møller