[SOLVED] InfluxDB and Grafana delay problem

Hello guys,

I have a problem with data in my Influx database. Last entry for all items in database is “delayed” for about 9 hours. Let say now is 2018-06-18 18:15 and last temperature entry in database have timestamp 2018-06-18T09:15:00.138Z 26.7 and the latest value in Grafana have timestamp 2018-06-18 11:21. Is this normal behavour ? Is it possible to collect and display data for, let say, last hour and older ? My persistence file is:

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
}

Items {
        Fan_switch   : strategy = everyChange
        Sensor_1_temperature, Sensor_1_humidity, Sensor_1_heat_index, Sensor_1_switch_1, Sensor_1_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_2_temperature, Sensor_2_humidity, Sensor_2_heat_index, Sensor_2_switch_1, Sensor_2_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_3_temperature, Sensor_3_humidity, Sensor_3_heat_index, Sensor_3_switch_1, Sensor_3_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_4_temperature, Sensor_4_humidity, Sensor_4_heat_index, Sensor_4_switch_1, Sensor_4_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_5_temperature, Sensor_5_humidity, Sensor_5_heat_index, Sensor_5_switch_1, Sensor_5_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_6_temperature, Sensor_6_humidity, Sensor_6_heat_index, Sensor_6_switch_1, Sensor_6_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_7_temperature, Sensor_7_humidity, Sensor_7_heat_index, Sensor_7_switch_1, Sensor_7_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_8_temperature, Sensor_8_humidity, Sensor_8_heat_index, Sensor_8_switch_1, Sensor_8_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_9_temperature, Sensor_9_humidity, Sensor_9_heat_index, Sensor_9_switch_1, Sensor_9_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_10_temperature, Sensor_10_humidity, Sensor_10_heat_index, Sensor_10_switch_1, Sensor_10_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_11_temperature, Sensor_11_humidity, Sensor_11_heat_index, Sensor_11_switch_1, Sensor_11_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_12_temperature, Sensor_12_humidity, Sensor_12_heat_index, Sensor_12_switch_1, Sensor_12_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_13_temperature, Sensor_13_humidity, Sensor_13_heat_index, Sensor_13_switch_1, Sensor_13_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_14_temperature, Sensor_14_humidity, Sensor_14_heat_index, Sensor_14_switch_1, Sensor_14_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_15_temperature, Sensor_15_humidity, Sensor_15_heat_index, Sensor_15_switch_1, Sensor_15_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_16_temperature, Sensor_16_humidity, Sensor_16_heat_index, Sensor_16_switch_1, Sensor_16_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_17_temperature, Sensor_17_humidity, Sensor_17_heat_index, Sensor_17_switch_1, Sensor_17_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_18_temperature, Sensor_18_humidity, Sensor_18_heat_index, Sensor_18_switch_1, Sensor_18_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_19_temperature, Sensor_19_humidity, Sensor_19_heat_index, Sensor_19_switch_1, Sensor_19_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
        Sensor_20_temperature, Sensor_20_humidity, Sensor_20_heat_index, Sensor_20_switch_1, Sensor_20_switch_2   : strategy = everyMinute, everyHour, restoreOnStartup
}

And Grafana dashboard looks like that:

Could somebody, please, be so kind and give me a hint what could be the reason for this ?

Regards, Peter

Is the 9 hours due to the value in the InfluxDB being in GMT and your timezone being different? The ‘Z’ usually means GMT.

John, thank you for your answer :wink:

The system is installed on RaspberryPI 3. And yes, now I found that time on Raspberry shows 12:11:33. So it seem that this is a reason. I tryed to change locale settings on raspberry with openhabian-config but I got this:

[12:11:33] openhabian@openHABianPi:/etc/influxdb$ sudo nano openhabian-config
[12:14:12] openhabian@openHABianPi:/etc/influxdb$ sudo openhabian-config
bash: warning: setlocale: LC_ALL: cannot change locale (sl_SI.UTF-8)
2018-06-18_12:14:19_CEST [openHABian] Checking for root privileges... OK
2018-06-18_12:14:19_CEST [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2018-06-18_12:14:19_CEST [openHABian] openHABian configuration tool version: [master]v1.4.1-407(c424290)
2018-06-18_12:14:19_CEST [openHABian] Checking for changes in origin... fatal: unable to access 'https://github.com/openhab/openhabian.git/': Could not resolve host: github.com
OK
2018-06-18_12:14:40_CEST [openHABian] Setting timezone based on user choice... perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "sl_SI.UTF-8",
        LC_ALL = "sl_SI.UTF-8",
        LC_CTYPE = "sl_SI.UTF-8",
        LANG = (unset)
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory

Current default time zone: 'Europe/Ljubljana'
Local time is now:      Mon Jun 18 12:14:47 CEST 2018.
Universal Time is now:  Mon Jun 18 10:14:47 UTC 2018.

OK (Europe/Ljubljana)
2018-06-18_12:14:52_CEST [openHABian] Checking for default openHABian username:password combination... perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "sl_SI.UTF-8",
        LC_ALL = "sl_SI.UTF-8",
        LC_CTYPE = "sl_SI.UTF-8",
        LANG = (unset)
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
OK

I remeber that few months ago I manualy edit one of linux config files to change keyboard layout to Slovenian and also I manualy inserted locales for Slovenian in one file in /etc/… folder. Stupid me, obviously I created problem myself. Is it possible to restore locale settings without reinstalling the whole system ?

I think that I manualy change /etc/default/locale which looks like that:

[12:29:32] root@openHABianPi:~# cat /etc/default/locale
#  File generated by update-locale
#LANG=sl_SI.UTF-8
LC_CTYPE=sl_SI.UTF-8
LC_ALL=sl_SI.UTF-8
LANGUAGE=sl_SI.UTF-8

I’m no expert on this, but I did find this which describes how to add the locale - maybe you need to run this to get the missing locale?: sudo dpk-reconfigure locales

Sorry, I don’t know anything else about this.

I rebuild locales, time zone is set properly but actual system time is still 7 hours behind, like 13:01:01. I will try to figure out where is the problem somehow Thank you so much for your help ;).

Did you already install (and configure) ntp at debian side?
Raspberry Pi’s clock is independend from the openHAB clock, which is set through ntp binding. For Raspberry’s OS, you will have to install an extra packet (as I don’t use openHABian, I’m not sure if this is done by default). You can use

sudo apt update && sudo apt install ntp

to do this.

Hi, I found the reason for my problem. I moved my Raspberry Pi with ESP modules to another LAN with different IP addressing. Second LAN was accessible from my first LAN via static routes but unfortunately I wasn’t aware that they don’t have access to internet and therefore time sync was impossible (obviously there was problem with my static routes on both routers). I rebuild locales and timezone with openhabian-config and now everything work as expected. Thank you for your answer, I will set up ntp as described. I’m not linux expert but I’m trying with “learning by doing” :wink:

Regards, Peter

That’s the spirit :wink:

The winner is a dreamer who never give up … :smile:

1 Like