Reputation: 3514
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:
In grafana selecting this type of chart:
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.
Upvotes: 4
Views: 13542
Reputation: 3514
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:
Upvotes: 0
Reputation: 1305
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.
Upvotes: 5
Reputation: 28714
See the doc of JSON API plugin:
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.
Upvotes: 1