Monitor memory usage

From Domoticz
Jump to: navigation, search


Logging memory usage of a process running on your raspberry pi

Dependencies - hardware / software / operating system

Running on linux variants like the default Raspberry Pi image

Domoticz Setup - switches, variables, version

Create a virtual sensor

1. Create dummy device in the Setup/Hardware panel

2. Create virtual 'Percentage' device (using 'Create Virtual Sensors'

3. Note the IDX in the Setup/Devices screen

Installation instructions

Login using SSH

Stay in the /home/pi directory

create a script: "nano"

change to executable "chmod +x"

add the script to crontab using "crontab -e", add a line like this:

*/10 * * * * /home/pi/

this will execute the script every 10 minutes

Script with comments

#Retrieve memory usage of the system in percentage
MEMUSG=`free -m|grep "Mem"|awk '{print $3/($4+$3) * 100}'`
#save memory usage to domoticz, replace with you IP, Portnumber and IDX

Example of use (if relevant) i.e. output files / screen displays

Check the device in the utility tab