Bug 48027 - Не запускается сервис telegraf
Summary: Не запускается сервис telegraf
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: telegraf (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Alexey Shabalin
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-16 16:31 MSK by Alexander Makeenkov
Modified: 2023-10-17 16:12 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Makeenkov 2023-10-16 16:31:07 MSK
Версия пакета:
telegraf-1.28.2-alt1.x86_64

Шаги воспроизведения:
# apt-get install telegraf
# systemctl start telegraf
# journalctl -xu telegraf

Получаемый результат:
(telegraf)[12095]: telegraf.service: Referenced but unset environment variable evaluates to an empty string: TELEGRAF_OPTS
telegraf[12095]: 2023-10-16T13:27:03Z I! Loading config: /etc/telegraf/telegraf.conf
telegraf[12095]: 2023-10-16T13:27:03Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE

Не воспроизводится в p10 на версии telegraf-1.24.2-alt1
Comment 1 Alexey Shabalin 2023-10-16 18:40:36 MSK
конфиг покажите, куда отправляет метрики telegraf?
Comment 2 Alexander Makeenkov 2023-10-17 09:29:33 MSK
(Ответ для Alexey Shabalin на комментарий #1)
> конфиг покажите, куда отправляет метрики telegraf?

(Ответ для Alexander Makeenkov на комментарий #0)
> Шаги воспроизведения:
> # apt-get install telegraf
> # systemctl start telegraf
> # journalctl -xu telegraf

> Не воспроизводится в p10 на версии telegraf-1.24.2-alt1

При аналогичных шагах (установить и запустить без доп. настройки) в p10 проблемы нет, сервис запускается:
# systemctl status telegraf
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
     Loaded: loaded (/lib/systemd/system/telegraf.service; disabled; vendor preset: disabled)
     Active: active (running) since Tue 2023-10-17 09:09:14 MSK; 4s ago
       Docs: https://github.com/influxdata/telegraf
   Main PID: 3198 (telegraf)
      Tasks: 9 (limit: 3547)
     Memory: 39.0M
        CPU: 85ms
     CGroup: /system.slice/telegraf.service
             └─ 3198 /usr/bin/telegraf --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d

окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain systemd[1]: Started The plugin-driven server agent for reporting metrics into InfluxDB.
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z I! Starting Telegraf 1.24.2
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z I! Loaded inputs: cpu disk diskio kernel mem processes swap system
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z I! Loaded aggregators:
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z I! Loaded processors:
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z I! Loaded outputs: influxdb
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z I! Tags enabled: host=server-10-1-x86-64-minimal-20231017.localdomain
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"server-10-1-x86-64-minimal-20231017.localdomain", Flush Interval:10s
окт 17 09:09:14 server-10-1-x86-64-minimal-20231017.localdomain telegraf[3198]: 2023-10-17T06:09:14Z W! [outputs.influxdb] When writing to [http://localhost:8086]: database "telegraf" creation failed: Post "http://localhost:8086/query": dial tcp 127.0.0.1:8086: connect:


Но я нашёл, в чём причина. В версии 1.24.2-alt1 в конфиге /etc/telegraf/telegraf.conf по умолчанию раскомментирована строка [[outputs.influxdb]], т.е. сразу включен один из таргетов, поэтому сервис запускается. В новой версии ничего не включено по умолчанию, поэтому нужна предварительная настройка в ручную. Тут и плюс и минус. Минус в том, что это регресс, по отношению к старой версии. Плюс в том, что influxdb может быть и не нужна тому, кто собирается пользоваться этим сервисом.

Если считаете, что так и нужно оставить, то закройте баг.
Comment 3 Alexey Shabalin 2023-10-17 16:01:17 MSK
Лучше так и оставить. Сервис надо настроить перед запуском.
Comment 4 Alexander Makeenkov 2023-10-17 16:12:31 MSK
Хорошо.