Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able able to read the multiple telegraf.conf placed inside the telegraf.d directory #9093

Closed
ravi7248 opened this issue Apr 6, 2021 · 5 comments
Labels
area/configuration bug unexpected problem or unintended behavior

Comments

@ravi7248
Copy link

ravi7248 commented Apr 6, 2021

https://github.com//issues/6334

System info:

telegraf version - 1.18.0
InfluxDB - quay.io/influxdb/influxdb:v2.0.4

Docker

Steps to reproduce:

  1. ... create two telegraf.conf files enum-telegraf.conf and kinesis-telegraf.conf and placed inside the /etc/telegraf/telegraf.d/enum-telegraf.conf and /etc/telegraf/telegraf.d/kinesis-telegraf.conf. In kinesis-telegraf.conf, I have defined all my input plugins [[inputs.kinesis_consumer]] and output plugins [[outputs.influxdb_v2]]. In enum-telegraf.conf I have put my processor plugin [[processors.enum]] only
  2. ... create a main telegraf.conf file and place inside the /etc/telegraf/telegraf.conf. In main telegraf.conf I have put nothing else except the name of output plugin [[outputs.influxdb_v2]] because we can't keep file empty.

Expected behavior:

telegraf should run fine and do the work as defined in both the telegraf.conf

Actual behavior:

It's giving errors and not able to read anything from the telegraf.d directory.

2021-04-06T08:08:38Z I! Using config file: /etc/telegraf/telegraf.conf
2021-04-06T08:08:38Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?
2021-04-06T08:08:39Z I! Starting Telegraf 1.18.0
2021-04-06T08:08:39Z I! Using config file: /etc/telegraf/telegraf.conf
2021-04-06T08:08:39Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?
2021-04-06T08:08:40Z I! Starting Telegraf 1.18.0
2021-04-06T08:08:40Z I! Using config file: /etc/telegraf/telegraf.conf
2021-04-06T08:08:40Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?
2021-04-06T08:08:41Z I! Starting Telegraf 1.18.0
2021-04-06T08:08:41Z I! Using config file: /etc/telegraf/telegraf.conf
2021-04-06T08:08:41Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?
2021-04-06T08:08:42Z I! Starting Telegraf 1.18.0
2021-04-06T08:08:42Z I! Using config file: /etc/telegraf/telegraf.conf
2021-04-06T08:08:42Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?
2021-04-06T08:08:45Z I! Starting Telegraf 1.18.0
2021-04-06T08:08:45Z I! Using config file: /etc/telegraf/telegraf.conf
2021-04-06T08:08:45Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?
2021-04-06T08:08:49Z I! Starting Telegraf 1.18.0
2021-04-06T08:08:49Z I! Using config file: /etc/telegraf/telegraf.conf
2021-04-06T08:08:49Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?
2021-04-06T08:08:56Z I! Starting Telegraf 1.18.0
2021-04-06T08:08:56Z I! Using config file: /etc/telegraf/telegraf.conf
2021-04-06T08:08:56Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?

the following content is stored in the enum-telegraf.conf

[[processors.enum]]
  [[processors.enum.mapping]]
    ## Name of the field to map. Globs accepted.
   ## field = "status"
    namepass = "om"
    ## Name of the tag to map. Globs accepted.
     tag = "node"
    ## Destination tag or field to be used for the mapped value.  By default the
    ## source tag or field is used, overwriting the original value.
    dest = "site"
    ## Default value to be used for all values not contained in the mapping
    ## table.  When unset and no match is found, the original field will remain
    ## unmodified and the destination tag or field will not be created.
    # default = 0
    ## Table of mappings
    [processors.enum.mapping.value_mappings]
      0005B951 = "mumbai"
      0005B952 = "madras"

I have tested the content of both telegraf.conf files and both are working fine if we place both inside a giant telegraf.conf file.

@ravi7248 ravi7248 added the bug unexpected problem or unintended behavior label Apr 6, 2021
@telegraf-tiger telegraf-tiger bot added the area/aws AWS plugins including cloudwatch, ecs, kinesis label Apr 6, 2021
@ivorybilled ivorybilled added area/configuration and removed area/aws AWS plugins including cloudwatch, ecs, kinesis labels Apr 6, 2021
@ivorybilled
Copy link
Contributor

ivorybilled commented Apr 6, 2021

Hi, what command are you using to start telegraf? I'm able to get the expected behavior if I add the following flag: --config-directory (path of the folder containing the configs)

@ravi7248
Copy link
Author

ravi7248 commented Apr 6, 2021

I am using docker container for telegraf so just using the docker restart telegraf command to restart the telegraf

@ivorybilled
Copy link
Contributor

ivorybilled commented Apr 6, 2021

Looks like according to this thread: #5656 (comment) you can do the run docker command and pass the argument I mentioned and it should send it to telegraf, let me know if that's a possibility

@ravi7248
Copy link
Author

ravi7248 commented Apr 7, 2021

can you tell me how to pass this command in docker-compose because I tried pass using args and using environment as well but it's not working ?

@ravi7248
Copy link
Author

ravi7248 commented Apr 7, 2021

we have to pass in docker-compose like below example

telegraf:
    image: telegraf:1.18.0
    container_name: telegraf
    restart: always
    depends_on:
        - influxdb
    networks:
      - analytics
    volumes:
      - telegraf-storage:/var/lib/telegraf
      - ./etc/telegraf/:/etc/telegraf/
    env_file:
      - secrets.env
    environment:
        INFLUXDB_URL: http://influxdb:8086
    command:
        --config-directory /etc/telegraf/telegraf.d
     # - username=admin
     # - password=admin
    links:
      - influxdb

@ravi7248 ravi7248 closed this as completed Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants