[ZBX-22842] Web Scenario status code blank into Zabbix API Created: 2023 May 24  Updated: 2023 May 25  Resolved: 2023 May 25

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 6.0.17, 6.4.1, 6.4.2
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Pecas Assignee: Aleksandrs Petrovs-Gavrilovs
Resolution: Won't fix Votes: 0
Labels: api
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Good morning,
I would like to monitor the status of a web app via Zabbix.
To do this, I added the host and to the record I added a web scenario with the url of the site that I want to monitor.
If I manage everything through Zabbix, the monitoring works and the "response code" of the site correctly replies the code 200. But if I try to access the same record through the API, Zabbix returns me the empty field.
I also tried with a user who has maximum rights on the system and the result does not change.

To access the API area that interests me I used Zabbix 6.2 and 6.4 and the official documentation, https://www.zabbix.com/documentation...ttptest/object, and as the API method the " httptest.get".

The CURL command used is

Code:

curl -X POST -k -H 'Content-Type: application/json-rpc' -i 'https://zabbix.mydomain.com/zabbix/api_jsonrpc.php' --data '\{ "jsonrpc": "2.0", "method": "httptest.get", "params": { "selectSteps": "extend", "httptestids": "1", "selectHttpTests": "extend" },"auth":"<token my user>", "id": 1 }'
Scrolling in the returned json, the key "status_code" is unfortunately empty while on the documentation it is indicated that if the site is online it should be "200".

Can someone tell me how to fix it and if it was a bug how to report it?

Thank you!​ 



 Comments   
Comment by Edgar Akhmetshin [ 2023 May 25 ]

https://www.zabbix.com/documentation/current/en/manual/api/reference/httptest/object
https://www.zabbix.com/documentation/current/en/manual/api/reference/httptest/get

status_codes : Ranges of required HTTP status codes, separated by commas.

'httptest.get' returns configuration, not latest data. If required status code is not set in the configuration, it will return nothing.

Works as expected.

Please be advised that this section of the tracker is for bug reports only. The case you have submitted can not be qualified as one, so please reach out to [email protected] for commercial support (https://zabbix.com/support) or consultancy services. Alternatively, you can also use our IRC channel or community forum (https://www.zabbix.com/forum) for assistance. With that said, we are closing this ticket. Thank you for understanding.

Generated at Mon May 05 07:22:06 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.