Hi there,
I wonder if it is possible to monitor running Python scripts.
I saw that with system monitor you can monitor processes but that’s not enough for me:-)
.
Hi there,
I wonder if it is possible to monitor running Python scripts.
I saw that with system monitor you can monitor processes but that’s not enough for me:-)
.
You can do it with a command line sensor. I monitor services with this, but you can adjust the command to detect ordinary processes
- platform: command_line
name: "appdaemon status"
command: systemctl show appdaemon@$USER.service | awk -F= '/^SubState=/ {print $2}'
scan_interval: 60
This is a good idea and works.
My new command line sensor looks like this:
- platform: command_line
name: hareadsensorspy
command: "ps -aef | grep -i 'python3 /home/pi/readsensors.py'"
scan_interval: 60
value_template: >-
{% if states.sensor.hareadsensorspy.state[:7] == "homeass" %}
crashed
{% else %}
active
{% endif %}