Modul 93_DbRep - Reporting und Management von Datenbankinhalten (DbLog)

Begonnen von DS_Starter, 19 Mai 2016, 22:52:13

Vorheriges Thema - Nächstes Thema

DS_Starter

@Parallix,

ich habe die Version 8.53.17 eingecheckt, ist morgen früh im Update. Die Auflösung der symbolischen Links sollte nun funktionieren.

Grüße,
Heiko
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

PeterLustig

Hallo Heiko,

um meine Datenbank im Rahmen zu halten, nutze ich einige DbRep mit delEntries.
Dabei ist mir vor einiger Zeit aufgefallen, dass zwei Devices nicht vom Status "running" zu "done" wechseln.

Beide Devices besitzen ein reading-Attribut, welche längere Listen von Readings beinhalten. Die Listen sind mit Zeilenumbrüchen auf mehrere Zeilen im FHEMweb aufgeteilt

Die Datensätze werden in der Datenbank gelöscht, aber die DbRep-Devices bleiben bei "running" und beim nächsten Durchlauf erscheint im Log (mit Verbose 5) z.B.:
DbRep NASDbRepShortTime - WARNING - running process DEAD:988612 will be killed now to start a new operation

Die Zeilenumbrüche aus dem FHEMweb sind im SQL-Command in der Logausgabe an gleicher Stelle erkennbar und es fehlen (im Vergleich zu einem fehlerfreien DbRep-Device) die letzten beiden Zeilen bei der Log-Ausgabe:

2025.06.03 03:10:00.003 3: DbRep NASDbRepShortTime_Wechselrichter - WARNING - running process DEAD:3094649 will be killed now to start a new operation
2025.06.03 03:10:00.003 4: DbRep NASDbRepShortTime_Wechselrichter - -------- New selection ---------
2025.06.03 03:10:00.003 4: DbRep NASDbRepShortTime_Wechselrichter - Command: delEntries
2025.06.03 03:10:00.003 4: DbRep NASDbRepShortTime_Wechselrichter - timeOlderThan - year: , day: 30, hour: , min: , sec:
2025.06.03 03:10:00.004 4: DbRep NASDbRepShortTime_Wechselrichter - startMonth: 2 endMonth: 4 lastleapyear:  baseYear: 2025 diffdaylight:1 isdaylight:1
2025.06.03 03:10:00.004 4: DbRep NASDbRepShortTime_Wechselrichter - FullDay option: 0
2025.06.03 03:10:00.004 5: DbRep NASDbRepShortTime_Wechselrichter - Timestamp begin epocheseconds: 1742342412
2025.06.03 03:10:00.004 4: DbRep NASDbRepShortTime_Wechselrichter - Timestamp begin human readable: 2025-03-19 01:00:12
2025.06.03 03:10:00.004 4: DbRep NASDbRepShortTime_Wechselrichter - Time difference to current time for calculating Timestamp end: 2592001 sec
2025.06.03 03:10:00.004 5: DbRep NASDbRepShortTime_Wechselrichter - Timestamp end epocheseconds: 1746320999.00426
2025.06.03 03:10:00.004 4: DbRep NASDbRepShortTime_Wechselrichter - Timestamp end human readable: 2025-05-04 03:09:59
2025.06.03 03:10:00.019 5: DbRep NASDbRepShortTime_Wechselrichter - BlockingCall with PID "3182397" started
2025.06.03 03:10:00.072 4: DbRep NASDbRepShortTime_Wechselrichter - Database Model: MARIADB
2025.06.03 03:10:00.072 4: DbRep NASDbRepShortTime_Wechselrichter - Database connect - user: fhemuser, UTF-8 option set: no
2025.06.03 03:10:00.074 5: DbRep NASDbRepShortTime_Wechselrichter - IsTimeSet: 1, IsAggrSet: 0
2025.06.03 03:10:00.075 5: DbRep NASDbRepShortTime_Wechselrichter - Devices for operation -
included (1): Wechselrichter
included with wildcard: 
excluded (0): 
excluded with wildcard:
2025.06.03 03:10:00.075 5: DbRep NASDbRepShortTime_Wechselrichter - Readings for operation -
included (12): 'usr_VerbrauchSumme','usr_VerbrauchPV','usr_insHaus','PM_Leistung_Momentan_W','usr_VerbrauchNetz','
usr_ausNetz','WR_String_Effizienz','usr_insNetz','WR_String2_Effizienz','WR_String1_Effizienz','
WR_Energie_Gesamt_kWh','WR_Leistung_EingangSolar_Gesamt_kWh'
included with wildcard: 
excluded (0): 
excluded with wildcard:
2025.06.03 03:10:00.075 4: DbRep NASDbRepShortTime_Wechselrichter - SQL execute: delete FROM history where ( DEVICE = 'Wechselrichter' ) AND ( READING IN ('usr_VerbrauchSumme','usr_VerbrauchPV','usr_insHaus','PM_Leistung_Momentan_W','usr_VerbrauchNetz','
usr_ausNetz','WR_String_Effizienz','usr_insNetz','WR_String2_Effizienz','WR_String1_Effizienz','
WR_Energie_Gesamt_kWh','WR_Leistung_EingangSolar_Gesamt_kWh') ) AND TIMESTAMP >= '2025-03-19 01:00:12' AND TIMESTAMP <= '2025-05-04 03:09:59' ;
2025.06.03 03:10:00.527 5: DbRep NASDbRepShortTime_Wechselrichter - Number of deleted rows: 36255

Entferne ich die Zeilenumbrüche im reading-Attribut, tauchen die beschriebenen Probleme nicht auf und es läuft einwandfrei.

Was ich eigentlich versuche zu erklären: Ich glaube, das Parsen des reading-Attributs macht Probleme.....



list NASDbRepShortTime_Wechselrichter

Internals:
   DATABASE   fhem
   DEF        NASDbLog
   FUUID      66cc838e-f33f-1632-c9eb-662b59f9627187ff
   FVERSION   93_DbRep.pm:v1.1.1-s29390/2024-12-01
   LASTCMD    delEntries
   MODEL      Client
   NAME       NASDbRepShortTime_Wechselrichter
   NOTIFYDEV  global,NASDbRepShortTime_Wechselrichter
   NR         783
   NTFY_ORDER 50-NASDbRepShortTime_Wechselrichter
   ROLE       Client
   STATE      running
   TYPE       DbRep
   eventCount 14
   HELPER:
     DBLOGDEVICE NASDbLog
     GRANTS     ALL PRIVILEGES,USAGE
     IDRETRIES  2
     MINTS      2025-03-19 01:00:12
     PACKAGE    main
     VERSION    8.53.16
     CV:
       aggregation no
       aggsec     1
       destr      2025-05-06
       dsstr      2025-03-19
       epoch_seconds_end 1746538901.17879
       mestr      05
       msstr      03
       testr      15:41:41
       tsstr      01:00:12
       wdadd     
       yestr      2025
       ysstr      2025
     DBREPCOL:
       COLSET     1
       DEVICE     64
       EVENT      512
       READING    64
       TYPE       64
       UNIT       32
       VALUE      128
     RUNNING_PID:
       abortFn    DbRep_ParseAborted
       bc_pid     134933
       finishFn   DbRep_del_Done
       fn         DbRep_del
       loglevel   5
       pid        DEAD:3875621
       telnet     telnetForBlockingFn_1747305852.16629_127.0.0.1_57992
       terminated 1
       timeout    86400
       abortArg:
       arg:
         device     Wechselrichter
         name       NASDbRepShortTime_Wechselrichter
         opt        delEntries
         prop       
         reading    usr_VerbrauchSumme,usr_VerbrauchPV,usr_insHaus,PM_Leistung_Momentan_W,usr_VerbrauchNetz,
usr_ausNetz,WR_String_Effizienz,usr_insNetz,WR_String2_Effizienz,WR_String1_Effizienz,
WR_Energie_Gesamt_kWh,WR_Leistung_EingangSolar_Gesamt_kWh
         rsf        2025-03-19 01:00:12
         rsn        2025-05-06 15:41:41
         table      history
         ts         no_aggregation#2025-03-19 01:00:12#2025-05-06 15:41:41|
         hash:
   Helper:
     DBLOG:
       BlockingInfo:
         NASDbLog:
           TIME       1748244248.69579
           VALUE      <html><table border=2 bordercolor='darkgreen' cellspacing=0><tr><td style='padding-right:5px;padding-left:5px;font-weight:bold'>PID</td><td style='padding-right:5px;padding-left:5px;font-weight:bold'>FUNCTION</td><td style='padding-right:5px;padding-left:5px;font-weight:bold'>ARGUMENTS</td><td style='padding-right:5px;padding-left:5px;font-weight:bold'>TIMEOUT</td><td style='padding-right:5px;padding-left:5px;font-weight:bold'>CONNECTEDVIA</td></tr><tr><td style='padding-right:5px;padding-left:5px'>1084198</td><td style='padding-right:5px;padding-left:5px'>PRESENCE2_doDaemonUnBlocking</td><td style='padding-right:5px;padding-left:5px'>PsnceDaemon#pres2_AppleTV,pres2_BambuLab,pres2_CCU,pres2_CCU_Host,pres2_Chomecast,pres2_Delock1,pre...</td><td style='padding-right:5px;padding-left:5px'>60</td><td style='padding-right:5px;padding-left:5px'>telnetForBlockingFn_1747305852.16629_127.0.0.1_40068</td></tr></table></html>
       Blocking_Count:
         NASDbLog:
           TIME       1748244248.69579
           VALUE      1
       background_processing_time:
         NASDbLog:
           TIME       1747703410.77686
           VALUE      10.7152
       connectionEncoding:
         NASDbLog:
           TIME       1747703410.77686
           VALUE      utf8mb4
       dbEncoding:
         NASDbLog:
           TIME       1747703410.77686
           VALUE      utf8mb4
       dbModel:
         NASDbLog:
           TIME       1747703410.77686
           VALUE      MARIADB
       errortext:
         NASDbLog:
           TIME       1748011031.22665
           VALUE      Can't use admin credentials for database access, see logfile !
       indexState:
         NASDbLog:
           TIME       1747703410.77686
           VALUE      Index Report_Idx doesn't exist. Please create the index by "set NASDbRepShortTime_Wechselrichter index recreate_Report_Idx" command !
       sql_processing_time:
         NASDbLog:
           TIME       1747703410.77686
           VALUE      10.7133
       state:
         NASDbLog:
           TIME       1748308200.00384
           VALUE      running
       timestamp_oldest_dataset:
         NASDbLog:
           TIME       1747703410.77686
           VALUE      2025-03-19 01:00:12
       userRights:
         NASDbLog:
           TIME       1747703410.77686
           VALUE      ALL PRIVILEGES,USAGE
   OLDREADINGS:
   READINGS:
     2025-06-05 15:41:42   state           running
   hmccu:
Attributes:
   DbLogExclude .*
   devStateIcon done:10px-kreis-gruen .*disconnect:10px-kreis-rot .*connected:10px-kreis-gruen
   device     Wechselrichter
   event-on-change-reading .*
   reading    usr_VerbrauchSumme,usr_VerbrauchPV,usr_insHaus,PM_Leistung_Momentan_W,usr_VerbrauchNetz,
usr_ausNetz,WR_String_Effizienz,usr_insNetz,WR_String2_Effizienz,WR_String1_Effizienz,
WR_Energie_Gesamt_kWh,WR_Leistung_EingangSolar_Gesamt_kWh
   room       DBLog
   showproctime 1
   timeOlderThan d:30
   verbose    5


DS_Starter

Hallo Peter,

ist mir bei meinen Reps noch nicht aufgefallen, aber schaue ich mir nach meinem Urlaub gerne mal an.
Ich hätte einen SQL Fehler erwartet wenn der Parse nicht richtig funktionieren würde ... aber wir werden sehen.  ;)

LG,
Heiko
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter