This how-to illustrates adding a process for availability monitoring. We add and create a fake
process, which assists in understanding and testing purposes. You can then extend this how-to to work for any real processes on your systems.
Assumptions:
First, check to make sure that your process is not monitored by default. Some common processes such as httpd and mysql may be monitored out of the box. You can also look at the properties of these pre-existing processes for more advanced Regex examples.
Many processes added are often case sensitive, especially on unix systems. Regex fields are case-sensitive by default.
You can do this with a real process, but also with a fake
one that we will create. A fake one allows us to play and test easily.
It is a good practice to assure that you are authenticated as ‘zenoss’ user.
su - zenoss
Create a text file called fred, or whatever you want, to become a shell script that will run for a while in the background. Inside it will be a shell command such as sleep. Make sure it has executability via chmod command.
echo "sleep 500" > fred chmod 755 fred
Go ahead and start that shell script. You can do it in the current screen like so:
sh fred
or in the background:
sh fred &
I found it easier to run two shells, one being a shell that ran the test process in the foreground and that I could easily stop it with Ctl+c. A second shell allows you to watch the process, or do any other commands needed.
ps ax | grep fred 27577 pts/0 S+ 0:00 sh fred 27683 pts/1 S+ 0:00 grep fred
You should get back a fred
process in addition to the grep that was running as you ran grep. In this case, “sh fred”. This means, for sure, our process is running.
Back to the Zenoss GUI.
This is a necessary step that is often forgot. Remodeling will eventually automatically happen on all devices, usually every 12 hours, but we want to see its effects now.
Note: See get_faster_results_when_testing to see effects faster
If the process is not there, something went wrong above
Trouble shoot with the following manual, 1-run daemon command:
zenprocess run -v10 -d applianceincloset.loc
The zenprocess command runs on your device and gives heavy log text back that can be useful. The log you get back for a working device, differs from a non-existent or non-working device. Try running it on a working device and compare to your non-working device.
Pay special attention to
INFO:zen.zenprocess:Pulled process status for 1 devices and 3 processes Vs INFO:zen.zenprocess:Pulled process status for 0 devices and 0 processes
Either instance of the above log tells us different things. The first one has found the device specified, and found 3 processes on the device. The second one, it didnt even find the device, something more fundamental is going wrong. Maybe you are not referencing the device name correctly in your zenprocess command, or the device is not responding.
[zenoss@applianceincloset ~]$ ps ax | grep fred 28538 pts/0 S 0:00 sh fred 28542 pts/0 S+ 0:00 grep fred [zenoss@applianceincloset ~]$ kill 28538 [1]+ Terminated sh fred
When Zenoss models a device (every 12 hours by default), it looks to see which processes it should be monitoring. If it does not see a process existing while it models, that process will no longer be monitored. You need to explicitly tell Zenoss to Lock a process from being removed on modeling. This is called locking the process from updates.