Filter template Variable from JSON Query using Infinity datasource

  • What Grafana version and what operating system are you using?
    Newest version 8.4.1
    Centos 8

  • What are you trying to achieve?
    I would like to filter out some of the results from a JSON query before the variable is passed to the rest of grafana. When I try to use the filter option it never has any fields to filter on. I have only selected two columns so that it acts as a key:value pair. I have tried using the Regex filter but it appears to only filter out based on the value and not the key, the value is a random serial number and the key is a model number, I would like to filter out the model numbers that are not relevant. Unfortunately the Meraki OpenAPI I am using does not offer any filtering.

  • How are you trying to achieve it?
    I have tried many different methods.
    Tried to find a different API that would allow for filtering, unfortunately if I use the one you can filter by model you can’t filter by network so similar issue.
    I have tried using the filter option but it doesn’t appear to work for infinity json datasource.
    I have tried to filter by regex which works but only against the value part of the pair and it need to filter based on the key.

  • What happened?
    Filtering doesn’t appear to work for infinity json datasource, I am open to using a different json api datasource but the others I tried didn’t allow for a generic url that doesn’t initially return a json result. The Meraki API url has to be changed so unless you can use a variable in the datasource this will not work for most of the other json api datasource options I saw.

  • What did you expect to happen?
    I expected to be able to use the filters, at least the grafana built in filters.

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No, it is not really erroring, just not filtering the correct column.

  • Did you follow any online instructions? If so, what is the URL?
    The documentation for the plugin is lacking, especially in the variable section. I have tried searching for other information and looking through the discussion boards on both grafana and the infinity plugin. I have also started a help request in the infinity git hub community but I think it is only a single guy doing it all and I know he must be busy with other things so I am just trying to seek out other expert advice.

Thank you for any help you all can provide, it will be much appreciated.
:Nick:


1 Like

welcome to the :grafana: forum, @rodan07

I believe that filtering option is specific to the infinity datasource plugin. I might try making an issue in that repo:

1 Like

Thanks @mattabrams , I did open a case over there and he said it seems to be a bug.

I posted this one here to see if any one had any idea on a different way of doing this same thing. Something I thought of was trying to copy the API JSON data over to influxDB so that I could use a different plugin to query the data.

Thanks again for the reply.

1 Like

you must put something in the ‘as’ part when listing out fields. for instance put model as model in your example and it will show up in the filter list.

2 Likes