Linux CPU usage and montioring using shell memcache and jquery
Recently in a project where the application was deployed across multiple servers, the Client QA as well as Support Team wanted a better monitoring of all the servers in the production. It was too much to provide everybody with shell access and ask them to monitor using top. Well after a lot of digging through the wonderful search index of Google. And with insights from Paul Colby vide his article Calculating CPU Usage from /proc/stat, and various comments of Memcache usage through telnet along with the /dev/tcp socket connections it was just a matter of using some nifty shell processing before I could store each machine cpu values, loadavg, and running tasks as a json encoded string into memcache on one of the hosts with hostname as the key.
The rest was simple to write a jQuery based interface to fetch the collected data, and process it before adding to a continuous update, the number of rows shown and the frequency was also tweaked, and the latest values are shown on top. Well the page is a bit crude, but serves our purpose. There is not much to configure other than the memcache server in the shell script, which is mcs, and the same in the loader.php. If there are multiple servers to be monitored, the hostname should be added to the $hosts array in the loader.php.
I am adding the full kit for download Linux CPU usage and montioring using shell memcache and jquery - Files (677).