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.
User avatar
sincze
Posts: 944
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 » Friday 20 April 2018 23:01

ropske wrote:
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
Indeed indeed
You know how to reach me my friend ;-)
Actually the current setup as shown above has been working ever since. I'm totally happy with it. Something not working for you correctly?
I moved my influxdb to a spare machine and have grafana in a docker on a synology for representing the data. So the domoticz machine is not under a lot of stress..
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.

Nautilus
Posts: 756
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 » Sunday 22 April 2018 23:08

dlefol wrote:
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.
I ended up moving influxdb to another RPi that I already had for another purpose. So basically never got to the bottom of this but things went back to normal after the move...:)

ropske
Posts: 311
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 » Monday 23 April 2018 9:31

ok, thanks guys.
Will try to install the influx and grafana then :)

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests