4

How do you display a text/string value in Grafana with the data fetched from the JSON API plugin?

My datasource the url is https://bensapi.pythonanywhere.com/ that returns:

{"message":"Hello from Flask!","status":"success"}

Setting up the data source for this URL and EXPLORE option it works, the string on the bottom is what I am looking to display:

enter image description here

In grafana selecting this type of chart:

enter image description here

And trying to recreate my steps from the EXPLORE process of the data source I cant seem to plot the Hello from Flask string on a dashboard. Any tips appreciated.

enter image description here

3 Answers 3

6

While Jan's answer is correct for the graph and time series panel, you stated that you are using the stat panel.

There you can set what type of values are shown: In the panel settings go to Value options -> Fields. There the default is Numeric Fields. So when you haven't changed that, it is the reason 'No data' is shown for your string. Set it to All Fields to make the panel show strings.

Sign up to request clarification or add additional context in comments.

Comments

1

See the doc of JSON API plugin:

https://marcus.se.net/grafana-json-datasource/troubleshooting#why-do-i-get-unable-to-graph-data-when-i-try-to-graph-the-query-results

The Graph and Time series panels can only display time series. To create a query that returns time series, make sure that it contains at least two fields:

A Time field that contains the timestamps for the X-axis A Number field that contains the values for the Y-axis

So your API response (simple string) can't be graphed.

3 Comments

would I just seek a certain dashboard that handle strings? Or is this something that isnt designed for grafana?
any best practices appreciated. I could probably fumble through a custom react plugin, is that something worth while?
@bbartling Keep in mind terminology: Grafana dashboard has panel(s). You are looking for a panel (not a dashboard), which works with strings. That is for example table panel (that's used in the explore mode - see "table" there). So select more suitable panel type for your data or make more suitable data for selected panel type.
0

So what I ended up using with the JSON API is the TABLE panel to display text values from a JSON API PAYLOAD. Looks like this below, the API JSON PATH to represent the data into columns:

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.