Try to enable verbose logging. It will hopefully tell you why it fails. The "Error connecting to InfluxDB." is written if an exception occurs when trying to write data to influx. You logs show that initially the connection test was successful but in the process of sending data it failed. The reason why it failed is unclear, so please enable verbose logging to get more details.