Ein Modul zur Erfassen von diversen RPi/Linux-Statistiken (SYSMON)

Begonnen von hexenmeister, 06 Dezember 2013, 17:44:38

Vorheriges Thema - Nächstes Thema

hexenmeister

ZitatIch frage mich warum wird hier eine Begrenzung empfohlen mit...
Die Logs sehen schöner aus, wenn mit event-on-update-reading gearbeitet wird, ohne Lücken. Jeder kann natürlich anders machen.

ZitatWie komme ich nun zu einer Event/Datenreduktion?
Indem man nur interessante Readings aktualiseren lässt.

ZitatWie kann ich bei Event-on-change-reading in Zusammenhang mit Kombi-Readings "eth0_diff: RX: 0.66 MB, TX: 0.06 MB, Total: 0.72 MB" ein [:threshold] eingeben, damit ich nur bei größeren Änderungen ein event erzeuge?
Meines Wissens nach leider gar nicht.

ZitatWie viel Sinn macht eine Erhöhung auf "define sysmon SYSMON 10 1 1 10"? Geht mir da nicht sinnvolle Information verloren?
Eventuell. Man muss vorab überlegen, welche Daten und wie aktuell man braucht / haben will.

ZitatDie CommandRef zu SYSMON ist wirklich vorbildlich ausführlich und auch die Beispiele sind toll.
Danke :)

ZitatSVG Plots sind nur anhand von SVG FileLog beschrieben.
Ich verwende kein DBLog, kann daher dazu leider nichts sagen.

Zitat
Seit ich mit DbLog und Sysmon experimentiere schlägt bei meinem Raspi relativ oft "Perfmon" an und meldet Verzögerungen von mehreren Sekunden und es kommt zu Freezing bei dem Fhem nicht reagiert. Primär fällt mir das auf, wenn ich meine aktuellen Sysmon Filelogs anschauen möchte
Meine Experimente mit DBLog haben auch zu einem merklich langsameren System geführt. War jedoch lange her und auf einer recht schwachen Hardware.
Maintainer: MQTT_GENERIC_BRIDGE, SYSMON, SMARTMON, systemd_watchdog, MQTT, MQTT_DEVICE, MQTT_BRIDGE
Contrib: dev_proxy

Ajuba

Danke Hexenmeister für die ausführlichen Antworten.
Noch 2 Rückfragen:

Bezüglich "nur interessante Reading" aufzeichnen:
Was ist eigentlich der Unterschied zwischen "loadavg" und "stat_cpu_percent" ? Ist nicht  "loadavg" in irgendeiner Form proportional zu den "stat_cpu_percent" Werten?

Von wem sind eigentlich die vorhandenen DbLog Gplot Dateien?
Bei den DbLogs bin ich nur mit "SM_DB_Load.gplot" erfolgreich gewesen. Bei den anderen kommt im Bereich wo der Graph zu sehen sein sollte eine dicke, große XML-Fehlermeldung. Die Spaltenbreite meiner SQL Datenbank habe ich schon erhöht. Aus dem Gplot Syntax werde ich zur Zeit noch nicht schlau um das Problem selbst zu untersuchen.
FHEM auf RPi3, Homematic CCU3 mit Cuxd und CUL 868 für FS20, Siemens S7 über CP343-1,
DbLog zu MySQL auf NAS QNAP TS-253D,
Yeelight

kadettilac89

Zitat von: Ajuba am 06 März 2018, 14:50:22
Von wem sind eigentlich die vorhandenen DbLog Gplot Dateien?
Bei den DbLogs bin ich nur mit "SM_DB_Load.gplot" erfolgreich gewesen. Bei den anderen kommt im Bereich wo der Graph zu sehen sein sollte eine dicke, große XML-Fehlermeldung. Die Spaltenbreite meiner SQL Datenbank habe ich schon erhöht. Aus dem Gplot Syntax werde ich zur Zeit noch nicht schlau um das Problem selbst zu untersuchen.

Ich habe meine Plots selber erstellt, wenn du mir ein konkrete Kennzahl nennst, und ich dafür einen Plot habe, könnte ich dir die Def hier reinposten. Ich meine so als Vorlage ... ja, ich verwende DBLog :)

Ajuba

Zitat von: kadettilac89 am 06 März 2018, 14:57:46
Ich habe meine Plots selber erstellt, wenn du mir ein konkrete Kennzahl nennst, und ich dafür einen Plot habe, könnte ich dir die Def hier reinposten.

Das wäre sehr nett. Ich denke folgende wären sinnvoll:

  • stat_cpu_percent (Dabei wäre wahrscheinlich die Summe aller Prozesse auch sinnvoll. Den Unterschied zu loadavg verstehe ich noch nicht)

  • eth0_diff (also TX und RX)
  • ram
  • cpu_temp bzw. cpu_temp_avg

Hast du bei der Datenbank auch die Spaltenbreite von Value auf varchar(64) geändert?
Muss ich sonst noch was beachten?
FHEM auf RPi3, Homematic CCU3 mit Cuxd und CUL 868 für FS20, Siemens S7 über CP343-1,
DbLog zu MySQL auf NAS QNAP TS-253D,
Yeelight

Wernieman

- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

kadettilac89

Zitat von: Ajuba am 06 März 2018, 16:53:43
Das wäre sehr nett. Ich denke folgende wären sinnvoll:

  • stat_cpu_percent (Dabei wäre wahrscheinlich die Summe aller Prozesse auch sinnvoll. Den Unterschied zu loadavg verstehe ich noch nicht)

  • eth0_diff (also TX und RX)
  • ram
  • cpu_temp bzw. cpu_temp_avg

Hast du bei der Datenbank auch die Spaltenbreite von Value auf varchar(64) geändert?
Muss ich sonst noch was beachten?

Spaltenbreiten sind default. Sprich, der Check im DBLog bringt keine Fehler.

Ich poste dir mal meine Plot-Files und die Definitionen. Musst halt an deine Bedürfnisse anpassen. Dateien liegen in /opt/fhem/www/plot ... wenn du nicht im Defaultverzeichnis installiert hast dann musst Pfad entsprechend setzen. Pass beim Kopieren auf, dass die Rechte passen (vermutlich Owner = dein fhem-user). Die Definitionen kannst - mit Ausnahmen der 99_myUtils.pm - in der RAW-Definition so eintragen.

Wenn du mein Setup übernehmen willst ist das etwas Aufwand für dich, jedoch findest im Wiki und im Forum genügend Hilfe. Damit du dir etwas vorstellen kannst, oder bewerten kannst ob es den Aufwand lohnt --> Screenshot wie es fertig aussieht auch angehängt.

stat_cpu_percent --> habe ich nicht. Ich habe mir ein Userreading angelegt dass auch CPU Gesamt enthält. Außerdem zeige ich im Plot auch den CPU-Takt an.

Userreading:

attr sysmon userReadings fs_root_percent:stat_cpu_all:stat_cpu_percent.* { CPU_All(ReadingsVal($name,"stat_cpu_percent",0)) }


Berechnung des Readings in 99_myUtils.pm einfügen.

######### CPU Stats All User readings ###########
sub
CPU_All($)
{
  my( $CPU_Percent ) = @_;
  my @array=split(/ /,$CPU_Percent);
  return( $CPU_Percent.' '.round(100-$array[3],2));
}


Definition:

defmod Plot_sysmon_cpu SVG myDbLog:mySM_DB_CPUStat:HISTORY
attr Plot_sysmon_cpu label "CPU: Min $data{min7}, Max $data{max7}, Last $data{currval7}"
attr Plot_sysmon_cpu plotfunction sysmon



eth0_diff

Hier verwende ich Default-Reading für eht0

defmod Plot_sysmon_weth0 SVG myDbLog:mySM_DB_Network:HISTORY
attr Plot_sysmon_weth0 label "Netzwerk-Traffic eth0: $data{min3}, Max: $data{max3}, Aktuell: $data{currval3}"
attr Plot_sysmon_weth0 plotfunction sysmon ethernet_diff

Selbes für Wlan

defmod Plot_sysmon_wlan0 SVG myDbLog:mySM_DB_Network_wlan0:HISTORY
attr Plot_sysmon_wlan0 label "Netzwerk-Traffic wlan0: $data{min3}, Max: $data{max3}, Aktuell: $data{currval3}"
attr Plot_sysmon_wlan0 plotfunction sysmon wlan0_diff



ram

defmod Plot_sysmon_ram SVG myDbLog:mySM_DB_RAM:HISTORY
attr Plot_sysmon_ram label "RAM-Nutzung Total: $data{max1}, Min: $data{min2}, Max: $data{max2}, Aktuell: $data{currval2}"
attr Plot_sysmon_ram plotfunction sysmon



cpu_temp

defmod Plot_sysmon_temp SVG myDbLog:mySM_DB_CPUTemp:HISTORY
attr Plot_sysmon_temp label "CPU Temperatur: Min $data{min2}, Max $data{max2}, Last $data{currval2}"
attr Plot_sysmon_temp plotfunction sysmon


Sebie

#1566
Guten Abend zusammen,
bei mir hat sich irgendwie ein Fehler eingeschlichen, aber ich kann ihn weiß Gott nicht finden.
Ich habe ein doif erstellt, welches mich über einige Sachen meines FHEMs benachrichtig. Das funktioniert super. Jetzt habe ich zum testen ein doif erstellt, welches mir die Temperatur meines Raspberrys senden soll, wenn die Temperatur über 50°C steigt. Allerdings bekomme ich nicht die Temperatur gesendet sondern, mal die fhemuptime oder die cpu2_freq_stat.

Mein Sysmon sieht folgendermaßen aus:
Internals:
   DEF        1 1 1 10
   INTERVAL_BASE 60
   INTERVAL_MULTIPLIERS 1 1 1 10
   MODE       local
   NAME       sys_raspberry
   NR         40
   STATE      Initialized
   TYPE       SYSMON
   READINGS:
     2018-03-07 17:45:09   cpu0_freq       600
     2018-03-07 17:45:09   cpu0_freq_stat  600.00 600.00 600.00
     2018-03-07 17:45:10   cpu0_idle_stat  0.00 104.11 96.72
     2018-03-07 17:45:09   cpu1_freq       600
     2018-03-07 17:45:09   cpu1_freq_stat  600.00 600.00 600.00
     2018-03-07 17:45:10   cpu1_idle_stat  0.00 1623.68 97.74
     2018-03-07 17:45:09   cpu2_freq       600
     2018-03-07 17:45:09   cpu2_freq_stat  600.00 600.00 600.00
     2018-03-07 17:45:10   cpu2_idle_stat  0.00 99.57 97.16
     2018-03-07 17:45:09   cpu3_freq       600
     2018-03-07 17:45:09   cpu3_freq_stat  600.00 600.00 600.00
     2018-03-07 17:45:10   cpu3_idle_stat  -1676.92 775.64 98.22
     2018-03-07 15:37:09   cpu_bogomips    38.40
     2018-03-07 17:45:10   cpu_core_count  4
     2018-03-07 17:45:09   cpu_freq        600
     2018-03-07 17:45:09   cpu_freq_stat   600.00 600.00 600.00
     2018-03-07 17:45:10   cpu_idle_stat   0.16 98.46 97.46
     2018-03-07 15:37:09   cpu_model_name  ARMv7 Processor rev 4 (v7l)
     2018-03-07 17:45:10   cpu_temp        45.08
     2018-03-07 17:45:10   cpu_temp_avg    45.2
     2018-03-07 17:45:10   cpu_temp_stat   0.00 61.22 45.16
     2018-03-07 17:45:10   eth0            RX: 128.16 MB, TX: 102.52 MB, Total: 230.68 MB
     2018-03-07 17:45:10   eth0_diff       RX: 0.26 MB, TX: 0.02 MB, Total: 0.28 MB
     2018-03-07 17:45:10   eth0_ip         192.168.188.27
     2017-11-03 15:30:58   eth0_ip6        fe80::5b82:d599:7d2e:e186/64
     2018-03-07 17:45:10   eth0_rx         134384134
     2018-03-07 17:45:10   eth0_speed      100
     2018-03-07 17:45:10   eth0_tx         107497880
     2018-03-07 17:45:10   fhemstarttime   1520433379
     2018-03-07 17:45:10   fhemstarttime_text 07.03.2018 15:36:19
     2018-03-07 17:45:10   fhemuptime      7730
     2018-03-07 17:45:10   fhemuptime_text 0 days, 02 hours, 08 minutes
     2018-03-07 17:45:10   idletime        7072 91.08 %
     2018-03-07 17:45:10   idletime_text   0 days, 01 hours, 57 minutes (91.08 %)
     2018-03-07 17:45:10   loadavg         0.05 0.07 0.09
     2018-03-07 15:37:09   perl_version    v5.20.2
     2018-03-07 17:45:10   ram             Total: 970.93 MB, Used: 430.18 MB, 44.31 %, Free: 540.75 MB
     2018-03-07 17:45:10   ram_used_stat   255.33 893.34 428.72
     2018-03-07 17:40:10   root            Total: 29830 MB, Used: 7075 MB, 25 %, Available: 21485 MB at /
     2018-03-07 17:45:10   starttime       1520433344
     2018-03-07 17:45:10   starttime_text  07.03.2018 15:35:44
     2018-03-07 17:45:10   stat_cpu        210043 679 45589 2828967 3203 0 1584
     2018-03-07 17:45:10   stat_cpu0       47864 96 11400 707878 922 0 1433
     2018-03-07 17:45:10   stat_cpu0_diff  114 0 32 5819 3 0 2
     2018-03-07 17:45:10   stat_cpu0_percent 1.91 0.00 0.54 97.47 0.05 0.00 0.03
     2018-03-07 17:45:10   stat_cpu0_text  user: 1.91 %, nice: 0.00 %, sys: 0.54 %, idle: 97.47 %, io: 0.05 %, irq: 0.00 %, sirq: 0.03 %
     2018-03-07 17:45:10   stat_cpu1       51697 170 11418 709274 798 0 52
     2018-03-07 17:45:10   stat_cpu1_diff  69 0 40 5879 0 0 0
     2018-03-07 17:45:10   stat_cpu1_percent 1.15 0.00 0.67 98.18 0.00 0.00 0.00
     2018-03-07 17:45:10   stat_cpu1_text  user: 1.15 %, nice: 0.00 %, sys: 0.67 %, idle: 98.18 %, io: 0.00 %, irq: 0.00 %, sirq: 0.00 %
     2018-03-07 17:45:10   stat_cpu2       55476 230 11055 706213 520 0 50
     2018-03-07 17:45:10   stat_cpu2_diff  84 5 53 5845 0 0 0
     2018-03-07 17:45:10   stat_cpu2_percent 1.40 0.08 0.89 97.63 0.00 0.00 0.00
     2018-03-07 17:45:10   stat_cpu2_text  user: 1.40 %, nice: 0.08 %, sys: 0.89 %, idle: 97.63 %, io: 0.00 %, irq: 0.00 %, sirq: 0.00 %
     2018-03-07 17:45:10   stat_cpu3       55006 183 11716 705602 963 0 49
     2018-03-07 17:45:10   stat_cpu3_diff  44 0 64 5866 0 0 0
     2018-03-07 17:45:10   stat_cpu3_percent 0.74 0.00 1.07 98.19 0.00 0.00 0.00
     2018-03-07 17:45:10   stat_cpu3_text  user: 0.74 %, nice: 0.00 %, sys: 1.07 %, idle: 98.19 %, io: 0.00 %, irq: 0.00 %, sirq: 0.00 %
     2018-03-07 17:45:10   stat_cpu_diff   311 5 189 23409 3 0 2
     2018-03-07 17:45:10   stat_cpu_percent 1.30 0.02 0.79 97.87 0.01 0.00 0.01
     2018-03-07 17:45:10   stat_cpu_text   user: 1.30 %, nice: 0.02 %, sys: 0.79 %, idle: 97.87 %, io: 0.01 %, irq: 0.00 %, sirq: 0.01 %
     2018-03-07 17:45:10   swap            Total: 100.00 MB, Used: 0.00 MB,  0.00 %, Free: 100.00 MB
     2018-03-07 17:45:10   swap_used_stat  0.00 100.00 0.01
     2018-03-07 17:45:10   uptime          7765
     2018-03-07 17:45:10   uptime_text     0 days, 02 hours, 09 minutes
     2018-03-07 17:45:10   wlan0           RX: 0.00 MB, TX: 0.00 MB, Total: 0 MB
     2018-03-07 17:45:10   wlan0_diff      RX: 0.00 MB, TX: 0.00 MB, Total: 0.00 MB
     2018-03-07 17:45:10   wlan0_rx        0
     2018-03-07 17:45:10   wlan0_tx        0
   helper:
     net_eth0_stat_class 1
     net_wlan0_stat_class 1
     proc_fs    1
     sys_cpu0_freq 1
     sys_cpu0_temp 0
     sys_cpu1_freq 1
     sys_cpu1_temp 0
     sys_cpu2_freq 1
     sys_cpu2_temp 0
     sys_cpu3_freq 1
     sys_cpu3_temp 0
     sys_cpu4_freq 0
     sys_cpu4_temp 0
     sys_cpu5_freq 0
     sys_cpu5_temp 0
     sys_cpu6_freq 0
     sys_cpu6_temp 0
     sys_cpu7_freq 0
     sys_cpu7_temp 0
     sys_cpu_core_num 4
     sys_cpu_freq_rpi_bbb 1
     sys_cpu_num 1
     sys_cpu_temp_bbb 0
     sys_cpu_temp_rpi 1
     sys_fb     0
     sys_power_ac 0
     sys_power_bat 0
     sys_power_usb 0
     u_first_mark 1
     cur_readings_map:
       cpu0_freq  CPU frequency (core 0)
       cpu0_freq_stat CPU frequency (core 0) stat
       cpu0_idle_stat CPU0 min/max/avg (idle)
       cpu1_freq  CPU frequency (core 1)
       cpu1_freq_stat CPU frequency (core 1) stat
       cpu1_idle_stat CPU1 min/max/avg (idle)
       cpu2_freq  CPU frequency (core 2)
       cpu2_freq_stat CPU frequency (core 2) stat
       cpu2_idle_stat CPU2 min/max/avg (idle)
       cpu3_freq  CPU frequency (core 3)
       cpu3_freq_stat CPU frequency (core 3) stat
       cpu3_idle_stat CPU3 min/max/avg (idle)
       cpu4_idle_stat CPU4 min/max/avg (idle)
       cpu5_idle_stat CPU5 min/max/avg (idle)
       cpu6_idle_stat CPU6 min/max/avg (idle)
       cpu7_idle_stat CPU7 min/max/avg (idle)
       cpu_bogomips BogoMIPS
       cpu_core_count Number of CPU cores
       cpu_freq   CPU frequency
       cpu_freq_stat CPU frequency stat
       cpu_idle_stat CPU min/max/avg (idle)
       cpu_model_name CPU model name
       cpu_temp   CPU temperature
       cpu_temp_avg Average CPU temperature
       cpu_temp_stat CPU temperature stat
       date       Date
       eth0       Network adapter eth0
       eth0_diff  Network adapter eth0 (diff)
       eth0_ip    Network adapter eth0 (IP)
       eth0_ip6   Network adapter eth0 (IP6)
       eth0_rx    Network adapter eth0 (RX)
       eth0_speed Network adapter eth0 (speed)
       eth0_tx    Network adapter eth0 (TX)
       fhemstarttime Fhem start time
       fhemstarttime_text Fhem start time
       fhemuptime System up time
       fhemuptime_text FHEM up time
       idletime   Idle time
       idletime_text Idle time
       io_sda     TEST
       io_sda_diff TEST
       io_sda_raw TEST
       loadavg    Load average
       loadavg_1  Load average 1
       loadavg_15 Load average 15
       loadavg_5  Load average 5
       perl_version Perl Version
       ram        RAM
       ram_free   RAM free
       ram_free_percent RAM free %
       ram_total  RAM total
       ram_used   RAM used
       ram_used_stat RAM used stat
       root       Filesystem /
       starttime  System start time
       starttime_text System start time
       stat_cpu   CPU statistics
       stat_cpu0  CPU0 statistics
       stat_cpu0_diff CPU0 statistics (diff)
       stat_cpu0_percent CPU0 statistics (diff, percent)
       stat_cpu0_text CPU0 statistics (text)
       stat_cpu1  CPU1 statistics
       stat_cpu1_diff CPU1 statistics (diff)
       stat_cpu1_percent CPU1 statistics (diff, percent)
       stat_cpu1_text CPU1 statistics (text)
       stat_cpu2  CPU2 statistics
       stat_cpu2_diff CPU2 statistics (diff)
       stat_cpu2_percent CPU2 statistics (diff, percent)
       stat_cpu2_text CPU2 statistics (text)
       stat_cpu3  CPU3 statistics
       stat_cpu3_diff CPU3 statistics (diff)
       stat_cpu3_percent CPU3 statistics (diff, percent)
       stat_cpu3_text CPU3 statistics (text)
       stat_cpu4  CPU4 statistics
       stat_cpu4_diff CPU4 statistics (diff)
       stat_cpu4_percent CPU4 statistics (diff, percent)
       stat_cpu4_text CPU4 statistics (text)
       stat_cpu5  CPU5 statistics
       stat_cpu5_diff CPU5 statistics (diff)
       stat_cpu5_percent CPU5 statistics (diff, percent)
       stat_cpu5_text CPU5 statistics (text)
       stat_cpu6  CPU6 statistics
       stat_cpu6_diff CPU6 statistics (diff)
       stat_cpu6_percent CPU6 statistics (diff, percent)
       stat_cpu6_text CPU6 statistics (text)
       stat_cpu7  CPU7 statistics
       stat_cpu7_diff CPU7 statistics (diff)
       stat_cpu7_percent CPU7 statistics (diff, percent)
       stat_cpu7_text CPU7 statistics (text)
       stat_cpu_diff CPU statistics (diff)
       stat_cpu_idle_percent CPU statistics idle %
       stat_cpu_io_percent CPU statistics io %
       stat_cpu_irq_percent CPU statistics irq %
       stat_cpu_nice_percent CPU statistics nice %
       stat_cpu_percent CPU statistics (diff, percent)
       stat_cpu_sirq_percent CPU statistics sirq %
       stat_cpu_sys_percent CPU statistics sys %
       stat_cpu_text CPU statistics (text)
       stat_cpu_user_percent CPU statistics user %
       swap       swap
       swap_free  swap free
       swap_total swap total
       swap_used  swap used
       swap_used_percent swap used %
       swap_used_stat swap used stat
       uptime     System up time
       uptime_text System up time
       wlan0      Network adapter wlan0
       wlan0_diff Network adapter wlan0 (diff)
       wlan0_ip   Network adapter wlan0 (IP)
       wlan0_ip6  Network adapter wlan0 (IP6)
       wlan0_rx   Network adapter wlan0 (RX)
       wlan0_speed Network adapter wlan0 (speed)
       wlan0_tx   Network adapter wlan0 (TX)
     excludes:
     shadow_map:
       cpu0_idle_stat 0.00 104.11 96.07
       cpu1_idle_stat 0.00 1623.68 97.22
       cpu2_idle_stat 0.00 99.57 96.69
       cpu3_idle_stat -1676.92 775.64 97.18
       cpu_core_count 4
       cpu_idle_stat 0.16 98.46 96.79
       cpu_temp   45.08
       cpu_temp_avg 45.2
       cpu_temp_stat 0.00 61.22 45.09
       eth0       RX: 124.48 MB, TX: 102.13 MB, Total: 226.61 MB
       eth0_diff  RX: 0.11 MB, TX: 0.02 MB, Total: 0.13 MB
       eth0_ip    192.168.188.27
       eth0_rx    130522670
       eth0_speed 100
       eth0_tx    107092452
       fhemstarttime 1520433379
       fhemstarttime_text 07.03.2018 15:36:19
       fhemuptime 6971
       fhemuptime_text 0 days, 01 hours, 56 minutes
       idletime   6337 90.45 %
       idletime_text 0 days, 01 hours, 45 minutes (90.45 %)
       loadavg    0.22 0.11 0.14
       ram        Total: 970.93 MB, Used: 417.77 MB, 43.03 %, Free: 553.16 MB
       ram_used_stat 255.33 893.34 426.25
       root       Total: 29830 MB, Used: 7075 MB, 25 %, Available: 21485 MB at /
       starttime  1520433344
       starttime_text 07.03.2018 15:35:44
       stat_cpu   204599 638 42939 2535097 3149 0 1535
       stat_cpu0  46055 92 10754 635157 880 0 1390
       stat_cpu0_diff 29 0 29 2049 1 0 1
       stat_cpu0_percent 1.38 0.00 1.38 97.16 0.05 0.00 0.05
       stat_cpu0_text user: 1.38 %, nice: 0.00 %, sys: 1.38 %, idle: 97.16 %, io: 0.05 %, irq: 0.00 %, sirq: 0.05 %
       stat_cpu1  50473 170 10679 635656 793 0 48
       stat_cpu1_diff 13 0 25 2088 0 0 0
       stat_cpu1_percent 0.61 0.00 1.18 98.21 0.00 0.00 0.00
       stat_cpu1_text user: 0.61 %, nice: 0.00 %, sys: 1.18 %, idle: 98.21 %, io: 0.00 %, irq: 0.00 %, sirq: 0.00 %
       stat_cpu2  53951 198 10415 632866 513 0 48
       stat_cpu2_diff 67 0 21 2026 0 0 0
       stat_cpu2_percent 3.17 0.00 0.99 95.84 0.00 0.00 0.00
       stat_cpu2_text user: 3.17 %, nice: 0.00 %, sys: 0.99 %, idle: 95.84 %, io: 0.00 %, irq: 0.00 %, sirq: 0.00 %
       stat_cpu3  54120 178 11091 631418 963 0 49
       stat_cpu3_diff 59 1 30 2029 0 0 0
       stat_cpu3_percent 2.78 0.05 1.42 95.75 0.00 0.00 0.00
       stat_cpu3_text user: 2.78 %, nice: 0.05 %, sys: 1.42 %, idle: 95.75 %, io: 0.00 %, irq: 0.00 %, sirq: 0.00 %
       stat_cpu_diff 168 1 105 8192 1 0 1
       stat_cpu_percent 1.98 0.01 1.24 96.74 0.01 0.00 0.01
       stat_cpu_text user: 1.98 %, nice: 0.01 %, sys: 1.24 %, idle: 96.74 %, io: 0.01 %, irq: 0.00 %, sirq: 0.01 %
       swap       Total: 100.00 MB, Used: 0.00 MB,  0.00 %, Free: 100.00 MB
       swap_used_stat 0.00 100.00 0.01
       uptime     7006
       uptime_text 0 days, 01 hours, 56 minutes
       wlan0      RX: 0.00 MB, TX: 0.00 MB, Total: 0 MB
       wlan0_diff RX: 0.00 MB, TX: 0.00 MB, Total: 0.00 MB
       wlan0_rx   0
       wlan0_tx   0
Attributes:
   alias      Raspberry Pi Server
   group      Dienste
   room       1.1 System


Mein doif sieht so aus:
Internals:
   CFGFN     
   DEF        ([sys_raspberry:cpu_temp] > 44) (set pushmsg msg title=FHEM-Serverwarnung Die aktuelle Temperatur des {(AttrVal("$DEVICE","alias", "$DEVICE"))} liegt bei $EVENT°C)
   NAME       test2
   NR         1295
   NTFY_ORDER 50-test2
   STATE      deactivated
   TYPE       DOIF
   READINGS:
     2018-03-07 17:42:28   mode            deactivated
     2018-03-07 17:42:28   state           deactivated
   Regex:
   condition:
   do:
     0:
   helper:
   uiState:
   uiTable:
Attributes:
   disable    1
   do         always


Das doif spuckt folgende error Nachricht aus:
stat_cpu0_percent: 1.31 0.03 1.24 97.35 0.00 0.00 0.07: Unknown command stat_cpu0_percent:, try help. stat_cpu2: 56935 235 11671 769848 566 0 55: Unknown command stat_cpu2:, try help. stat_cpu: 216791 703 48313 3082195 3290 0 1630: Unknown command stat_cpu:, try help. stat_cpu1_percent: 4.33 0.00 0.78 94.88 0.00 0.00 0.00: Unknown command stat_cpu1_percent:, try help. stat_cpu3_diff: 179 0 62 5748 1 0 0: Unknown command stat_cpu3_diff:, try help. eth0: RX: 131.25 MB: Unknown command eth0:, try help. TX: 102.84 MB: Unknown command TX:, try help. Total: 234.09 MB: Unknown command Total:, try help. eth0_diff: RX: 0.28 MB: Unknown command eth0_diff:, try help. TX: 0.03 MB: Unknown command TX:, try help. Total: 0.31 MB: Unknown command Total:, try help. cpu0_idle_stat: 0.00 104.11 96.94: Unknown command cpu0_idle_stat:, try help. stat_cpu2_diff: 136 0 73 5771 1 0 1: Unknown command stat_cpu2_diff:, try help. stat_cpu_percent: 2.73 0.01 1.07 96.16 0.01 0.00 0.02: Unknown command stat_cpu_percent:, try help. cpu2_idle_stat: 0.00 99.57 97.14: Unknown command cpu2_idle_stat:, try help. idletime: 7705 91.45 %: Unknown command idletime:, try help. cpu_temp: 45.08: Unknown command cpu_temp:, try help. stat_cpu0_text: user: 1.31 %: Unknown command stat_cpu0_text:, try help. nice: 0.03 %: Unknown command nice:, try help. sys: 1.24 %: Unknown command sys:, try help. idle: 97.35 %: Unknown command idle:, try help. io: 0.00 %: Unknown command io:, try help. irq: 0.00 %: Unknown command irq:, try help. sirq: 0.07 %: Unknown command sirq:, try help. stat_cpu3_text: user: 2.99 %: Unknown command stat_cpu3_text:, try help. nice: 0.00 %: Unknown command nice:, try help. sys: 1.04 %: Unknown command sys:, try help. idle: 95.96 %: Unknown command idle:, try help. io: 0.02 %: Unknown command io:, try help. irq: 0.00 %: Unknown command irq:, try help. sirq: 0.00 %: Unknown command sirq:, try help. ram_used_stat: 255.33 893.34 430.67: Unknown command ram_used_stat:, try help. stat_cpu_text: user: 2.73 %: Unknown command stat_cpu_text:, try help. nice: 0.01 %: Unknown command nice:, try help. sys: 1.07 %: Unknown command sys:, try help. idle: 96.16 %: Unknown command idle:, try help. io: 0.01 %: Unknown command io:, try help. irq: 0.00 %: Unknown command irq:, try help. sirq: 0.02 %: Unknown command sirq:, try help. cpu_temp_avg: 45.2: Unknown command cpu_temp_avg:, try help. swap: Total: 100.00 MB: Unknown command swap:, try help. Used: 0.00 MB: Unknown command Used:, try help. 0.00 %: Unknown command 0.00, try help. Free: 100.00 MB: Unknown command Free:, try help. uptime: 8425: Unknown command uptime:, try help. wlan0_diff: RX: 0.00 MB: Unknown command wlan0_diff:, try help. TX: 0.00 MB: Unknown command TX:, try help. Total: 0.00 MB: Unknown command Total:, try help. starttime_text: 07.03.2018 15:35:44: Unknown command starttime_text:, try help. stat_cpu0_diff: 78 2 74 5804 0 0 4: Unknown command stat_cpu0_diff:, try help. fhemstarttime_text: 07.03.2018 15:36:19: Unknown command fhemstarttime_text:, try help. cpu_idle_stat: 0.16 98.46 96.95: Unknown command cpu_idle_stat:, try help. stat_cpu0: 49496 102 12177 770889 951 0 1469: Unknown command stat_cpu0:, try help. stat_cpu2_text: user: 2.27 %: Unknown command stat_cpu2_text:, try help. nice: 0.00 %: Unknown command nice:, try help. sys: 1.22 %: Unknown command sys:, try help. idle: 96.47 %: Unknown command idle:, try help. io: 0.02 %: Unknown command io:, try help. irq: 0.00 %: Unknown command irq:, try help. sirq: 0.02 %: Unknown command sirq:, try help. fhemuptime_text: 0 days: Unknown command fhemuptime_text:, try help. 02 hours: Unknown command 02, try help. 19 minutes: Unknown command 19, try help. cpu_core_count: 4: Unknown command cpu_core_count:, try help. stat_cpu_diff: 653 2 256 23016 2 0 5: Unknown command stat_cpu_diff:, try help. eth0_ip: 192.168.188.27: Unknown command eth0_ip:, try help. eth0_tx: 107833164: Unknown command eth0_tx:, try help. cpu_temp_stat: 0.00 61.22 45.16: Unknown command cpu_temp_stat:, try help. stat_cpu1: 53600 170 11958 772671 799 0 53: Unknown command stat_cpu1:, try help. stat_cpu3: 56760 196 12507 768787 974 0 53: Unknown command stat_cpu3:, try help. stat_cpu2_percent: 2.27 0.00 1.22 96.47 0.02 0.00 0.02: Unknown command stat_cpu2_percent:, try help. fhemuptime: 8390: Unknown command fhemuptime:, try help. eth0_speed: 100: Unknown command eth0_speed:, try help. fhemstarttime: 1520433379: Unknown command fhemstarttime:, try help. wlan0_rx: 0: Unknown command wlan0_rx:, try help. ram: Total: 970.93 MB: Unknown command ram:, try help. Used: 435.12 MB: Unknown command Used:, try help. 44.82 %: Unknown command 44.82, try help. Free: 535.80 MB: Unknown command Free:, try help. cpu3_idle_stat: -1676.92 775.64 96.57: Unknown command cpu3_idle_stat:, try help. wlan0_tx: 0: Unknown command wlan0_tx:, try help. idletime_text: 0 days: Unknown command idletime_text:, try help. 02 hours: Unknown command 02, try help. 08 minutes (91.45 %): Unknown command 08, try help. uptime_text: 0 days: Unknown command uptime_text:, try help. 02 hours: Unknown command 02, try help. 20 minutes: Unknown command 20, try help. cpu1_idle_stat: 0.00 1623.68 97.14: Unknown command cpu1_idle_stat:, try help. swap_used_stat: 0.00 100.00 0.01: Unknown command swap_used_stat:, try help. stat_cpu1_text: user: 4.33 %: Unknown command stat_cpu1_text:, try help. nice: 0.00 %: Unknown command nice:, try help. sys: 0.78 %: Unknown command sys:, try help. idle: 94.88 %: Unknown command idle:, try help. io: 0.00 %: Unknown command io:, try help. irq: 0.00 %: Unknown command irq:, try help. sirq: 0.00 %: Unknown command sirq:, try help. eth0_rx: 137620852: Unknown command eth0_rx:, try help. starttime: 1520433344: Unknown command starttime:, try help. loadavg: 0.21 0.16 0.13: Unknown command loadavg:, try help. stat_cpu3_percent: 2.99 0.00 1.04 95.96 0.02 0.00 0.00: Unknown command stat_cpu3_percent:, try help. wlan0: RX: 0.00 MB: Unknown command wlan0:, try help. TX: 0.00 MB: Unknown command TX:, try help. Total: 0 MB°C: Unknown command Total:, try help.

Kann sich jemand den Fehler erklären?

kadettilac89

Zitat von: Sebie am 07 März 2018, 17:46:45
Kann sich jemand den Fehler erklären?

https://forum.fhem.de/index.php/topic,31680.msg241873.html#msg241873

$EVENT ist für notify und ist in DOIF nicht bekannt. Darum hast du hier irgend welche Werte aber nicht die, die du erwartest.

Baue entweder auf notfiy mit IF um, oder nutze den Wert aus DOIF. Syntax müsstest nachlesen, ich nutze keine DOIF

Sebie

Danke für den Tipp.
Es wundert mich nur. Denn in meinem eigentlichen "Benachrichtigungs-DOIF", habe ich einen Eintrag:
## Leuchtmittel nicht erreichbar
DOELSEIF (["^HUEDevice:reachable"]) (set pushmsg msg Das Leutmittel $DEVICE ist $EVENT)

der hervorragend funktioniert und das commandref gibt ebenfalls folgendes Beispiel an:
Anwendungsbeispiele:

Loggen aller Ereignisse in FHEM

define di_all_events DOIF ([""]) ({Log 3,"Events from device $DEVICE:$EVENTS"})

attr di_all_events do always


Naja, wie auch immer, dann suche ich mir zum eintragen des Werts eben einen anderen weg.

Vielen Dank für die Hilfe!

kadettilac89

ok, vielleicht hab ich dann was falsches reportet, möglicherweiße war es dann früher so.

ist jetzt nicht wirklich ein problem es modules hier sondern ein thema für doif. schlage dir vor, das thema bzw. problem in das anfängerforum oder automatisierung/doif zu posten.

kadettilac89

aus Interesse habe ich mal das getestet. Doif hat bei mir selbes Verhalten. Im Eventmonitor werden bei mir neben der Temperatur auch noch andere Events in sysmon geworfen. Scheinbar greift sich hier das DOIF das erste, deckt sich bei mir mit dem gesendetem EVENT-Wert.

Habe es zum Test mit einem Notify gebaut, wollte sehen ob es damit problemlos funktioniert ...

Wenn du es brauchen kannst, hier die DEF. Musst halt die Devicenamen und Befehlt etwas anpassen.


defmod sysmon_notify_1 notify sysmon:cpu_temp:..* { if ($EVTPART1 >= 40)\
  { \
  my $ANAME = AttrVal($NAME,"alias",$NAME);; \
  fhem('set pushover msg title=FHEM-Serverwarnung: Die aktuelle Temperatur '.$ANAME.' liegt bei '.$EVTPART1.'  °C') }\
}

Sebie

@kadettilac89

Danke für den Tipp und das du dir die Mühe gemacht hast, es selbst nachzuvollziehen.
Ich gebe das ganze nochmal in den DOIF-Bereich, denn irgendwas ist da merkwürdig. Ich habe noch ein zweites Raspberry, von dem ich auch per Sysmon die werte abfragen möchte. Um nicht für bei Raspis einzelne abfragen schreiben zu müssen, möchte ich eigentlich so abfragen:
(["^sys_:^cpu_temp$"] > 40) (set pushmsg msg Die aktuelle Temperatur des liegt bei °C)

Damit wird nach jedem device gesucht, welches als Reading genau cpu_temp beinhaltet. Quasi genauso, wie ich es auch schon mit der Erreichbarkeit meiner Hue Leuchtmittel mache. Allerdings, erkennt das doif, das sich da etwas getan hat, feuert aber nicht weiter.  >:(

kadettilac89

Zitat von: Sebie am 07 März 2018, 20:28:38
Damit wird nach jedem device gesucht, welches als Reading genau cpu_temp beinhaltet. Quasi genauso, wie ich es auch schon mit der Erreichbarkeit meiner Hue Leuchtmittel mache.

ist OT, kann notify auch. Suchbegriff regex.


.*:[Bb]attery:.*

--> Beispiel reagiert auf alle Readings die genau Battery heißen, sowohl upper und lower-case. Egal in welchem Device.

Aber mach einen Post im DOIF-Bereich. Entweder es ist die Doku unvollständig, oder ein Fehler. Vermeidet, dass andere das selbe Problem haben.

Ajuba

Herzlichen Dank an kadettilac89
Deine Definitionen und da speziell das Attribut "plotfunction" waren der Schlüssel zum Erfolg.
Als DbLog und Plotanfänger war ich mir der essentiellen Bedeutung nicht bewusst, dass damit ja Device und Reading übergeben werden.  ::)

Eine Stunde Ratlosigkeit über fehlende Ethernet-Plots hat mir der feine Unterschied gekostet, dass du "plotfunction sysmon ethernet_diff" verwendest wo jedoch bei mir das sysmon Standard Reading "eth0_diff" heißt.
attr Plot_sysmon_weth0 plotfunction sysmon ethernet_diff
attr wl_sysmon_eth0DB plotfunction sysmon eth0_diff

Ich schreibe das hier nicht, um mich zu beschweren oder meine Blödheit zu dokumentieren sondern um vielleicht anderen helfen zu können.

Zusammenfassung:
Meiner Meinung nach muss man beim DbLog für SYSMON entgegen der mit Fhem mitgelieferten Standard mySQL Datenbankkonfiguration VALUE sehr wohl mit der Breite 64 und nicht 32 definieren.
CREATE TABLE `fhem`.`history` (TIMESTAMP TIMESTAMP, DEVICE varchar(32), TYPE varchar(32), EVENT varchar(512), READING varchar(32), VALUE varchar(64), UNIT varchar(32));
CREATE TABLE `fhem`.`current` (TIMESTAMP TIMESTAMP, DEVICE varchar(32), TYPE varchar(32), EVENT varchar(512), READING varchar(32), VALUE varchar(64), UNIT varchar(32));

Als Beispiel das SYSMON Reading eth0_diff bei dem der Total-Wert bei einer Breite von 32 abgeschnitten wäre:
RX: 0.45 MB, TX: 0.51 MB, Total: 0.96 MB

Die mit Fhem gelieferten Standard sysmon DB Gplot Files sind in Ordnung. Es kommt nur auf den den richtigen Aufruf an mit den richtigen Parametern an.

define wl_sysmon_eth0DB SVG myDbLog:SM_DB_Network_eth0:HISTORY
attr wl_sysmon_eth0DB label "Netzwerk-Traffic eth0: $data{min3}, Max: $data{max3}, Aktuell: $data{currval3}"
attr wl_sysmon_eth0DB plotfunction sysmon eth0_diff

myDbLog..........................Name des eigenen DbLog Devices
SM_DB_Network_eth0.....Dateiname der aufgerufenen Gplot Datei
sysmon............................Name des eigenen sysmon Devices
eth0_diff..........................Name des eigenen sysmon Readings
HISTORY...........................Name der eigenen DbLog Tabelle.
ACHTUNG: Hier soll man nicht CURRENT sondern HISTORY wählen da sonst folgende Fehlermeldung im Logfile kommt :
2018.03.07 20:27:59 3: Defining DbLog SVG-Plots with :CURRENT is deprecated. Please define DbLog SVG-Plots with :HISTORY instead of :CURRENT. (define <mySVG> SVG <DbLogDev>:<gplotfile>:HISTORY)

Übrigens, seit ich SYSMON komplett auf DbLog umgestellt habe kommen nach Logging-Diagramm Auswertungen auch keine Perfmon Beschwerden mehr und freezing kann ich momentan ebenso keines feststellen.  :)

@Hexenmeister: Vielleicht willst du in deine perfekte CommandRef evt. zumindest um 1 DbLog Beispiel ergänzen um nicht so Erfahrenen das Leben zu erleichtern.

Danke and Hexenmeister und kadettilac für die Hilfe
FHEM auf RPi3, Homematic CCU3 mit Cuxd und CUL 868 für FS20, Siemens S7 über CP343-1,
DbLog zu MySQL auf NAS QNAP TS-253D,
Yeelight

kadettilac89

#1574
Zitat von: Ajuba am 07 März 2018, 21:15:52
ethernet_diff" verwendest wo jedoch bei mir das sysmon Standard Reading "eth0_diff" heißt.
bei mir heißt das Reading im Default so. Vielleicht abhängig von verwendeter Hardware, oder weil ich sysmon schon lange im Einsatz habe.

Zitat von: Ajuba am 07 März 2018, 21:15:52
Zusammenfassung:
Meiner Meinung nach muss man beim DbLog für SYSMON entgegen der mit Fhem mitgelieferten Standard mySQL Datenbankkonfiguration VALUE sehr wohl mit der Breite 64 und nicht 32 definieren.
CREATE TABLE `fhem`.`history` (TIMESTAMP TIMESTAMP, DEVICE varchar(32), TYPE varchar(32), EVENT varchar(512), READING varchar(32), VALUE varchar(64), UNIT varchar(32));
CREATE TABLE `fhem`.`current` (TIMESTAMP TIMESTAMP, DEVICE varchar(32), TYPE varchar(32), EVENT varchar(512), READING varchar(32), VALUE varchar(64), UNIT varchar(32));

Als Beispiel das SYSMON Reading eth0_diff bei dem der Total-Wert bei einer Breite von 32 abgeschnitten wäre:
RX: 0.45 MB, TX: 0.51 MB, Total: 0.96 MB

Das ist nicht das aktuelle Script

richtig ... https://github.com/mhop/fhem-mirror/blob/master/fhem/contrib/dblog/db_create_mysql.sql

CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'fhemuser'@'%' IDENTIFIED BY 'fhempassword';
CREATE TABLE `fhem`.`history` (TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, DEVICE varchar(64), TYPE varchar(64), EVENT varchar(512), READING varchar(64), VALUE varchar(128), UNIT varchar(32));
CREATE TABLE `fhem`.`current` (TIMESTAMP TIMESTAMP, DEVICE varchar(64), TYPE varchar(64), EVENT varchar(512), READING varchar(64), VALUE varchar(128), UNIT varchar(32));
GRANT SELECT, INSERT, DELETE, UPDATE ON `fhem`.* TO 'fhemuser'@'%';
CREATE INDEX Search_Idx ON `fhem`.`history` (DEVICE, READING, TIMESTAMP);

--> führe am besten mal im DBLog "set <name des dblog> configCheck" aus. Vielleicht ist noch was anderes nicht wie erwartet.

Edit:

Nachtrag ...
Zitat von: Ajuba am 07 März 2018, 21:15:52
define wl_sysmon_eth0DB SVG myDbLog:SM_DB_Network_eth0:HISTORY
attr wl_sysmon_eth0DB label "Netzwerk-Traffic eth0: $data{min3}, Max: $data{max3}, Aktuell: $data{currval3}"
attr wl_sysmon_eth0DB plotfunction sysmon eth0_diff

myDbLog..........................Name des eigenen DbLog Devices
SM_DB_Network_eth0.....Dateiname der aufgerufenen Gplot Datei
sysmon............................Name des eigenen sysmon Devices
eth0_diff..........................Name des eigenen sysmon Readings
HISTORY...........................Name der eigenen DbLog Tabelle.

bitte schau dir hier die Doku an, da sollte das auch erklärt sein ... plotfunction ist ein Attribut, das erlaubt Variablen in die Plotdefinition zu geben.

#DbLog <SPEC1>:<SPEC2>:::$val=~s/^RX..([\d.]*).*/$1/eg

Wert 1 (sysmon) in plotfunction wird in der Plotfunktion zu <SPEC1>, Wert2 (eth0_diff) zu <SPEC2>. Du könntest in der Plotdefinition genau so schreiben ....
#DbLog sysmon:eth0_diff:::$val ...

Ich habe mit Variablen gearbeitet damit ich nur ein Plot für alle Netzwerkmodule verwenden kann. Für einfache Plots kannst du auch den integrieten Ploteditor verwenden, dann musst du keine Dateien anlegen. Macht dann Fhem selbst.