Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67051

InfluxDB v2 Authentication fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • influxdb-plugin
    • None
    • Jenkins 2.289.1
      influxdb-plugin 3.0.2
      InfluxDB v2.0

      Created a global credential

      User name random. My understanding is the plugin 3+ version is ignoring it.

      password: Write API token to the target bucket

      Created InfluxDB target

      Provided org, database (bucket) and retention policy.

      Created a free style job

      using the above target and received unauthorized access error. See the attachment for a snapshot of the configuration.

      401 Unauthorized error
      Started by user unknown or anonymous
      Running as SYSTEM
      Building in workspace /var/jenkins_home/jobs/free-influx/workspace
      [InfluxDB Plugin] Collecting data...
      [InfluxDB Plugin] Publishing data to target 'influxdb_v2' (url='
      [http://influxdb:8086]
      ', database='quality-metrics')
      ERROR: Build step failed with exception
      com.influxdb.exceptions.UnauthorizedException: unauthorized access
      	at com.influxdb.internal.AbstractRestClient.responseToError(AbstractRestClient.java:98)
      	at com.influxdb.internal.AbstractRestClient.execute(AbstractRestClient.java:81)
      	at com.influxdb.client.internal.WriteApiBlockingImpl.write(WriteApiBlockingImpl.java:235)
      	at com.influxdb.client.internal.WriteApiBlockingImpl.lambda$writePoints$1(WriteApiBlockingImpl.java:152)
      	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
      	at com.influxdb.client.internal.WriteApiBlockingImpl.writePoints(WriteApiBlockingImpl.java:152)
      	at com.influxdb.client.internal.WriteApiBlockingImpl.writePoints(WriteApiBlockingImpl.java:136)
      	at jenkinsci.plugins.influxdb.InfluxDbPublicationService.writeToInflux(InfluxDbPublicationService.java:361)
      Caused: jenkinsci.plugins.influxdb.InfluxReportException
      	at jenkinsci.plugins.influxdb.InfluxDbPublicationService.writeToInflux(InfluxDbPublicationService.java:364)
      	at jenkinsci.plugins.influxdb.InfluxDbPublicationService.perform(InfluxDbPublicationService.java:301)
      	at jenkinsci.plugins.influxdb.InfluxDbPublisher.perform(InfluxDbPublisher.java:226)
      	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
      	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
      	at hudson.model.Build$BuildExecution.cleanUp(Build.java:187)
      	at hudson.model.Run.execute(Run.java:1953)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Build step 'Publish build data to InfluxDB' marked build as failure
      Finished: SUCCESS

      I've successfully tested the API token to write metrics to the bucket with

      curl -i -XPOST 'http://influxdb:8086/api/v2/write?org=cortex-org&bucket=quality-metrics&precision=ns' \
          --header 'Authorization: Token ******' \
          --data-raw 'cpu_load_short,host=server01,region=us-west value=0.64 '    
      
      HTTP/1.1 204 No Content
      Date: Thu, 04 Nov 2021 03:05:45 GMT
      
      

      Please let me know if anything else is needed.

        1. jacoco-html-report.png
          88 kB
          Dimitar Georgievski
        2. Screen Shot 2021-11-03 at 10.59.06 PM.png
          155 kB
          Dimitar Georgievski

            aleksisimell Aleksi Simell
            dgeorgievski Dimitar Georgievski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: