Telegraf addon for hassio (glances alternative)

Hey I just tried to upgrade from 0.5.6 to 0.5.7 and it completely killed my Home Assistant instance. Supervisor quit and some how it also killed my SSH access to the box. Eventually supervisor came back but I had to do a full box reboot to get ssh access back.

Update when supervisor came back it didn’t start any other add ons. Updating in that state seems to have worked.

I have the same here, i removed the addon and re installed it. But if i just stop the addon it will kill the whole HA…

I just installed 0.5.6 and it killed HA at the first restart of the addon. Removed it immediately. Had to restart the NUC.

Yep. Something is wrong with the addon right now.

Hi guys, sorry for the late reply i haven’t been recieving notifications for here. So i am currently working on updating the addon. I am re writing from the ground up to incorporate s6 so please bear with me. I should have this updated in a couple of weeks.

2 Likes

I have pushed an update to the repo, it’s the only other branch on there, If someone can try it out in local dev (.devcontainer and .vscode are there too) i would appreciate it. If i can get confirmation it works on someone else’s computer locally then i can push to main for testing. When i get time i will create another beta test repo for things like this.

0.6.0 Is out, i have had a few people test it and have all reported this has fixed the error, sorry about this!

Thanks for the great Addon. I got it up and running today on my HA instance running Raspberry Pi 4 and using this Grafana Dashboard to monitor the Pi - Raspberry Pi Monitoring dashboard for Grafana | Grafana Labs

1 Like

Thank you for a cool add-on!

I’m trying to understand whether I can use this add-on to store the system log from Home Assistant in influxDB using syslog. I’ve gotten the add-on up and running, but the syslog part eludes me.

Description of syslog: Monitoring Syslog Messages with Telegraf

My goal is to visualize in grafana like this: Syslog dashboard for Grafana | Grafana Labs

I’ll have to double check the version of telegram to make sure its supported, you would need to setup a custom configuration. I’ve never done anything with syslog personally, does HA support syslog

I have absolutely no idea whether HA supports syslog. When I stumbled upon your add-on it was because I was searching for whether influxDB is suitable for storing event logs. From what I’ve managed to read it is suitable and the path is via telegraf and syslog. I was hoping to cobble something together using Home Assistant to demonstrate at work what I was hoping we could do with our products.

OK cool let me have a look into it a bit more and get back to you :slight_smile: do you want home assistant specific syslogs?

ok so had a quick look and HA provides a syslog here Syslog - Home Assistant but im not sure if that is an input or an output, telegraf provides an input for syslog to be able to take the data, i need to update the version of telegraf as it is quite old, but im not 100% sure on how to get it working

Yes, I was hoping to get the HA events. Not that I necessarily want to store them like that, but I wanted to demonstrate that InfluxDB with telegraf could serve as a vessel to quickly navigate event logs and visualize warnings and errors using Grafana.

Hm… I wonder how I connect that to your telegraf. Let me know if that become obvious to you… :slight_smile:

I would like to do something similar. Did you ever get this working?

I am using the promtail addon to push syslogs to loki and visualize them with grafana. There I have the system syslog, the home assistant logs, all home assistant logs and logs from all other docker container.

@ Sabuto any why we can get a update on this good addon?

Currently I do not have time to maintain this addon and update it, I am looking for some help if anyone is willin Move to org / new maintainer · Issue #53 · sabuto/hassio-telegraf · GitHub

I got the same error. Solution was:

influxDB:
  enabled: true
  url: http://NAME_OF_INFLUX:8086
  db: telegraf
  retention_policy: ""

Syslog view in Grafana

I didn’t find how to configure Telegraf if Home Assistant is installed on top of Debian OS. The thing is that Grafana does not see the data from Telegraf, although they are in InfluxDB. I rummaged around a bit and found a solution. This is an option for those who have Home Assistant running on Debian/Ubuntu. In my case, it is Debian 11

  1. Syslog-ng must be installed, if not installed, then we put
sudo update
sudo apt-get install syslog-ng
  1. Configure syslog-ng. Opening syslog-ng.conf
sudo nano /etc/syslog-ng/syslog-ng.conf
  1. Adding to the lines

If the string already has source s_udp { udp(); }; , then we specify this

destination telegraf_local {syslog("127.0.0.1" port(6514));};
log { source(s_udp); destination(telegraf_local); };

If the string does not have source s_udp { udp(); }; , then we specify this

source s_udp { udp(); };
destination telegraf_local {syslog("127.0.0.1" port(6514));};
log { source(s_udp); destination(telegraf_local); };

image

Restart the syslog-ng service

sudo /etc/init.d/syslog-ng restart

Adding to the auto-upload if not added

sudo systemctl enable syslog-ng

Let’s check if the service has started:
sudo netstat -tulnp | grep syslog

If the service is running, we will see see the example below

udp        0      0 0.0.0.0:514             0.0.0.0:*                           408268/syslog-ng

In the telegraf.conf file, which is located on the path \share\telegraf\telegraf.conf, add the line

[[inputs.syslog]]
  server = "tcp://localhost:6514"

[[outputs.influxdb]]
  database = "telegraf"
  username = "telegraf"
  password = "telegraf"

In the settings of the Telegraf addon, we prescribe the following, and then save and run the Telegraf addon

custom_conf:
  enabled: true
  location: /share/telegraf/telegraf.conf
hostname: telegraf.local
influxDB:
  enabled: true
  url: http://a0d7b954-influxdb:8086
  db: telegraf
  username: telegraf
  password: telegraf
  retention_policy: 7d
kernel:
  enabled: true
swap:
  enabled: true
docker:
  enabled: false
  timeout: 5s
thermal:
  enabled: false
smart_monitor:
  enabled: false
  timeout: 30s
ipmi_sensor:
  enabled: false
  interval: 30s
  timeout: 20s
  server_user_id: user
  server_password: password
  server_protocol: lan
  server_ip: 192.168.1.2
influxDBv2:
  enabled: false
  url: http://127.0.0.1:9999
  organization: ""
  token: ""
  bucket: ""
prometheus:
  enabled: false
  metrics_path: /metrics

In order for the Syslog to be displayed in Grafana, you need to import the Syslog file

Download Syslog for Grafana from this link and import to Grafana or import the syslog_rev5 file.json in the attachment, which lies in the Dashboard folder

Text in Russian (Текст на русском)

Вид Syslog в Grafana

Не нашел как нужно настраивать Telegraf если Home Assistant установлен поверх ОС Debian. Все дело в том, что Grafana не видит данные с Telegraf, хотя они есть в InfluxDB. Немного порылся и нашел решение. Это вариант для тех у кого Home Assistant стоит на Debian/Ubuntu. В моем случае стоит Debian 11

  1. Должен быть установлен syslog-ng, если не установили, то ставим
sudo update
sudo apt-get install syslog-ng
  1. Настроить syslog-ng. Отрываем syslog-ng.conf
sudo nano /etc/syslog-ng/syslog-ng.conf
  1. Добавляем в строки

Если в строке уже имеется source s_udp { udp(); }; , то указываем так

destination telegraf_local {syslog("127.0.0.1" port(6514));};
log { source(s_udp); destination(telegraf_local); };

Если в строке не имеется source s_udp { udp(); }; , то указываем так

source s_udp { udp(); };
destination telegraf_local {syslog("127.0.0.1" port(6514));};
log { source(s_udp); destination(telegraf_local); };

image

Перезапустить службу syslog-ng

sudo /etc/init.d/syslog-ng restart

Добавляем в автозагрузку если не добавлено

sudo systemctl enable syslog-ng

Проверим, запустилась ли служба:
sudo netstat -tulnp | grep syslog

Если служба запущена, то увидим см.пример ниже

udp        0      0 0.0.0.0:514             0.0.0.0:*                           408268/syslog-ng

В фалик telegraf.conf который находится по пути \share\telegraf\telegraf.conf добавляем строку

[[inputs.syslog]]
  server = "tcp://localhost:6514"

[[outputs.influxdb]]
  database = "telegraf"
  username = "telegraf"
  password = "telegraf"

В настройках аддона Telegraf прописываем следующее, а после сохраняем и запускаем аддон Telegraf

custom_conf:
  enabled: true
  location: /share/telegraf/telegraf.conf
hostname: telegraf.local
influxDB:
  enabled: true
  url: http://a0d7b954-influxdb:8086
  db: telegraf
  username: telegraf
  password: telegraf
  retention_policy: 7d
kernel:
  enabled: true
swap:
  enabled: true
docker:
  enabled: false
  timeout: 5s
thermal:
  enabled: false
smart_monitor:
  enabled: false
  timeout: 30s
ipmi_sensor:
  enabled: false
  interval: 30s
  timeout: 20s
  server_user_id: user
  server_password: password
  server_protocol: lan
  server_ip: 192.168.1.2
influxDBv2:
  enabled: false
  url: http://127.0.0.1:9999
  organization: ""
  token: ""
  bucket: ""
prometheus:
  enabled: false
  metrics_path: /metrics

Чтобы в Grafana отображался Syslog, необходимо импортировать файлик Syslog

Скачиваем Syslog для Grafana по этой ссылке Syslog | Grafana Labs и импортируем в Grafana или импортируем файлик syslog_rev5.json во вложении, который лежит в папке Dashboard