I have a distributed server system.
There are many servers coordinated through PubSub. All of them are connected to the statistics server. Every minute, the servers send their statistics to the statistics server (how many requests were processed, average time, etc.).
So ... It would be nice to include system status in these stat messages. I need a processor load (each core) and the amount of free memory.
I made a small workaround and decided to call the linux command using "exec", parse the response, and generate the JSON data to send.
But how can I get this data from the command line?
On Mac OS X, I can easily get everything I need using geektool scripts, but they do not work on linux (debian).
For instance:
top -l 1 | awk '/PhysMem/ {print "Used: " $8 " Free: " $10}'
Mac OS X Lion :
Used: 3246M Free: 848M
debian...