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.

Moderator: leecollings

User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by sincze »

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..
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Nautilus »

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: 483
Joined: Tuesday 12 August 2014 5:37
Target OS: Raspberry Pi / ODroid
Domoticz version: V3_8394
Location: Rumbeke,Belgium
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by ropske »

ok, thanks guys.
Will try to install the influx and grafana then :)
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Derik »

He...
Weet iemand waar je met ftp de data van Influxdb kunt vinden?
Heb een nieuwe setup..
En wil graag mijn oude db terug hebben...
aangezien ik weer op mijn Xu4 zit..
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
Prutsium
Posts: 92
Joined: Monday 18 June 2018 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany / Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Prutsium »

Use simple way of backup:
Backup: influxd backup -portable /media/Backup/influx/
Restore: influxd restore -portable /media/NAS2/NAS2-Backup/influx/

Thats all
(Correct paths to what you prefer its the location where the backup would be made to.)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest