diff --git a/doc/hmci.service b/doc/hmci.service new file mode 100644 index 0000000..bf34023 --- /dev/null +++ b/doc/hmci.service @@ -0,0 +1,10 @@ +[Unit] +Description=HMC Insights Service + +[Service] +TimeoutStartSec=0 +Restart=always +ExecStart=/opt/hmci/bin/hmci + +[Install] +WantedBy=default.target diff --git a/doc/service.txt b/doc/service.txt new file mode 100644 index 0000000..5833d79 --- /dev/null +++ b/doc/service.txt @@ -0,0 +1,4 @@ +To setup as a systemd service, copy the hmci.service +file into /etc/systemd/system/ and enable the service: + + systemctl enable hmci.service diff --git a/src/main/java/biz/nellemann/hmci/InfluxClient.java b/src/main/java/biz/nellemann/hmci/InfluxClient.java index b1a2d76..dfffc55 100644 --- a/src/main/java/biz/nellemann/hmci/InfluxClient.java +++ b/src/main/java/biz/nellemann/hmci/InfluxClient.java @@ -105,11 +105,11 @@ class InfluxClient { synchronized void writeBatchPoints() throws Exception { log.debug("writeBatchPoints()"); try { - influxDB.write(batchPoints); + influxDB.writeWithRetry(batchPoints); } catch(Exception e) { - log.error("writeBatchPoints() error - " + e.getMessage(), e); - if(++errorCounter > 3) { - log.info("writeBatchPoints() trying to logout / login"); + log.error("writeBatchPoints() error - " + e.getMessage()); + if(++errorCounter > 5) { + log.info("writeBatchPoints() forcing logout / login"); errorCounter = 0; logoff(); login();