I am attempting to parse data using an Infinity datasource with the following settings.
Type: XML
Parser: Backend
Source: URL
Format: Table
Method: GET
URL: My URL
I see the data in the dashboard by just providing the URL, but not matter what I have tried I cannot parse anything from it.
Below is a sample of the XML and I would like to just start by parsing the Status attribute.
<?xml version="1.0"?>
did you follow the guide?
Welcome @bassman2024 (cool handle, by the way).
Can you share a larger snippet of the XML data that you are trying to parse?
Hey Grant,
As a bass player I think I engrain it into everything, haha.
Here is a larger snippet. Let me know if this is enough.
Thanks in advance for any help.
I tried to follow the guide prior to making this post, but with no success. I did try it with an inline format as well. I was using monitors.status as the rows/roots, but it did not like that. It produces this error “error getting data frame from inline data. root object doesn’t exist in the response. Root selector:monitors.status”.
please post as text not as an image.
Hi,
Here is a larger portion of the XML
<?xml version="1.0"?>
<monitor id="134" status="Alert" depends_on="" title="Core - Disk Space Monitor" lastRun="07-05-2024 07:56:06" nextRun="07-05-2024 08:26:06" errText="F:\ < 10 % free space (Currently 9 %, 205.6 GB free)
is that a proper valid xml?
That is what is returned in my browser when using the API URL. To the best of my knowledge it is valid.
Not sure if you are able to see all the XML. It shows when I go to Edit mode in here, but only see the first line once I post it.
mark the whole xml docu with 3 ticks => ` <= in front and at end of it
Is there a way to insert that automatically since I am retrieving this from a URL?
<?xml version="1.0"?>
<monitors>
<monitor id="134"
status="Alert"
depends_on="" title="Core - Disk Space Monitor" lastRun="07-05-2024 07:56:06" nextRun="07-05-2024 08:26:06" errText="F:\ < 10 % free space (Currently 9 %, 205.6 GB free)" />
<monitors>
Pardon my ignorance. I am very new to Grafana. How is what you posted different from what is in XML returned from the URL? Would you like me to post he whole document?
ok, thank you. That is very helpful and worked. I have been able to find very little information on parsing XML data. Most examples use json. As a result, would you be able to tell how to setup a query to only pull Monitor ID, Status, Title and errText? After I have a working sample I am hoping I can figure out the rest. Perhaps I am missing something, but finding documentation on using a UQL parser for XLM appears to be very limited. Any help is greatly appreciated.
did you read the official documentation I posted?
https://grafana.github.io/grafana-infinity-datasource/docs/xml
that is how I was able to get the results, I had never worked with xml in infinity before.
Yes, I did read the documentation. I think I just lack some very basic understating of the syntax when parsing XML. If I wanted to pull just the status column and show the results, how would I do that? Thanks again.
The examples provided in the documentation are all for json data