Cannot Add New Datasource

  • What Grafana version and what operating system are you using?
    Grafana version 6.7.3
    Ubuntu Server 5.4.0-1048-aws

  • What are you trying to achieve?
    Add another InfluxDB datasource that references a different database, without altering the existing InfluxDB datasource.

  • How are you trying to achieve it?
    Under “Configuration” menu, click “Add data source” button, select Time series database type = “InfluxDB”.

  • What happened?
    “Failed to add datasource” message displayed on UI.

  • What did you expect to happen?
    New datasource added of type InfluxDB" and ability to enter/select database name.

NOTE: Appear to be unable to add any other datasource type for time series databases, irrespective of whether they are currently configured as datasource in the current dashboard.

  • 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.
    “Failed to add datasource” message.
    The following message in the log file:
    t=2021-07-01T16:33:58+1200 lvl=eror msg=“Failed to add datasource” logger=context userId=6 orgId=1 uname=fnurk error=“UNIQUE constraint failed: data_source.org_id, data_source.uid” remote_addr=xxx.xxx.xxx.xxx

Hi @eapperley

Well this is certainly not a good outcome. It looks like this was occuring for others last year, after the update from 6 to 7. I’d check out this comment:

Also check out this comment:

Once you’ve fixed this issue, I’d suggest making a backup of your db and then considering an upgrade. Grafana 8 shipped last month and it is considerably more feature rich than 6, as is 7.5.7.

Hope this helps!