Server activity and operating system status monitoring is key not only for problem diagnostics, but also for problem prevention.
Therefore, disk space availability, operation memory usage or current server load monitoring are the basic indicators which an administrator should be able to display.
Disk Capacity Usage
You may obtain a summary of all the connected file systems together with their availability through the df command (disk free abbreviation). However, in the default mode, this command displays data in blocks – more clear views with KB, MB, GB, and other units may be obtained through the -h switch:
|$ df -h|
If multiple file systems are connected (for example, external disks or other partitions), the last column always shows the path for accessing this system (we will discuss connecting the file system later).
Operating Memory Usage
We may obtain data on operating memory usage in the same way as in the case of disk space. The command free is used for this purpose. In the default mode, it shows values in bytes; therefore, their intelligent format display requires the -m switch. Values in MB will be shown.
|$ free -m|
The extract requires no further comments. For the sake of completeness, let us mention that we display both the operating memory (Mem:) and swap partition (Swap:) values.
The last command of the “Holy trinity” is the top one. This commands lets us display the operating system’s total load. It will display both a summary of running tasks with information on their memory and disk space requirements and general server load information:
top – 12:22:49 up 2 days, 18:00, 1 user, load average: 0.09, 0.20, 0.22
Tasks: 140 total, 1 running, 139 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.2%us, 0.4%sy, 0.0%ni, 99.2%id, 0.0%wa, 0.0%hi, 0.1%si
Mem: 5081960k total, 3692364k used, 1389596k free, 216320k buffers
Swap: 3905532k total, 224640k used, 3680892k free, 1953192k cached
SHR S %CPU %MEM TIME+ COMMAND
9305 web98 20 0 326m 40m 26m S 1 0.8 0:07.71 php-cgi
510 syslog 20 0 243m 2228 180 S 0 0.0 0:59.11 rsyslogd
2555 list 20 0 59844 1936 852 S 0 0.0 0:33.12 python
3073 root 20 0 479m 4024 1360 S 0 0.1 2:48.59 fail2ban-server
11303 root 20 0 17340 1308 944 R 0 0.0 0:00.12 top
11313 www-data 20 0 414m 4772 2088 S 0 0.1 0:00.01 apache2
The server load data are expressed the average number of processes, which are in a state when they would want to use the processor somehow unit and indicate how much the system is busy at the time. The server load data is averaged over 3 time intervals respectively 1, 5 and 15 minutes. The server administrator has to interpret correctly this value, since this data isn´t standardized. More information can be found in the manual page of the command uptime.
We have presented the three key commands for basic server monitoring. Later on, we will jointly examine also more advanced tools like htop, dmesg, lsmod, and others.
Autor: Jirka Dvořák