Nacht

Bei der Suche nach einer Möglichkeit, die Parameter des Wirtsystems des FHEM-Servers zu überwachen, bin ich auf den SYSSAT-Modul und die RPiUtils-Bibliothek gestossen.

Sysstat liefert die Systemauslastung, mit RPiUtils können viele andere Werte erfasst werden. Allerdings ist dafür ein zimliches Gewusel von Dummy-Devices und AT-Befehle notwendig.

 

# --- RPi
define RPiValues weblink htmlCode {ShowRPiValues()}
attr RPiValues group RPi
attr RPiValues room 9.03_Tech
#
# --- Temp loggen
define RPiTemp dummy
attr RPiTemp comment RPi: CPU Temperatur
attr RPiTemp group RPi
attr RPiTemp room 9.03_Tech
define FileLog_RPiTemp FileLog ./log/rpi_temp-%Y-%m.log RPiTemp
attr FileLog_RPiTemp group RPi
attr FileLog_RPiTemp logtype temp4:Plot,text
attr FileLog_RPiTemp room 9.03_Tech
define C:AT.RPiTemp at +*00:05 { fhem("set RPiTemp ".RPiTemp(" ")) }
attr C:AT.RPiTemp group RPi
attr C:AT.RPiTemp room 9.03_Tech
define wl_RPiTemp SVG FileLog_RPiTemp:temp4:CURRENT
attr wl_RPiTemp group RPi
attr wl_RPiTemp label "Raspberry Pi Temperatur: Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr wl_RPiTemp room 9.03_Tech
#
# --- RAM loggen:
define RPiRam dummy
attr RPiRam comment RPi: RAM
attr RPiRam group RPi
attr RPiRam room 9.03_Tech
define FileLog_RPiRam FileLog ./log/rpi_ram-%Y-%m.log RPiRam
attr FileLog_RPiRam group RPi
attr FileLog_RPiRam logtype text
attr FileLog_RPiRam room 9.03_Tech
define C:AT.RPiRam at +*00:05 { fhem("set RPiRam ".RPiRamSwap("R")) }
attr C:AT.RPiRam group RPi
attr C:AT.RPiRam room 9.03_Tech
#
# --- SWAP loggen:
define RPiSwap dummy
attr RPiSwap comment RPi: Swap
attr RPiSwap group RPi
attr RPiSwap room 9.03_Tech
define FileLog_RPiSwap FileLog ./log/rpi_swap-%Y-%m.log RPiSwap
attr FileLog_RPiSwap group RPi
attr FileLog_RPiSwap logtype text
attr FileLog_RPiSwap room 9.03_Tech
define C:AT.RPiSwap at +*00:10 { fhem("set RPiSwap ".RPiRamSwap("S")) }
attr C:AT.RPiSwap group RPi
attr C:AT.RPiSwap room 9.03_Tech
#
# --- Filesystemspeicher loggen:
define RPiFS dummy
attr RPiFS comment RPi: Filesystem
attr RPiFS event-on-change-reading state
attr RPiFS group RPi
attr RPiFS room 9.03_Tech
define FileLog_RPiFS FileLog ./log/rpi_fs-%Y-%m.log RPiFS
attr FileLog_RPiFS group RPi
attr FileLog_RPiFS logtype text
attr FileLog_RPiFS room 9.03_Tech
define C:AT.RPiFS at +*01:00 { fhem("set RPiFS ".RPiFileSystem("","/")) }
attr C:AT.RPiFS group RPi
attr C:AT.RPiFS room 9.03_Tech
#
# --- Netzwerktraffik loggen:
define RPiLAN dummy
attr RPiLAN comment RPi: LAN Eth0
attr RPiLAN group RPi
attr RPiLAN room 9.03_Tech
define FileLog_RPiLAN FileLog ./log/rpi_lan-%Y-%m.log RPiLAN
attr FileLog_RPiLAN group RPi
attr FileLog_RPiLAN logtype text
attr FileLog_RPiLAN room 9.03_Tech
define C:AT.RPiLAN at +*00:10 { fhem("set RPiLAN ".RPiNetwork("", "eth0")) }
attr C:AT.RPiLAN group RPi
attr C:AT.RPiLAN room 9.03_Tech
#
# --- Sysstat (CPU load, diskusage)
define RPiStat SYSSTAT 60 600
attr RPiStat comment RPi: CPU load
attr RPiStat group RPi
attr RPiStat room 9.03_Tech
define FileLog_RPiStat FileLog ./log/rpi_sysstat-%Y-%m.log RPiStat
attr FileLog_RPiStat group RPi
attr FileLog_RPiStat logtype sysstat:Plot,text
attr FileLog_RPiStat nrarchive 1
attr FileLog_RPiStat room 9.03_Tech
define wl_RPiStat SVG FileLog_RPiStat:sysstat:CURRENT
attr wl_RPiStat group RPi
attr wl_RPiStat label "Load Min: $data{min1}, Max: $data{max1}, Aktuell: $data{currval1}"
attr wl_RPiStat room 9.03_Tech

 

 .

Kommentare (2)

Cancel or

  • Thomas Wenzlaff
    Ok, habe die 99_RPiUtils.pm gefunden!
  • Thomas Wenzlaff
    Hi,
    es fehlt noch die subroutine:

    RPiValues
    Undefined subroutine &main::ShowRPiValues called at (eval 159) line 1.