Posted on Leave a comment

InfluxDB Error: error authorizing query: user not authorized to execute statement ‘SHOW RETENTION POLICIES ON _internal’, requires READ on _internal

When using InfluxDB along with grafana you can get some internal statistics for the usage with a build-in internal database. In some cases when you try to create the grafana connection with the influxdb you can notice the error that is mentioned below.

InfluxDB Error: error authorizing query: user not authorized to execute statement ‘SHOW RETENTION POLICIES ON _internal’, requires READ on _internal

This error could be either because of permissions for the user or when the monitoring is not enabled. In order to verify you can login in influxdb

influx -username "user" -password "password"

and then list all available databases.

show databases

If the database _internal is not listed most probably you will not have the internal statistics enabled. You can read more about internal measurements based on your influxdb version in the documentation.

https://docs.influxdata.com/platform/monitoring/influxdata-platform/tools/measurements-internal/

InfluxData does not recommend using the _internal database in a production cluster. It creates unnecessary overhead, particularly for busy clusters, that can overload an already loaded cluster. Metrics stored in the _internal database primarily measure workload performance and should only be tested in non-production environments.

In order to verify if internal metrics are enabled you should go in influxdb configuration file

cat /etc/influxdb/influxdb.conf

and check the monitor section

##
## Controls the system self-monitoring, statistics and diagnostics.
##
## The internal database for monitoring data is created automatically if
## if it does not already exist. The target retention within this database
## is called 'monitor' and is also created with a retention period of 7 days
## and a replication factor of 1, if it does not exist. In all cases the
## this retention policy is configured as the default for the database.

You can then comment out the 3 lines that are showed in order to enable internal monitoring.

Finally after doing so you can go in grafana and create a new connection with the influxdb using the _internal database and the user.