You might find it easier to use the psutil python module:
Post by Steve Piercy - Website BuilderPost by Chris McDonoughIs there a CPU monitoring plugin utility for Supervisor, like memmon in
superlance monitors memory?
Theoretically, the data is available. memmon uses "ps" to get the
memory size of prorcesses, and could get the CPU usage data from ps as well.
But CPU usage is typically a lot more dynamic than memory usage, and
some sort of restart trigger based on "using too much (or too
little) CPU" would be very application- and environment-specific,
and not easily generalizable. I think you would be forced to write
your own event listener, possibly starting from the code in memmon.
One could monitor cpu time and compare it with real time. That should be
reasonably easy, since both increase monotonically.
On modern linux systems, cgroups also provides a mechanism for limiting
resource consumption, including cpu usage.
Thanks, y'all. I reckoned that monitoring CPU would be a challenge.
I got elbows deep in 'ps' and learned a few things, like -o to give me
pretty output.
ps -u<user> -o pid,pcpu,pmem,command
I'm reading and re-reading cgroups docs, but I'm having a hard time
absorbing it.
https://access.redhat.com/documentation/en-US/Red_Hat_
Enterprise_Linux/6/html/Resource_Management_Guide/ch01.html
Anyone have a "cgroups for Dummies" reference?
--steve
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy Website Builder Soquel, CA
_______________________________________________
Supervisor-users mailing list
https://lists.supervisord.org/mailman/listinfo/supervisor-users