Grafana with InfluxDB for Domoticz

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.
Trigun
Posts: 187
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 4.9700
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Trigun » Sunday 09 April 2017 0:43

Ok; sounds great! I am a php noob though but I'll definitely check it out! For now I only need the function to send data to the influx db. So I can use it in grafana.


Sent from my iPhone using Tapatalk

grubstake
Posts: 12
Joined: Tuesday 14 February 2017 22:49
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by grubstake » Wednesday 12 April 2017 0:04

by Trigun » Saturday 08 April 2017 23:29
grubstake wrote:
The InfluxDB data push on Domoticz is broken, dates do not load correctly in InfluxDB, putting them out of range and resulting in empty charts in Grafana even though it has a connection with the database.

Don't waste your time trying to get this to work until the data push is fixed.
Hi, I checken the outcome in domoticz and grafana with influx seem to work fine. I believe it's a matter of configuration. How do you know it's broken?
I am running Domoticz version 3.6708 2017/02/14. The Influx data push code was significantly changed in this version and the timestamps data is not correctly loaded. There is no adjustable configuration for the timestamp in this version.

All my sensor data are loading into InfluxDB with no problem using the Influx data push. Unfortunately, without usable timestamps :(

I also spent many hours trying to configure HTTP push. Unfortunately, the problem is exactly opposite...the timestamps work perfectly, but I have been unable to get the data elements required to work.

In this thread I detailed my issues. https://www.domoticz.com/forum/viewtopi ... 28&t=16108

I am not surprised if earlier versions of InfluxDB push and HTTP push are working differently.

Has ANYONE using Domoticz 3.6.08 + been successful using Influx Data Push? I would be happy to be proven wrong, but I've spent nearly two days trying to resolve this problem.

Please include your Domoticz version number, at the top left of your screen below the Domoticz logo, if you reply with any information.

Trigun
Posts: 187
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 4.9700
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Trigun » Sunday 30 April 2017 0:37

Hi grubstake, allthough i am sending my data to the influx db via php now, I did use the http push within domoticz 3.587 for quite a while without any issues. Perhaps it's a version issue? I did see that in the featurelist for the new version the http push has been re-developed. I suggest try to run the last stable version 3.587 see how that works out.


Sent from my iPhone using Tapatalk

kijdhfcjdks
Posts: 10
Joined: Wednesday 21 June 2017 11:26
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by kijdhfcjdks » Wednesday 21 June 2017 13:22

Hi, I have InfluxDB and Grafana working on a Raspberry Pi 3. Thought I'd dump the complete instructions as it may save someone some time.

Domoticz: 3.5877
Influxdb: 1.2.4
Grafana: 4.1.2

Install InfluxDB

Code: Select all

sudo apt-get update
sudo apt-get upgrade
wget https://dl.influxdata.com/influxdb/releases/influxdb_1.2.4_armhf.deb
sudo dpkg -i influxdb_1.2.4_armhf.deb
sudo nano /etc/influxdb/influxdb.conf
Uncomment and set these options:

Code: Select all

[admin]
  # Determines whether the admin service is enabled.
enabled = true
  # The default bind address used by the admin service.
bind-address = ":8083"
[http]
  # Determines whether HTTP endpoint is enabled.
 enabled = true
  # The bind address used by the HTTP service.
bind-address = ":8086"
Start InfluxDB with:

Code: Select all

sudo service influxdb start
Go to: http://[IP]:8083/
CREATE DATABASE "domoticz"
Setup the user (domoticz/domoticz) in InfluxDB Connection Settings:
influxsettings.png
influxsettings.png (43.33 KiB) Viewed 4373 times
In Domoticz go to: Setup => Settings => Data Push => HTTP Link
Use the following URL:

Code: Select all

http:// [IP]:8086/write?db=domoticz&u=domoticz&p=domoticz&precision=ms
Setup the sensors like in this screenshot (device_+"Target Variable" will be the table name in InfluxDB:
domoticz-httplink.png
domoticz-httplink.png (370.8 KiB) Viewed 4373 times
Verify that there's data in the relevant InfluxDB table, e.g. SELECT * FROM deviceX

Grafana install

Code: Select all

wget https://github.com/fg2it/grafana-on-raspberry/releases/download/v4.1.2/grafana_4.1.2-1487023783_armhf.deb
sudo apt-get install -y adduser libfontconfig
sudo dpkg -i grafana_4.1.2-1487023783_armhf.deb
Add this to /etc/rc.local

Code: Select all

sudo service grafana-server start

Code: Select all

sudo reboot
Access at:
http:// [IP]:3000
admin/admin
Add datasource
grafana.png
grafana.png (76.93 KiB) Viewed 4373 times
Create a Dashboard.
Done!

Number8
Posts: 288
Joined: Friday 23 May 2014 7:55
Target OS: Raspberry Pi
Domoticz version: 3.5103
Location: Saint Pierre de Jards
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Number8 » Monday 31 July 2017 15:50

Hello

I can't get influxdb working, could someone give me a hand, see this thread: viewtopic.php?f=6&t=18619
Thank you

User avatar
sincze
Posts: 960
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by sincze » Monday 31 July 2017 21:49

kijdhfcjdks wrote:Hi, I have InfluxDB and Grafana working on a Raspberry Pi 3. Thought I'd dump the complete instructions as it may save someone some time.

Domoticz: 3.5877
Influxdb: 1.2.4
Grafana: 4.1.2
...
Done!
This is very nice Wiki material ;-) :D
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

wergeld
Posts: 15
Joined: Friday 01 January 2016 0:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by wergeld » Tuesday 01 August 2017 19:03

kijdhfcjdks wrote:Hi, I have InfluxDB and Grafana working on a Raspberry Pi 3. Thought I'd dump the complete instructions as it may save someone some time...
I followed this tutorial and it worked great!
I find InfluxDB to be a pain though if you need to remove a data point (like, you can't actually delete it - you have to add in a new value with the same timestamp). Grafana is very interesting - just wish there was better SQL Server integration as that is what I have most of my data in (I am a data scientists by trade).

User avatar
gizmocuz
Posts: 8674
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by gizmocuz » Sunday 10 September 2017 18:36

InfluxDB is a great database, and once correctly setup, it's a no-brainer.
True... a native grafana->domoticz implementation would be great!
These days it is very easy to install everything via a 'docker' , for instance with portainer.io on a modern odroid uc4
Quality outlives Quantity!

kurniawan77
Posts: 79
Joined: Wednesday 21 January 2015 21:23
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by kurniawan77 » Saturday 30 September 2017 17:58

Is it possible to "PUT" my data from the past three years into influxdb?

dlefol
Posts: 47
Joined: Monday 21 December 2015 17:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by dlefol » Sunday 29 October 2017 9:00

Hello,

Did you find a way to push your past data into Influx ? I'm starting to look at Influx and would like to push my historic data too.

Cheers

User avatar
gizmocuz
Posts: 8674
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by gizmocuz » Sunday 29 October 2017 9:51

you could make a bash script for this... it won't be easy
Quality outlives Quantity!

User avatar
Derik
Posts: 2150
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Derik » Monday 13 November 2017 22:05

Dear all.
Do i need to install Grafan on the same hardware where is domoticz is on running?
Or can i run on a other [ slave ] domoticz device..?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups

Trigun
Posts: 187
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 4.9700
Contact:

Grafana with InfluxDB for Domoticz

Post by Trigun » Monday 13 November 2017 22:08

you can run it on any device as long as you point the data towards the device on which the database is running and just point Grafana to the dB server

Those two can be on the same server by the way

Sent from my iPhone using Tapatalk

CaesarPL
Posts: 128
Joined: Tuesday 08 November 2016 15:03
Target OS: Raspberry Pi
Domoticz version:
Location: Poland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by CaesarPL » Tuesday 14 November 2017 9:56

It doesn't have to be domoticz, at all. My goal this week is to install it next to Max2play :)
HW:Raspberry PiB+,Pi3,PiB,RFLink,FA20RF,DCS-930L,DCS-935L,Clarus switches,RF Temp sensors,Owl Micro+,Mi Flora,Kerui,Yeelight,Xiaomi,Broadlink RMM3,Alexa
SF:Jessie,Dmtcz 3.8153,Logitech Media srv,PiCorePlayers,Dashticz,Max2Play,InfluxDB,Grafana,HABridge

thorian
Posts: 30
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi
Domoticz version: 2.2563
Location: Poland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by thorian » Wednesday 22 November 2017 9:54

Couple of notes:
- the 'old HTTP Send' still works very well with newest Domoticz
- the ESPEasy software has now Advanced Generic HTTP which allows direct InfluxDB update, works along the Domoticz or/and MQTT update
Last edited by thorian on Friday 01 December 2017 14:38, edited 1 time in total.

glsf91
Posts: 37
Joined: Tuesday 14 November 2017 22:56
Target OS: Linux
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by glsf91 » Wednesday 29 November 2017 0:49

In stable version de Data push influxdb is working.
Should data push influxdb in beta (3.8755) work?
I don't see anything in log when Debug to logfile is on.

Edit: suddenly it is working. Forget this please.

glsf91
Posts: 37
Joined: Tuesday 14 November 2017 22:56
Target OS: Linux
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by glsf91 » Saturday 30 December 2017 19:48

Is InflluxDB not working with Xiaomi temperature sensor (through gateway)?

I don't see anything in InfluxDB or Influxlink messages in the logfile.

Other temperature sensor (by RF) are working.

Edit: Temperature sensor is not working with influxdb. But the combined Tem+Humidity sensor is working with influxdb.

Nautilus
Posts: 764
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Nautilus » Monday 01 January 2018 23:10

I installed a couple of days ago Influxdb (latest version so also needed to install Chronograf) and started using the native integration with 5+ temp sensors. That is the only bigger change in my setup (RPi3, latest Domoticz beta) for a few weeks and I've now witnessed unresponsive web gui about every six hours (Monit restarts Domoticz if it cannot fetch the json url for status but from the logs it seems that Domoticz keeps running normally and no errors in the log) and CPU usage has gone from avg 2% to 5% while RAM usage has increased from 10-15% range to 20-25% (as recorded by the internal hardware sensors in Domoticz).

Before these changes Domoticz would have an uptime of 1-5 days at least (not sure why it has not been longer than that for a few months now, maybe related to the memory leakage) so change is quite clear. Has anyone else witnessed something like this and any pointer of how to make it more stable?

dlefol
Posts: 47
Joined: Monday 21 December 2015 17:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by dlefol » Thursday 19 April 2018 21:55

My repy is a bit late so hopefully you found a solution already but on my system (similar setup with RPi3, influx and Monit), I started having issues with Monit restarting domoticz regularly and unresponsive web ui too. It always seemed to coincide with the automatic backup that domoticz was doing of the database (every hours). It got worst after installing influx and I guess it's related to influx producing a lot of read and/or write on the SD card at the same time and thus making the backup of the DB longer (only a guess I can be completely wrong).
I recently bought a PiDrive (hard drive for RPi) to replace my SD card and it improved quite a lot the situation (1 or 2 monit reboot in the past couple of month at most instead of once a week maybe before). I think this is due to the hard drive having faster access time than the SD card I was using before.

ropske
Posts: 313
Joined: Tuesday 12 August 2014 5:37
Target OS: Raspberry Pi
Domoticz version: V3_8394
Location: Rumbeke,Belgium
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by ropske » Thursday 19 April 2018 22:37

sincze wrote:
Saturday 08 April 2017 23:56
I use Pass2PHP ;-0

Code: Select all

<?php

        $input = ($s['Electra']);
        $meter = explode(";",$input);
        
        influxdb("Electra_Usage",$meter[4]);
        influxdb("Electra_Return",$meter[5]);
And dump the data straight into influxdb.

If you would use Pass2Php the function could looks like:

Code: Select all

function influxdb($device,$value)
{
// FAMOUS STRING REPLACEMENT UTILITY
    if (strpos($device, " ") !== false) { $device=str_replace(" ","_",$device); }
// ENDOF FAMOUS STRING REPLACEMENT UTILITY
   $postdata = ("device_$device value=$value ".system('date +%s%N'));
//   lg('InluxDB Data: '.$postdata);

    $opts = array('http' =>
        array(
            'method'  => 'POST',
            'header'  => 'Content-Type:application/octet-stream',
            'content' => $postdata
        )
    );

    $context  = stream_context_create($opts);
    $result = file_get_contents('http://192.*.*.*:8086/write?db=domoticz', false, $context);
}
hi mate,
long time no see :p
just wondering if you have an 'updated' version of your influx program in php?
I want to use it also, i was writing something myself, but why writing something on my own, when there is already something existing :p

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest