[Gelöst] Eine Verständnisfrage zu dblog mit gplot-editor

Begonnen von cortmen, 14 August 2016, 00:30:18

Vorheriges Thema - Nächstes Thema

cortmen

Hallo zusammen,

folgende Daten stehen im fhem->current-table der mysql-db.

EVENT: cpu_temp_stat: 39.00 72.00 41.98
Reading: cpu_temp_stat
VALUE: 39.00 72.00 41.98

In meiner gplot File SM_DB_CPUTMP (liegt als BLOB in der configDB in der SQL DB)


set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<L1>'
set ytics
set y2tics
set grid y2tics
set ylabel "Min -- Max. Temp."
set y2label "Aktuelle Temp."
#mydblog sysmon:cpu_temp_stat:::$val=~s/([\d.]*).[\d.]*.[\d.]*.[\d.]*.[\d.]*/$1/eg
#mydblog sysmon:cpu_temp_stat:::$val=~s/([\d.]*).[\d.]*.[\d.]*.[\d.]*.[\d.]*/$1/eg
#mydblog sysmon:cpu_temp_stat:::$val=~s/([\d.]*).[\d.]*.[\d.]*.[\d.]*.[\d.]*/$1/eg
plot \
"<awk '/cpu_temp_stat/ {print $1, $4}' <IN>" \
using 1:2 ls l0 axes x1y1 title 'Min.Temp' lw 1 with lines \
"<awk '/cpu_temp_stat/ {print $1, $4}' <IN>" \
using 1:2 ls l2 axes x1y1 title 'Max.Temp' lw 1 with lines \
"<awk '/cpu_temp_stat/ {print $1, $4}' <IN>" \
using 1:2 ls l3 axes x1y1 title 'Akt. Temp' lw 1 with lines


Die speziellen Perl RegEx    s/ single line  /g global  /e evaluate inkl. [\d.]*  passen schon.

Mit den /$1 /$2 /$3 Variablen habe ich schon experimentiert, auch im awk '/cpu_temp_stat/ {print $2, $4}' $3 / etc
Leide habe ich auch keine Infos zum get Befehl (Lesen auf der Logfile) gefunden.


Hat jemand einen Lösungsansatz, ich möchte einfach diese 3 Werte loggen und ausgeben. Thx!



cortmen

 :) Nach gut einer Stunde perl regex einlesen.

ZitatUm an die gespeicherten Werte heranzukommen, stellt Perl die vordefinierte Variablen $1, $2, $3 usw. zur Verfügung.
In $1 ist der Inhalt der ersten runden Klammer im regulären Ausdruck gespeichert, in $2 der Inhalt der zweiten runden Klammer.

So läuft es wie ich es wollte.

set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<L1>'
set ytics
set y2tics
set grid y2tics
set ylabel "Min -- Max. Temp."
set y2label "Aktuelle Temp."

#mydblog sysmon:cpu_temp_stat:::$val=~s/([0-9][0-9].[0-9][0-9]).*([0-9][0-9].[0-9][0-9]).*([0-9][0-9].[0-9][0-9]).*/$1/eg
#mydblog sysmon:cpu_temp_stat:::$val=~s/([0-9][0-9].[0-9][0-9]).*([0-9][0-9].[0-9][0-9]).*([0-9][0-9].[0-9][0-9]).*/$2/eg
#mydblog sysmon:cpu_temp_stat:::$val=~s/([0-9][0-9].[0-9][0-9]).*([0-9][0-9].[0-9][0-9]).*([0-9][0-9].[0-9][0-9]).*/$3/eg

plot "<IN>" using 1:2 axes x1y1 title 'Min.Temp' ls l0 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y1 title 'Max.Temp' ls l1 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Akt. Temp' ls l2 lw 1 with lines