InfluxDB Error: retention policy not found: autogen

InfluxDB Error: retention policy not found: autogen

grafana 9.1 with influxdb 2.4

How to fix this problem ?

autogen is the name of the default retention policy (if enabled).

What’s the default RP you set on InfluxDB? (run SHOW RETENTION POLICIES)

The solution is pretty simple… just specify it SELECT * FROM _RetPoliciy_.cpu

I got same error, and will share what I have tested.

At Influxdb I run:

influx v1 dbrp list

Then see all buckets using the autogenRetention Policy”.

But, if I do same check using:

influx bucket list

The field / collumn “Retention Policy” does not exists.

I have tried switch on Query Language at Data Sources:

From InfluxQL to Flux

Then no happen the error:

runRequest.ts:151 runRequest.catchError {"message":"InfluxDB Error: retention policy not found: autogen"}

But instead, got a new error:

fetch.js:32 POST https://grafana.domain.com/api/ds/query 400

In the Explore Menu I can query Influxdb using use option Sample Query from Flux, but server start flood with this error from /api/ds/query.

Everything seems ok at InfluxDB side, the default dashboard (from InfluxDB no Grafana) use the data from buckets, and query works too.

Using Postman on https://influxdb.domain.com/api/v2/dbrps?org=ORGNAME returns:

{
    "content": [
        {
            "id": "xxxxxxxxxxxxxxxx",
            "database": "database",
            "retention_policy": "autogen",
            "default": true,
            "virtual": true,
            "orgID": "xxxxxxxxxxxxxxxx",
            "bucketID": "xxxxxxxxxxxxxxxx"
        }
    ]
}

PS.: On my setup I did subdomains for influxdb and grafana. CORS is using the “*”.

Hi there !

I found a solution to the problem that I also encountered. The issue was in my Datasource definition on Grafana in the Query Language option.

I had selected in “Query Language” the InfluxQL option. I finally figured that all I did on InfluxDB was with Flux query language, so it would make more sense using Flux on Grafana too.

Changed it and it now works perfectly !!
It also makes more sense because it includes the API Token in the Datasource form directly.

I have found the solution at grafana forum on this link:

https://community.grafana.com/t/database-not-found-error-grafana-influxdb-source/61064

My guess, grafana fails on check the flags Retention Policy and Default… Why?

After follow the setup from medium post (link at grafana forums) I have checked the changes with:

influx v1 dbrp list

Then Retention Policy need be autogen and Default need be false or don’t work. (Before was autogen and true)

Now I’m searching why the error using Flux option at my setup happens.

The old InfluxQL now it’s working, but I wish fix the second option too.

I would like to chime in here because i have been getting this error “InfluxDB Error: retention policy not found: autogen” as well. In my case. I have an ton of old dashboards on a older Grafana 8.4.2 and InfluxDB 1.8.10 setup.

I had decided to work toward updating and started using the Grafana 9.1.5 and InfluxDB 2.4.0 in a Docker container which in itself so far is a learning curve but isn’t to bad. Although I do wish I could use the Flux language for the plugin, the Fact is I have so many dashboards built on the older InfluxQL language that I don’t want to rebuild.

Any how, after configuring telegraf to point to the new influxDB v2 output plugin and configuring grafana for the Influx Data source I came across this error in about the autgen policy not found. I have spent the week trying to work through or work around it and figure it out, but I finally I saw @Wisdom 's post that the retention policy for autogen needs to NOT be “default” which finally allowed my dashboard to load!!

In fumbling around trying to set the autogen policy to false i couldn’t seem to update this existing read only policy, so in the end what worked for me was creating a new policy (apparently it is default) but isn’t read only …this changes the read only autogen policy to default = false, but attempts to remove this duplicate new non-readonly autogen policy break my dashboard again so apparently it must be there.

Before:

root@b38e3b8e242d:/# influx v1 dbrp ls
ID      Database        Bucket ID       Retention Policy        Default Organization ID

VIRTUAL DBRP MAPPINGS (READ-ONLY)

ID                      Database        Bucket ID               Retention Policy        Default Organization ID
9fe148f3e30ddec3        _monitoring     9fe148f3e30ddec3        autogen                 true    2d0717a9a02a4d9e
9199596572587bde        _tasks          9199596572587bde        autogen                 true    2d0717a9a02a4d9e
80731b030126e621        telegraf        80731b030126e621        autogen                 true    2d0717a9a02a4d9e

Create retention policy with this command

root@b38e3b8e242d:/# influx v1 dbrp create \
>   --db telegraf \
>   --rp autogen \
>   --bucket-id 80731b030126e621
ID                      Database        Bucket ID               Retention Policy        Default Organization ID
09fc9637efc75000        telegraf        80731b030126e621        autogen                 true    2d0717a9a02a4d9

After:

root@b38e3b8e242d:/# influx v1 dbrp ls
ID                      Database        Bucket ID               Retention Policy        Default Organization ID
09fc9637efc75000        telegraf        80731b030126e621        autogen                 true    2d0717a9a02a4d9e

VIRTUAL DBRP MAPPINGS (READ-ONLY)

ID                      Database        Bucket ID               Retention Policy        Default Organization ID
9fe148f3e30ddec3        _monitoring     9fe148f3e30ddec3        autogen                 true    2d0717a9a02a4d9e
9199596572587bde        _tasks          9199596572587bde        autogen                 true    2d0717a9a02a4d9e
80731b030126e621        telegraf        80731b030126e621        autogen                 false   2d0717a9a02a4d9e

I’m still not sure which one it’s using but considering it broke when i tried to remove the new autogen = true policy i believe it is that one

1 Like

Awesome, thanks! That also solved it for me. Was also running a fresh 2.4 instance.

Before, which didn’t work and just caused the missing autogen error everywhere:

user@pc:~$ influx v1 dbrp list
ID      Database        Bucket ID       Retention Policy        Default Organization ID

VIRTUAL DBRP MAPPINGS (READ-ONLY)
----------------------------------
ID                      Database        Bucket ID               Retention Policy        Default Organization ID
46896f35921cd549        _monitoring     46896f35921cd549        autogen                 true    213d4e1072307065
62ad043c97265540        _tasks          62ad043c97265540        autogen                 true    213d4e1072307065
a7e2192365f4385d        homeassistant   a7e2192365f4385d        autogen                 true    213d4e1072307065
97a76f92708d4527        quickstart      97a76f92708d4527        autogen                 true    213d4e1072307065

Added the explicit mapping:

user@pc:~$ influx v1 dbrp create --db homeassistant --rp autogen --bucket-id a7e2192365f4385d
ID                      Database        Bucket ID               Retention Policy        Default Organization ID
0a3a6b8c5a474000        homeassistant   a7e2192365f4385d        autogen                 true    213d4e1072307065

And got:

user@pc:~$ influx v1 dbrp list
ID                      Database        Bucket ID               Retention Policy        Default Organization ID
0a3a6b8c5a474000        homeassistant   a7e2192365f4385d        autogen                 true    213d4e1072307065

VIRTUAL DBRP MAPPINGS (READ-ONLY)
----------------------------------
ID                      Database        Bucket ID               Retention Policy        Default Organization ID
46896f35921cd549        _monitoring     46896f35921cd549        autogen                 true    213d4e1072307065
62ad043c97265540        _tasks          62ad043c97265540        autogen                 true    213d4e1072307065
a7e2192365f4385d        homeassistant   a7e2192365f4385d        autogen                 false   213d4e1072307065
97a76f92708d4527        quickstart      97a76f92708d4527        autogen                 true    213d4e1072307065

And now everything was working properly. Grafana, old Python client, everything.