All of us who manage web servers are always after some new tool or tweak, either to have more information about our hardware resources or to reduce consumption 😀
Here I will leave you a script that they put a while ago in Crystalb precisely for thisTo measure Apache's memory consumption, I leave you an example of the data it provides:
Apache processes and memory usage.
Total installed memory: 4.09Gb
Availiable memory: 3.31Gb
Free percentile: 80.00%
| +++++++++ —————————– |
Current processes: 28
Average memory: 76Mb
Maximum memory: 80Mb
Overall memory: 1.99Gb
Concurrent best: 446 more connection (s)
Concurrent worst: 424 more connection (s)
As you can see, it tells us the number of connections to Apache that are in progress, amount of memory occupied, available memory, etc 🙂
Quite useful or not?
Even with just a few more minutes we could make this information reach us by email, that is, we would first put in crontab that every X time (1 hour for example) make this report, print the report in a file (stat.info) and then send us the file by email using some method that we have explained here before.
It would be:
1. Put in crontab run every hour
2. What will be executed would be:
/root/./script.sh >> /root/stat.info && mail -s "Server's Stats" email@example.com < /root/stat.info
And voila, it should work without problems 😀
Well nothing ... another tip that I hope will be useful 😉