How To Monitor Your Linux Server Resources

When you own- or rent- a Linux server, there are a few things you might be concerned about. Is the server being overworked?" Will your application run smoothly or not? Can you add on another website or wil you need to get another server? Or even, will your current server maintain performance if the number of visitors to your site doubles? Even if you're not thinking about these things now, chances are you will at some point. So, to help you out, I’ll try to explain the basic server performance metrics and monitoring in this article. When we talk about server performance, we usually need to look at CPU, memory, disk and network performance. And while, in many ways, they’re tied together, we also have a few utilities to look at them separately. The first utility we'll look at is ‘top,’ and it'll give you some quick info on overall server performance. The readout usually looks like this:

top - 05:48:52 up 46 days, 11:32,  1 user,  load average: 0.00, 0.01, 0.05
Tasks:  60 total,   1 running,  58 sleeping,   0 stopped,   1 zombie
%Cpu0  :  1.2 us,  0.0 sy,  0.0 ni, 98.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   1027072 total,   519456 used,   507616 free,   136192 buffers
KiB Swap:        0 total,        0 used,        0 free,   208304 cached

One of the first things we see here is load average (LA):

load average: 0.00, 0.01, 0.05

It might be a little confusing for beginners, because it doesn't really look like a Windows CPU load readout which could vary from 0 to 100%. Load average refers to the average number of processes waiting for execution in 1, 5 and 15-minute timeframes. It not very informative, because processes can wait for CPU, disk, IO or the network, but all you can tell from looking at looking at these numbers is that the system might be overloaded for some reason. In the above example, I can tell that, basically, the server is barely experiencing any load at all. Rule of thumb: ff the load average is greater than the CPU core count, it generally means that there are processes on the server that are waiting for some system resource or another to execute. Other numbers to look at are: us — CPU time consumed by user processes; sy – CPU time consumed by system processes: wa – wait average, or time spent waiting for input/output from network or disk. If you see high wait average numbers, you need to look into disk subsystem or network! The ‘top’ utility will also show you some memory usage information:

KiB Mem:   1027072 total,   519456 used,   507616 free,   136192 buffers
KiB Swap:        0 total,        0 used,        0 free,   208304 cached

You can see that this server has 1 GB of RAM, with about half of it being used. The server also has no swap in this case. If it looks like you have very little memory left, and you see high used swap numbers, you're probably going to need more RAM. You'll also probably see higher wait average numbers, if this is the case.

We'll need to take a look at server disk stats, too. For that, we're going to use the ‘iostat’ command which is only available with the 'sysstat' package, so make sure you get that before we go on. The command and readout will look something like this:

root@serversuit:~# iostat –xcd
Linux 3.2.0-4-amd64 (serversuit)04/25/2016  _x86_64_  (1 CPU)
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.48    0.00    0.23    0.47    0.02   98.81
Device: rrqm/s wrqm/s r/s  w/s  rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await %util
vda     0.00   1.42   0.00 1.14 0.06  11.29 19.82    0.01     12.45 3.11    12.47   0.53

First thing to looks at is the %iowait number. In our case, it's 0.47% which is good. If it looks like the %iowait stat is more than the %user it means that your processes are waiting for disk I/O longer than it would actually take for CPU to complete them, which isn't good! You can also check the await numbers below. They represent an average number of milliseconds needed to complete an I/O request. Rule of thumb: if you can see high %iowait numbers it means that your disk I/O is probably bottlenecking your server performance. 

Manually monitoring your server performance can be difficult, especially when you end up managing more and more servers. But that's why we built ServerSuit! ServerSuit has built-in automated server monitoring specifically designed to track multiple servers! You can add CPU, memory, network and disk monitoring widgets using our fully customizable UI dashboard. 

Old preview of ServerSuit dashboard
ServerSuit's Inuitive Dashboard

You can track your server's RAM utilization, network bandwidth and disk usage in real time. As you can see, server CPU graph shows you the average 1-minute, 5-minutes and 15-minutes load averages we talked about earlier. You also can check for server used/free memory ratio along with available disk space on the server. When you add your server to the ServerSuit dashboard, you can find the ‘Monitoring’ tab under the ‘Manage’ menu where you can actually set the Load Average threshold yourself:

ServerSuit's Custom Monitoring Configurations

With just a few settings- that are simple and intuitive- and you can be immediately notified when your server load exceeds normal parameters automatically, anytime anywhere (with an internet connection of course)! Give it a try; registration is free and so is ServerSuit's linux server management portal for 30-days when you sign up! I hope that this quick introduction into Linux performance monitoring will help you a bit with managing your servers. Server monitoring is actually a much wider issue than what we covered in this article, so we plan to write more articles detailing the nuances of this topic.

Until next time!

April 25 2016

Add or review comments

Please leave your comment

Existing comments

Comments 0