This configuration can keep processes running or stopped. A defined process name will be evaluated with regards to if it is running (present) or not (absent). If the condition is not met the command defined in "command to run" will be executed. This could for example restart a process when it has terminated. On the other hand this can also prevent processes to run. Any restart event will be logged in the qbee logs. This allows you to see if you have processes that are failing on a regular basis.
How to find the process to monitor?
Typically the process name is used to find the process. qbee performs a search for the process name with the information from the box. For example:
/usr/local/bin/cpu_temp.sh searches for this process and checks if it runs. The "Command to run" could then be
bash /usr/local/bin/cpu_temp.sh > /dev/null 2>&1 &. This starts the script again. The appendix
> /dev/null 2>&1 & pipes bash output to /dev/null and executes it in the background. It is important that the file output is handled.
Processes are checked and restarted or stopped with the agent run interval
This evaluation is performed with the frequency with which the qbee agent runs. If it runs every 5 minutes then a process would be restarted at the latest 5 minutes after termination. Like all qbee configuration this will also be maintained should the network connection be down. Any event will be logged in the log files thus giving you insight into where processes die and how often this happens. This can be really valuable for debugging.
Be accurate with the process name!
Sometimes there is more than one process with the same name. Maybe two
openvpn processes are running. Then it is very important to use not only the process name but also the path to differentiate which one is monitored. Otherwise the condition will never trigger as long as one openvpn process still runs.