Influxdb not storing data, single dot on grafana chart

  • Platform information:
    • Hardware: RPi 3B+ and RPi4
    • openHAB version: openHAB 2.5.12
      InfluxDB version 1.8.9
      Grafana v8.1.1

Everything have been working perfectly but suddenly today its not showing any data on grafana chart (please see the screenshot below), but Grafana shows data source is working. Each instances of DOTs represent a reboot of the Raspberry Pi:

I have faced this issue few days ago and I solved it by changing the user in services/influxdb.cfg from openhab to admin (3 users were created when setting my database in influxdb: admin, openhab, grafana). Then I rebooted the RPi and it started working again. This time I don’t know why it suddenly stopped working.

FYI: previously I have faced an error:

[ERROR] [org.influxdb.impl.BatchProcessor ] - Batch could not be sent. Data will be lost Caused by: java.net.ConnectException: Connection refused (Connection refused)

I resolved that error by changing line 25, to set sleep command to 10 seconds, in file: /usr/lib/influxdb/scripts/influxd-systemd-start.sh

I have checked that influxdb is running:

sudo systemctl status influxdb
[sudo] password for openhabian:
â—Ź influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-09-23 18:11:50 CDT; 17min ago
     Docs: https://docs.influxdata.com/influxdb/
  Process: 1629 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=0/SUCCESS)
 Main PID: 1630 (influxd)
    Tasks: 14 (limit: 4915)
   CGroup: /system.slice/influxdb.service
           └─1630 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Sep 23 18:28:00 FlowerRoom4 influxd-systemd-start.sh[1629]: ts=2021-09-23T23:28:00.040595Z lvl=info msg="Executing query" log_id=0WmEgT~W000 service=query query="SELECT value FROM openhab_f
Sep 23 18:28:00 FlowerRoom4 influxd-systemd-start.sh[1629]: [httpd] 127.0.0.1 - openhabf4 [23/Sep/2021:18:28:00 -0500] "GET /query?db=openhab_f4db&epoch=ms&p=%5BREDACTED%5D&q=select+value+f
Sep 23 18:28:00 FlowerRoom4 influxd-systemd-start.sh[1629]: ts=2021-09-23T23:28:00.054915Z lvl=info msg="Executing query" log_id=0WmEgT~W000 service=query query="SELECT value FROM openhab_f
Sep 23 18:28:00 FlowerRoom4 influxd-systemd-start.sh[1629]: [httpd] 127.0.0.1 - openhabf4 [23/Sep/2021:18:28:00 -0500] "GET /query?db=openhab_f4db&epoch=ms&p=%5BREDACTED%5D&q=select+value+f
Sep 23 18:29:00 FlowerRoom4 influxd-systemd-start.sh[1629]: ts=2021-09-23T23:29:00.028999Z lvl=info msg="Executing query" log_id=0WmEgT~W000 service=query query="SELECT value FROM openhab_f
Sep 23 18:29:00 FlowerRoom4 influxd-systemd-start.sh[1629]: [httpd] 127.0.0.1 - openhabf4 [23/Sep/2021:18:29:00 -0500] "GET /query?db=openhab_f4db&epoch=ms&p=%5BREDACTED%5D&q=select+value+f
Sep 23 18:29:00 FlowerRoom4 influxd-systemd-start.sh[1629]: ts=2021-09-23T23:29:00.043751Z lvl=info msg="Executing query" log_id=0WmEgT~W000 service=query query="SELECT value FROM openhab_f
Sep 23 18:29:00 FlowerRoom4 influxd-systemd-start.sh[1629]: [httpd] 127.0.0.1 - openhabf4 [23/Sep/2021:18:29:00 -0500] "GET /query?db=openhab_f4db&epoch=ms&p=%5BREDACTED%5D&q=select+value+f
Sep 23 18:29:00 FlowerRoom4 influxd-systemd-start.sh[1629]: ts=2021-09-23T23:29:00.058557Z lvl=info msg="Executing query" log_id=0WmEgT~W000 service=query query="SELECT value FROM openhab_f
Sep 23 18:29:00 FlowerRoom4 influxd-systemd-start.sh[1629]: [httpd] 127.0.0.1 - openhabf4 [23/Sep/2021:18:29:00 -0500] "GET /query?db=openhab_f4db&epoch=ms&p=%5BREDACTED%5D&q=select+value+f
lines 1-20/20 (END)

Another thing I just remembered, previously the grafana chart would show a SINGLE DOT, then after rebooting the Pi, it would say “No data in response”.

I have extensively searched for similar issues I am currently facing and possible solutions but I am not sure what else to do at this point. Any help would be greatly appreciated. Thank you.

that just shows select queries. It does not show that there are new values to be inserted.
Show the configuration of your persistence strategies. How often should values be stored.

Thank you for your reply. Here is my configuration of persistence strategies:

influxdb.persist

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
    every10Seconds  : "0/10 * * * * ?" 
    everyMinute     : "0 * * * * ?"
    everyHour       : "0 0 * * * ?"
    everyDay        : "0 0 0 * * ?"
}

/* 
 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).
 */
Items {
    // persist all items once a day and on every change and restore them from the db at startup
    * : strategy = every10Seconds, restoreOnStartup
}

That is going to wallop your system. How many Items are involved here?

There was some work in OH3 to have the influxdb connection retry if it fails, but you won’t get that at OH2.5

56 items as of now, but I’m planning to add more in the next couple weeks.

How do you suggest I set up persistence strategy?

Thank you so much for your response!

I don’t know what you need, but apply some thought.

Have you, say room temperature sensing? It’s probably only reporting every few minutes, that doesn’t change fast. Need to record it every ten seconds? Need to restore it at all?

If you’re building a new system you might review your choice of obsolete OH2 as well.

Thank you for your response. It was an older configuration that I just never updated. I changed it to record every minute for now. I need to record once a minute (temperature and humidity) because I need that data for another purpose. On one RPi, it seems to be working like before (influxdb and grafana charts). However, on another RPi, I am getting a message “No data in response” on grafana chart, as mentioned in my previous post:

I guess I have to manage this somehow until I find a stable solution.
Also, when I get some time I’ll look into migrating to OH3.

Thank you again for your suggestions and taking the time to reply to my post!

Your response really made me think and I realize its silly that I was persisting the way I was before. Haven’t really played around much with persistence before this but spent some time learning more about it and here are my new strategies:

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
    every10Seconds  : "0/10 * * * * ?" 
    everyMinute     : "0 * * * * ?"
    everyHour       : "0 0 * * * ?"
    everyDay        : "0 0 0 * * ?"
}

/* 
 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).
 */
Items {
    // persist all items of the group 
    F2_LEDs*, gSetpoints* : strategy = everyHour, restoreOnStartup
    // persist group item
    F2_LEDs : strategy = everyHour, restoreOnStartup
    // persist all items of the group
    F2_rh_group*, F2_temp_group* : strategy = everyMinute 
}

//persist all outputs (group F2_LEDs and all its items) and setpoints (group gSetpoints items only) everyHour and restoreOnStartup
//persist all inputs (items temp and items hum) everyMinute

So far everything looks good. InfluxDB is not acting up and grafana charts look great. Trying to learn and get better everyday. Sincerest thanks for your time and response!

It’s probably just working around some system weakness by reducing traffic, but if it works in practice for you all is good. :smiley:

1 Like

It also makes sense to use everyChange strategy, this will save each item on changed, maybe you may omit agressive dumps every 10 seconds and save much better resoluton for items, changing faster than every hour, e.g.

Strategies {
    everyMinute : "0 * * * * ?"
    everyQHour  : "0 */15 * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
}

Items {
	* : strategy = everyChange, restoreOnStartup, everyHour
}
1 Like