About This File
The purpose of this scene is to monitor CPU and RAM performances. In case the performance decreased it will notify the user before the system becomes unresponsive and/or stuck. During introduction of last few releases many users have an issue with CPU overloaded and system stuck, so the idea is to catch and try to solve the problem before the system doesn't respond.
The program execution has two options:
1. Stand alone using local json table
2. Using global variable for json table
Using second option you can acces to current min, max, average values of CPU and current RAM load from any other sense or virtual device.
--================= User configurable parameters ============================
gVarName = "" ---------------------- Global Predefined Variable name.
eMail = true -------------------- send eMail notification to admin only
pushNote = true -------------------- send push notification to users in push list
popupNote = true -------------------- send popup notification to all mobiles
sleepTime = 60 ---------------------- time between samples in seconds.
batchNum = 2 ----------------------- batches/readings number per sample.
batchDelay = 10 ---------------------- time between batches in seconds.
ramHi = 75 ---------------------- RAM high limit.
highLim1 = 50; highLim2 = 50 ---- CPU 1,2 highest load limit.
normLim1 = 20; normLim2 = 20 ---- CPU 1,2 normal load limit.
sample2avg1 = 20; sample2avg2 = 20 ---- CPU 1,2 number of samples to average.
--============================================================================
How it works?: (based on default values of user configurable parameters)
The program checks if any global variable defined, if not local table in use.
Every 60 seconds (sleepTime) the program will get two readings (batchNum) within 10 seconds (batchDelay) of CPU 1 and 2 load.
After 20 samples (sample2avg1/sample2avg2) average load of each CPU and RAM is calculating and in case the CPU load is over 50% (highLim1/highLim2) and/or RAM is higher than 75% (ramHi) notification will be send out by eMail, push notification and popup mobile notification. Please note that popup notification will be received by all mobiles in list of the system. If after overload the CPU average load drops below 20% (normLim1/normLim2) and/or RAM drops below 75%, user will be notified as well.
Change default values according to your needs, but please pay attention if you reduce the sleepTime and number of samples (sample2avg1/sample2avg2) , the scene could catch momentary peak of load which is not necessarily represents system performances.
What's New in Version 1.1 See changelog
Released
Resolved Issues
- Global variable definition cause crash. Error:
[DEBUG] 17:18:29: [1;31m2018-11-26 17:18:29.381186 [ fatal] Unknown exception: /usr/share/lua/5.2/json/decode/util.lua:35: unexpected character @ character: 1 0:1 [V] line:
[DEBUG] 17:18:29: V