Can not run the Telegraf service

Good day!
I can not run Telegraf, error:

┌ (root💀kali)
└ systemctl restart telegraf.service 
┌ (root💀kali)
└ systemctl status telegraf.service 
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
     Loaded: loaded (/lib/systemd/system/telegraf.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Fri 2021-03-19 13:11:01 UTC; 38ms ago
       Docs: https://github.com/influxdata/telegraf
    Process: 2555 ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF_OPTS (code=exited, status=1/FAILURE)
   Main PID: 2555 (code=exited, status=1/FAILURE)
        CPU: 128ms

мар 19 13:11:01 kali systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 5.
мар 19 13:11:01 kali systemd[1]: Stopped The plugin-driven server agent for reporting metrics into InfluxDB.
мар 19 13:11:01 kali systemd[1]: telegraf.service: Start request repeated too quickly.
мар 19 13:11:01 kali systemd[1]: telegraf.service: Failed with result 'exit-code'.
мар 19 13:11:01 kali systemd[1]: Failed to start The plugin-driven server agent for reporting metrics into InfluxDB.

Stopped and started in debug mode:

┌──(root💀kali)
└─# telegraf -debug
2021-03-19T13:21:18Z I! Starting Telegraf 1.17.3
2021-03-19T13:21:18Z I! Using config file: /etc/telegraf/telegraf.conf
2021-03-19T13:21:18Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file?

I used the instructions for setting up https://medium.com/@dorian599/iot-raspberry-pi-container-and-system-pontainering-with-influxdb-telegraf-influxdb-telegraf-and-grafana-a1767c38c109 and took from there information for the Telegraf file.

With these parameters, Telegraf does not start, tell me, please, what’s wrong? What is wrong with the parameters? I’m in this case a beginner, and I can’t figure out what parameters in the configuration fala are key and what you need to pay attention!
Thank you very much!

As the error message makes clear, you have not configured any input plugin in Telegraf.
How do you send data to InfluxDB without data? :smirk:

If you need further help, you can post your telegraf.conf in Markdown format here:

```toml
put the Telegraf config code snippets here
```

Did you put the Telegraf config contents into /etc/telegraf/telegraf.conf as the article instructed? As @Franky1 mentioned, the error message suggests that it’s not in there.

But I would expect a different error message if the config file is not found at all?
For me this happens when I specify no config file or a non-existent config file:

2021-03-19T14:50:31Z E! [telegraf] Error running agent: Error loading config file xxxxxxx.conf: open xxxxxx.conf: The system cannot find the file specified.
2021-03-19T14:51:11Z E! [telegraf] Error running agent: No config file specified, and could not find one in $TELEGRAF_CONFIG_PATH, C:\Users\xxxxxxxx/.telegraf/telegraf.conf, or C:\Program Files\Telegraf\telegraf.conf

PS: But this is on Windows 10

I understand you did not read the article that I brought in my question as a link.
Here is the content of my configuration file:

[global_tags]
[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false
[[outputs.influxdb]]
  urls = ["http://192.168.1.214:8086"]
  database = "rpi_monitoring"
  username = "demo"
  password = "demo"
[[inputs.cpu]]
  percpu = true
  totalcpu = true
  collect_cpu_time = false
  report_active = false
[[inputs.disk]]
  ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.mem]]
[[inputs.swap]]
[[inputs.file]]
  files = ["/sys/class/thermal/thermal_zone0/temp"]
  name_override = "cpu_temperature"
  data_format = "value"
  data_type = "integer"
[[inputs.exec]]
  commands = [ "/opt/vc/bin/vcgencmd measure_temp" ]
  name_override = "gpu_temperature"
  data_format = "grok"
  grok_patterns = ["%{NUMBER:value:float}"]
[[inputs.net]]
  interfaces = ["wlan0"]
[[inputs.netstat]]
[[inputs.ping]]
  urls = ["www.google.com"] # required
  count = 4
  interface = "wlan0"
  name_override = "google_ping"
[[inputs.docker]]
  endpoint = "unix:///var/run/docker.sock"
[[inputs.dns_query]]
  servers = ["8.8.8.8"]
  domains = ["."]
  record_type = "A"
  timeout = 10
  name_override = "google_dns"
[[inputs.kernel]]
[[inputs.system]]
[[inputs.processes]]
[[inputs.diskio]]

There is a file there, but I have doubts about its expansion.

  • As @mhall119 mentioned, check if you have actually edited the file /etc/telegraf/telegraf.conf
  • Do not copy complex examples from anywhere on the internet - they may not work :stuck_out_tongue_winking_eye:
  • Maybe just a typo in the config?
  • Reduce the complexity - simplify the config so that only one simple input plugin remains
  • If that works, increase the complexity again and gradually add more plugins.

Yes, it is this file.

Everything is possible, so I asked a question, I thought I

It seems, I have already tried it, but unfortunately I do not remember what it led to, I will try again, I will give feedback after a while. Thank.

I tried as you indicated, from simple to complex. To begin with, I made a connection to the database:

###############################################################################
#                            OUTPUT PLUGINS                                   #
###############################################################################


# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
  ## The full HTTP or UDP URL for your InfluxDB instance.
  ##
  ## Multiple URLs can be specified for a single cluster, only ONE of the
  ## urls will be written to each interval.
  # urls = ["unix:///var/run/influxdb.sock"]
  # urls = ["udp://127.0.0.1:8089"]
urls = ["http://192.168.1.214:8086"]

  ## HTTP Basic Auth
username = "demo"
password = "demo"

The rest did not touch, and Telegraf launched without errors.

Then I decided to add a couple of settings to display information in one of the graphs, took the parameters from here: Raspberry Pi Monitoring dashboard for Grafana | Grafana Labs

Without changing the settings for connecting to the database, I added the parameters that are specified in the Dashboard:

# # Parse a complete file each interval
# [[inputs.file]]
#   ## Files to parse each interval.  Accept standard unix glob matching rules,
#   ## as well as ** to match recursive files and directories.
#   files = ["/tmp/metrics.out"]
files = ["/sys/class/thermal/thermal_zone0/temp"]
name_override = "cpu_temperature"
data_format = "value"
data_type = "integer"

But nothing comes out, telegraf does not start with these parameters.
Groups [[inputs.net]], [[inputs. netstat]], and [[inputs.exec]] I haven’t changed it while I’m trying to configure the [[input.file]].
I decided to check what I have on the path that is specified in files = ["/sys/class/thermal/thermal_zone0/temp"]

┌──(root💀kali)-[/sys/class/thermal/thermal_zone0]
└─# ls -l
    -r--r--r-- 1 root root 4096 20 11:36 available_policies
    -rw-r--r-- 1 root root 4096 20 11:36 integral_cutoff
    -rw-r--r-- 1 root root 4096 20 11:36 k_d
    -rw-r--r-- 1 root root 4096 20 11:36 k_i
    -rw-r--r-- 1 root root 4096 20 11:36 k_po
    -rw-r--r-- 1 root root 4096 20 11:36 k_pu
    -rw-r--r-- 1 root root 4096 20 11:36 mode
    -rw-r--r-- 1 root root 4096 20 11:36 offset
    -rw-r--r-- 1 root root 4096 20 11:36 passive
    -rw-r--r-- 1 root root 4096 20 11:36 policy
    drwxr-xr-x 2 root root    0 20 11:36 power
    -rw-r--r-- 1 root root 4096 20 11:36 slope
    lrwxrwxrwx 1 root root    0 20 11:36 subsystem -> ../../../../class/thermal
    -rw-r--r-- 1 root root 4096 20 11:36 sustainable_power
    -r--r--r-- 1 root root 4096 20 11:36 temp
    -r--r--r-- 1 root root 4096 20 11:36 type
    -rw-r--r-- 1 root root 4096  20 11:36 uevent


┌──(root💀kali)-[/sys/class/thermal/thermal_zone0]
└─# cat ./temp
55991

This number changes in this file

and again, I can’t understand why telegraf doesn’t start, what might be interfering with it :frowning:
Please help me!

What is the error message?

This will not work, because you commented out the inputs plugin.

1 Like

God, I’m so stupid. :crazy_face:
Thank you very much!
I removed the # from the parameter headers - and telegraf started working.
Thank you very much!

But unfortunately, the dashboard does not display the information :neutral_face:
I think now the problem is different. I will understand further.