joaofl / hassio-addons

More add-ons for your Hass.io.
17 stars 22 forks source link

telegraf2hassio - 'could not get host informations' #23

Closed mauriceatkinson closed 10 months ago

mauriceatkinson commented 1 year ago

I have installed telegraf2hassio and the log file reports it has connected to the mqtt broker.

I have added the [[output.mqtt]] as per your telegraf.conf install but I get the error in the telegraf log file 2022-12-14T23:10:47Z E! [agent] Failed to connect to [outputs.mqtt], retrying in 15s, error was 'could not get host informations'

What am I doing wrong?

joaofl commented 1 year ago

This seems like a miss-configuration of telegraf itself, making it unable to reach your MQTT broker.

Have you checked the full example config, and if you are not missing any other field related to the host definition?

Check it here: https://github.com/joaofl/hassio-addons/blob/master/telegraf2hassio/resources/telegraf.conf

mauriceatkinson commented 1 year ago

I have checked but still struggling to see what I have done wrong. I am currently using telegraf for another service to import data into home assistant so i know my existing config works. It just when i add what I think I need for yours I get this error and then my other service stops as well

this is my config `#[global-tags]

[agent] interval = "600s" round_interval = true metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = "0s" flush_interval = "300s" flush_jitter = "0s" precision = "" quiet = false debug = true hostname = "" omit_hostname = true

#############################################################

output plugins

#############################################################

[[outputs.influxdb]] urls = ["http://127.0.0.1:8086"] database = "homeassistant" retention_policy = "autogen"
username = "homeassistant" password = "homeassistant" write_consistency = "any" timeout = "5s"

[[outputs.mqtt]] topic_prefix = "telegraf" username = "mqtt01" password = "maldives" data_format = "json"

############################################################

input plugins

############################################################

[[inputs.file]] files = ["/share/NurseryFeedScoreData.csv"]

charactor_encoding = "utf-8"

data_format = "csv" csv_header_row_count = 0 csv_skip_rows = 1 csv_skip_columns = 0 csv_delimiter = ","

csv_comment = "#"

csv_measurement_column = "trial" csv_tag_columns = ["feed time","Tank"] csv_column_names = ["trial","Tank","Time","feed time","leftover feed"] csv_column_types = ["string","string","string","int","float"] csv_timestamp_column = "Time" csv_timestamp_format = "2006-01-02 15:04"

###############################################################################

INPUT PLUGINS

###############################################################################

[[inputs.neptune_apex]]

servers = [ "http://192.168.2.19" , "http://192.168.2.24" ]

response_timeout = "5s"

###############################################################################

PROCESSOR PLUGINS

###############################################################################

[[processors.enum]] namepass = ["neptune_apex"] [[processors.enum.mapping]] field = "state" dest = "state_code" default = 0 [processors.enum.mapping.value_mappings] AON = 1 ON = 2 AOF = 3 OFF = 4

###############################################################################

[[inputs.neptune_apex]]

servers = ["http://192.168.2.24"]

response_timeout = "20s"

###############################################################################

[[processors.enum]]

namepass = ["neptune_apex"]

[[processors.enum.mapping]]

field = "state"

dest = "state_code"

default = 0

[processors.enum.mapping.value_mappings]

AON = 1

ON = 2

AOF = 3

OFF = 4

`

mauriceatkinson commented 1 year ago

Sorry. I omitted to add the server details into the output.mqtt section. Once configured this works great. thanks

joaofl commented 10 months ago

Sorry. I omitted to add the server details into the output.mqtt section. Once configured this works great. thanks

It is also missing on the template config I think. I should fix that!