I would like to monitor a select group of processes, vmware vm's, running on my centos 6 host. "top" gives me most of what I want in that I can use -p to specify only those processes and -c to get the full command line as I'm ultimately interested in seeing the actual names of the VMs being monitored. However, the full command line is too long to be displayed on the screen. I thought about writing the output of top to /tmp and doing some parsing there, but apparently top is only writing 80 chars, truncating the name of the VM.
I thought perhaps I could use 'ps' to so something similar, but CPU usage using this approach never changes – how can that be?
Any suggestions as to how I might pull this off?
TIA!
Best Answer
To be honest, I would use Monit for this. It's available from RPMForge via yum for your particular version of Linux.
Monit is a tool for monitoring processes and daemons. Usually this is done via PID, but you can also match on a process string. Since VMWare Server process strings end in a "vm_name.vmx" specification, you can set Monit to check against that string. The only example of a VMWare Server 1.0.x system I have handy has ONE VM running, but as long as you know the names of the *.vmx files, you can list them independently in the monit config file.
Here's the output of
monit procmatch vmx
:Adding a small VMWare check entry to the monit config file (create and entry for each unique VM you need to monitor)...
This shows the status of what's being monitored.
Then, there's a web interface to control processes at http://servername:2812