-
Notifications
You must be signed in to change notification settings - Fork 15
Sensors
PyMonitorMQTT has a lot of sensors that you can choose to enable/disable or pass options to.
Each sensor must be placed in the 'sensors' list in the configuration.yaml file:
sensors:
- Ram
- Disk
- Cpu
To pass options to a Sensor, follow this example:
I want to set a custom_topic for the Screenshot sensor to receive the screen picture to a specific topic (test_topic/myphoto):
sensors:
- Cpu
- Screenshot:
custom_topics:
- test_topic/myphoto
- Disk
- Ram
As you can see you must place ':' after the sensor name and in the next line write (as dict) the option name followed by ':' and the value.
You can find the possible options for sensors and commands in the appropriate page
- Sensor name: Battery
- Optional options:
- formatted_values
- Mandatory options: None
- Compatibility: Windows, macOS, Linux
- Description: This sensor sends information about battery. It should only be used on laptop computers.
- Default topics:
-
monitor/ClientName/battery/battery_level_percentageSend battery level percentage (0-100) [%]
-
monitor/ClientName/battery/battery_chargingSend True if battery is charging, else send False
-
- Sensor name: Brightness
- Optional options:
- formatted_values
- Mandatory options: None
- Compatibility: Windows, macOS
- Description: This sensor sends screen brightness percentage . It should only be used with brightness controllable displays.
- Default topic:
monitor/ClientName/brightness/get(0-100) [%]
- Sensor name: Cpu
- Optional options:
- formatted_values
- advanced_information
- Mandatory options: None
- Compatibility: Windows, macOS*, Linux
- Description: This sensor sends information about CPU.
- Default topics:
-
monitor/ClientName/cpu/cpu_used_percentageSend the current system-wide CPU utilization as a percentage
-
monitor/ClientName/cpu/cpu_countSend the number of logical CPUs in the system
-
monitor/ClientName/cpu/cpu_times/user- AdvancedSend time spent by normal processes executing in user mode; on Linux this also includes guest time
-
monitor/ClientName/cpu/cpu_times/system- AdvancedSend time spent by processes executing in kernel mode
-
monitor/ClientName/cpu/cpu_times/idle- AdvancedSend time spent doing nothing
-
monitor/ClientName/cpu/cpu_stats/ctx_switches- AdvancedSend number of context switches (voluntary + involuntary) since boot
-
monitor/ClientName/cpu/cpu_stats/interrupts- AdvancedSend number of interrupts since boot
-
monitor/ClientName/cpu/cpu_freq/min- AdvancedSend minimum CPU frequency
-
monitor/ClientName/cpu/cpu_freq/max- AdvancedSend maximum CPU frequency
-
monitor/ClientName/cpu/cpu_freq/current- AdvancedSend current CPU frequency
-
monitor/ClientName/cpu/cpu_avg_load/1minute- Advanced*Send the average system load over the last minute
-
monitor/ClientName/cpu/cpu_avg_load/5minutes- Advanced*Send the average system load over the last 5 minutes
-
monitor/ClientName/cpu/cpu_avg_load/15minutes- Advanced*Send the average system load over the last 15 minutes
-
* Cpu load data not available for macOS
Information from psutil ReadTheDocs
- Sensor name: CpuTemperatures
- Optional options: None
- Mandatory options: None
- Compatibility: Windows, Linux
- Description: This sensor sends
- on Linux a list of CPU temperatures (one for core)
- on Window a single CPU temperatures. It needs
- an external software named 'Open Hardware Monitor' that must be running when PyMonitorMQTT is ON. Download it
- a pip module named 'wmi'. Install it with
python3 -m pip install wmi
- Default topic:
monitor/ClientName/cpu/temperatures(float or list) [°C]
- Sensor name: DesktopEnvironment
- Optional options:
- contents: must be dict that contains a 'value' key. It's used to force the Monitor to use that value
- Mandatory options: None
- Compatibility: Windows, macOS, Linux
- Description: This sensor sends the name of the desktop environment running; will return 'base' on Windows and macOS. Must be used if there are specific commands running to permit them to run the proper action on your system (check them in Commands page).
- Default topic:
monitor/ClientName/desktop_environment
- Sensor name: Disk
- Optional options:
- formatted_values
- Mandatory options: None
- Compatibility: Windows, macOS, Linux
- Description: This sensor sends the percentage of disk used. Currently it only scans the boot disk, but will be improved with more volumes possibility.
- Default topic:
monitor/ClientName/disk_used_percentage
- Sensor name: Network
- Optional options:
- formatted_values
- Mandatory options: None
- Compatibility: Windows, macOS, Linux
- Description: This sensor sends the amount of bytes transmitted on the network, both received and sent.
- Default topics:
-
monitor/ClientName/network/bytes_recvSend the received bytes amount
-
monitor/ClientName/network/bytes_sentSend the sent bytes amount
-
- Sensor name: Os
- Optional options: None
- Mandatory options: None
- Compatibility: Windows, macOS, Linux
- Description: This sensor sends the current operating system.
- Data: possibilities are:
- "Windows"
- "Linux"
- "macOS"
- Default topic:
monitor/ClientName/operating_system
- Sensor name: Ram
- Optional options:
- formatted_values
- advanced_information
- Mandatory options: None
- Compatibility: Windows, macOS, Linux
- Description: This sensor sends information about RAM. All the memory values are represented in bytes.
- Default topics:
-
monitor/ClientName/ram/physical_memory/percentageSend percentage of used memory
-
monitor/ClientName/ram/swap_memory/percentageSend percentage of used swap memory
-
monitor/ClientName/ram/physical_memory/total- AdvancedSend total physical memory
-
monitor/ClientName/ram/physical_memory/available- AdvancedSend the memory that can be given instantly to processes without the system going into swap
-
monitor/ClientName/ram/physical_memory/free- AdvancedSend the memory that isn't being used at all (zeroed) that is readily available
-
monitor/ClientName/ram/physical_memory/used- AdvancedSend used memory
-
monitor/ClientName/ram/swap_memory/total- AdvancedSend total swap memory
-
monitor/ClientName/ram/swap_memory/used- AdvancedSend used swap memory
-
monitor/ClientName/ram/swap_memory/free- AdvancedSend free swap memory
-
Information from psutil ReadTheDocs
- Sensor name: Screenshot
- Optional options: None
- Mandatory options: None
- Compatibility
- Windows, Linux
- macOS: to enable screen capture you have to
- Run the script with the Screenshot sensor enabled
- You will receive a privacy message. Now close the script
- Open computer system's settings, then enter into Security and finally into Privacy
- Open the lock on the bottom-left corner of the settings window
- Scroll until you find "Screen recording" permission
- In the list of apps with permission you'll find Python: ensure that the checkbox is checked
- Close settings and start the script
- Description: This sensor sends a picture of the screen.
- Policy: Who is using the computer must know he's being recorded !
- Default topic:
monitor/ClientName/screenshot
- Sensor name: Time
- Optional options: None
- Mandatory options: None
- Compatibility: Windows, macOS, Linux
- Description: This sensor sends the current time when the message is sent
- Default topic:
monitor/ClientName/message_time