Linux server system stats at a glance

It’s important to see how servers are doing regularly to enable you to to take a proactive approach to resolving problems.

But, when your using a Linux server with no GUI, it can be easy to become complacent. After all, they so rairly go down and it can take time to type all the commands required to get the information you need.

That’s where Bash scripting comes in. Creating a script to provide you with memory, CPU, disk and bandwidth usage is very useful. Having this available to you on a day to day basis is even better again.

I’ve been looking for something that would give me a tailored report of what’s happening on a server that I run but nothing gave me what I needed. Everything was either too complicated, too process intensive, too graphical or had too many dependencies. So, after looking around for a while, I decided that it would take less time to throw something together my self.

As I say with all these scripts. This is only one way of doing things. It’s not necessarily the best way, but it works none the less.

The first script obtains all the information I need and simply writes it to a text file. This can be sent by email or just stored somewhere for analysis.

Note: There are a few lines here relating to siteA and SiteB that are logs that have been created by another script. Unless you are following all of the linux backup and system stats documentation on this site, you can remove these lines.

Processor stats:

Virtual memory stats:

Top twenty memory hog applications:

Top twenty CPU hogging applications:

Free memory:

Processor information:

Established connections:

Errors

In the mail logs:

MySQL logs

Apache2 logs

Icecast2 logs

Site backups

SiteA

SiteB


Return to the index


_EOF_
echo “$(date +%Y%m%d)
” >> /home/YourUserName/public_html/sites/default/files/logs/index.html