# Jenkins Pipeline Influx - Error: influxDbPublisher: not found

**URL:** <https://community.jenkins.io/t/jenkins-pipeline-influx-error-influxdbpublisher-not-found/7441>\
**Category:** Ask a question\
**Tags:** plugin-site, pipeline\
**Created:** [May 17, 2023, 7:49pm UTC](https://community.jenkins.io/t/jenkins-pipeline-influx-error-influxdbpublisher-not-found/7441 "2023-05-17T19:49:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![diogosilva](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@diogosilva](https://community.jenkins.io/u/diogosilva)\
**Post date:** [May 17, 2023, 7:49pm UTC](https://community.jenkins.io/t/jenkins-pipeline-influx-error-influxdbpublisher-not-found/7441/1 "2023-05-17T19:49:42Z")

</div>

Hi,

I would like some help please, I’m new to the community.

I currently have a Pipeline in Groovy in the Library (I didn’t develop it and I have no knowledge in Groovy) declared in the “ **Configure System** ”.

The InfluxDB Plugin was installed in Jenkins (InfluxDB Plugin Version3.4).

Up to this point ok.

Using a declarative-type pipeline just for testing, I can run normally and I was able to record information in Influx.

```auto
...
   stages {
        stage('STEP 1') {
            steps {
                script {
                    echo "TEST_01"
                    influxDbPublisher jenkinsEnvParameterTag: 'KEYTEST=DEV', selectedTarget: 'InfluxDB'
                }
            }
        }

```

However, using the official Pipeline in Groovy we are taking the error.

```auto
package XX.com.XXX.deploy

class DeployDev {

    def call (jenkins) {
        
        String credentials
        String cluster
        def ecrLogin

        String DOCKER_TAG = "${jenkins.env.APP_VERSION}.${jenkins.env.GIT_COMMIT}.${jenkins.env.BUILD_NUMBER}"

        if (jenkins.env.SKIP_BUILD_FOR_TAG?.trim()) {
            DOCKER_TAG = jenkins.env.SKIP_BUILD_FOR_TAG
        }

        jenkins.podTemplate(
            containers: [
                jenkins.containerTemplate(
                    name: 'helm', 
                    image: 'XXXXXXXXXXXXXXXXXXXXXXX', 
                    ttyEnabled: true, 
                    command: 'cat', 
                    alwaysPullImage: false
                ),
                jenkins.containerTemplate(
                    name: 'aws-cli', 
                    image: 'XXXXXXXXXXXXXXXXXXXXXXX', 
                    ttyEnabled: true, 
                    command: 'cat', 
                    alwaysPullImage: false
                )
            ],    
            yamlMergeStrategy: jenkins.merge(),
            workspaceVolume: jenkins.persistentVolumeClaimWorkspaceVolume(
                claimName: "pvc-workspace-${jenkins.env.JENKINS_AGENT_NAME}",
                readOnly: false
            )
        ) {
            jenkins.node(jenkins.POD_LABEL){
                jenkins.container('aws-cli'){
                    ecrLogin = jenkins.ecrLogin(registryIds: ['XXXXXXXXXX'])
                    def token = jenkins.sh label: 'ECR login',
                                           script: "aws ecr get-login-password",
                                           returnStdout: true
                    ecrLogin = token
                }

                jenkins.container('helm') {
                    jenkins.echo "Deploy Step"
                    jenkins.withKubeConfig([
                        credentialsId: "XXXXXXXXXXXXXX",
                        serverUrl: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                    ]) {
          """
                        jenkins.sh label: 'Collecting metrics', 
                            script: """
                                influxDbPublisher jenkinsEnvParameterTag: 'KEYTEST=DEV', selectedTarget: 'InfluxDB'
                            """
                    }
                    jenkins.echo 'Deploy successful! 🌟'
                }
            }
        }
    }
}

```

Erro:

```auto
/home/jenkins/agent/workspace/XXX/DemoInflux@tmp/durable-fd88fcc0/script.sh: line 2: influxDbPublisher: not found

```

What it looks like, that in Pipeline Groovy mode, the library is not being loaded (I’m not sure nor knowledge in Groovy language), if you can help please.

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [May 17, 2023, 9:51pm UTC](https://community.jenkins.io/t/jenkins-pipeline-influx-error-influxdbpublisher-not-found/7441/2 "2023-05-17T21:51:02Z")

</div>

> [@diogosilva](#):
>
> ` """`

whats this random quotes about?

> [@diogosilva](#):
>
> `influxDbPublisher`

You are calling a groovy function (influxDbPublisher) inside your shell script (sh script: “”)  
If you remove the sh/script stuff so its just

```auto
{
                                influxDbPublisher jenkinsEnvParameterTag: 'KEYTEST=DEV', selectedTarget: ""                           
                    }

```

---

<div class="post-metadata">

**Author:** ![diogosilva](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@diogosilva](https://community.jenkins.io/u/diogosilva)\
**Post date:** [May 18, 2023, 1:38pm UTC](https://community.jenkins.io/t/jenkins-pipeline-influx-error-influxdbpublisher-not-found/7441/3 "2023-05-18T13:38:03Z")

</div>

Thanks for the feedback.

There was an attempt, but without success.

 ![pipe02](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/9/9acc181aa63a5877d9180f172b8ef1fdf4b49408.png)

The Influx line was placed outside the script, but it returns the error below

---

<div class="post-metadata">

**Author:** ![diogosilva](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@diogosilva](https://community.jenkins.io/u/diogosilva)\
**Post date:** [May 18, 2023, 1:38pm UTC](https://community.jenkins.io/t/jenkins-pipeline-influx-error-influxdbpublisher-not-found/7441/4 "2023-05-18T13:38:39Z")

</div>

**Error:**

 ![pipe03](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/1/115fb7e047284112018900a45eeeb0430ac5466c.png)

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [May 18, 2023, 4:10pm UTC](https://community.jenkins.io/t/jenkins-pipeline-influx-error-influxdbpublisher-not-found/7441/5 "2023-05-18T16:10:32Z")

</div>

you prefix all your pipeline “commands” with jenkins., so you’ll probably need to do that here.
