Announcement

Collapse
No announcement yet.

Zee Script to monitor CPU performance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Zee Script to monitor CPU performance

    The following script can be used to track the CPU averages of your Zee.
    It uses the linux uptime command which returns 3 load averages at 1m, 5m and 15m. Since it is an average, it provides a pretty decent mechanism for tracking the CPU performance.

    Save the following script as ZeeCPU.vb
    Setup a recurring event to run from the top of the hour, every 15 mins.

    I'd be curious to see your results.

    PHP Code:
    Sub Main(parm as object)

    dim proc as System.Diagnostics.Process
    dim resp
    ,as String
    dim ary
    () as String
    dim i 
    as Integer
    dim sw 
    as System.IO.StreamWriter

    Try
         
    proc = new System.Diagnostics.Process()
         
    proc.StartInfo.FileName="/usr/bin/uptime"
         
    proc.StartInfo.UseShellExecute=False
         proc
    .StartInfo.RedirectStandardOutput True
         proc
    .Start()
         
    resp=proc.StandardOutput.ReadToEnd()

         
    ary resp.Split(New Char() {","c})

         If(
    UBound(ary)>=4then
              sw 
    = new     System.IO.StreamWriter("/usr/local/HomeSeer/Data/ZeeCPUPerformance.txt",True)
              
    sw.Write(Now() & "," ary(4))
         
    End If

    Catch 
    ex as Exception
         hs
    .writeLog("Exception",ex.message)
    Finally
         If(
    not sw Is Nothingthen
              sw
    .Close()
         
    End If
    End Try

    End Sub 
    You can open the file and view the log file using WinSCP or PuTTY.
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    #2
    Thank-you Rob!

    Working well.

    Apr-23 2:56:09 PM ZeeCPU 4/23/2014 2:56:09 PM,CPU Load 0.31
    Apr-23 2:55:09 PM ZeeCPU 4/23/2014 2:55:09 PM,CPU Load 0.38
    Apr-23 2:54:09 PM ZeeCPU 4/23/2014 2:54:09 PM,CPU Load 0.46
    Apr-23 2:53:09 PM ZeeCPU 4/23/2014 2:53:09 PM,CPU Load 0.49
    Apr-23 2:52:09 PM ZeeCPU 4/23/2014 2:52:09 PM,CPU Load 0.54
    Apr-23 2:51:09 PM ZeeCPU 4/23/2014 2:51:09 PM,CPU Load 0.61
    Apr-23 2:50:29 PM ZeeCPU 4/23/2014 2:50:29 PM,CPU Load 0.66
    Found another interesting application.

    Code:
    root@ICS-HS3-Zee:/usr/bin# mpstat
    Linux 3.10.25+ (ICS-HS3-Zee)    23/04/14        _armv6l_        (1 CPU)
    
    15:00:31     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %idle
    15:00:31     all   11.39    0.00    1.20    0.13    0.01    0.02    0.00    0.00    87.25
    root@ICS-HS3-Zee:/usr/bin#
    Last edited by Pete; April 23, 2014, 02:49 PM.
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
    HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

    HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

    Comment

    Working...
    X