[ZBX-15832] HTTP Agent json path doesn't allow to get keys with dots Created: 2019 Mar 15 Updated: 2019 Mar 20 Resolved: 2019 Mar 20 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 4.0.5 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | RG | Assignee: | Arturs Lontons |
Resolution: | Won't fix | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() ![]() |
Description |
I'm using HTTP agent to get the our Rundeck health state throught its dedicated endpoint. As a code, this is }}{{➜ ~ curl -sL 'https://rundeck.company.com/api/27/metrics/healthcheck?authtoken=MYUSERTPOKEN'{{ }}
As you can see, there are two keys with dots, dataSource.connection.time to begin with. As per JSON path spec, I should be able to get the sub key healthy with
$.['{{dataSource.connection.time'].healthy}}
And some peoples in QAs reported being successful (outside of zabbix context) with
$.\"dataSource.connection.time\".healthy
Zabbix refuses that, made some tests despecializing characters : [ and ' and " and \ seems to be illegal for the jsonpath field.
Workaround, use an ugly regexpr. |
Comments |
Comment by Glebs Ivanovskis [ 2019 Mar 17 ] |
You have a mistake in your JSONPath: $.['dataSource.connection.time'].healthy |
Comment by RG [ 2019 Mar 18 ] |
Tried a c/c of your JSONPath, Zabbix said
And I checked the HTTP agent doc for 4.0, Examples in https://www.zabbix.com/documentation/4.0/manual/config/items/itemtypes/http all start with a $. ? |
Comment by Glebs Ivanovskis [ 2019 Mar 18 ] |
Perhaps, none of them start with brackets.
OK, at least it accepts JSONPath as valid. Now there is something wrong with your data. |
Comment by RG [ 2019 Mar 18 ] |
Here's the state with the JSONPath you suggested, as I said in my previous message
I removed the preprocessing and enforced a new check. Here's the data As I paste this image I'm wondering, healthy got no quote, it's a JSON boolean, will that be a problem for Zabbix considering the item "type of information" of this item is Text ? There's no "boolean" choice for "type of information".
|
Comment by Glebs Ivanovskis [ 2019 Mar 18 ] |
Which Retrieve mode do you use in HTTP Agent item? |
Comment by RG [ 2019 Mar 18 ] |
Ok. My bad. Somehow, somewhen, I checked 'Convert to json'. There was a {"body": ... } in the mix. God, there's way to much stuff to click on in Zabbix for me... May I suggest adding this example to the doc, with the title "Key with dots" ? |
Comment by Arturs Lontons [ 2019 Mar 20 ] |
Hi, Thank you for the suggestion.
Regards, Arturs. |