Header Shadow Image


Linux / UNIX: Monitoring the operating system memory, cpu, hard drive, performance and other resources.

Pages: 1 2 3 4

SMARTCTL
Report on / show S.M.A.R.T. controller information/settings for a drive. Use ‘smartctl -a <DEVICE>‘ where <DEVICE> is the actual name of your device you wish to check on. This also prints all errors the device has encountered so is a very useful tool in determining if you should be replacing a hard drive soon. In my case it reported 32 errors on a drive telling me I will need to be changing it soon. 🙂

FREE Memory using ‘free’ & ‘cat /PROC/MEMINFO’
The command ‘free‘ printed system memory usage including swap space utilization:

$ free
total used free shared buffers cached
Mem: 515716 445576 70140 0 38368 176252
-/+ buffers/cache: 230956 284760
Swap: 2530196 0 2530196
$

Alternately, typing ‘cat /proc/meminfo‘ displays detailed memory information. This holds more detailed memory usage analysis/brake down then does ‘free‘ including categorization as is done on typical UNIX / Linux hosts.

PSTREE
‘pstree‘ in it’s simplest format prints commands and their parent-child relationship to each other. This command is usefull if there is a runaway process spawning too many instances of another process. The command has a limited subset of options available by running ‘pstree –help‘.  It is a simplistic command primarily designed to show process associations.

LOAD
This is not a command but a concept. Load is an index starting at 0.00 that indicates system activity. On a clean system this should not go over 1.00 however in some applications, this value may be tolerated when significantly higher. Values of 1 generally means users of a system will see noticeable delays in their tasks. One command that prints load is ‘uptime‘ typed without parameters that was discussed earlier.

DMESG
Typing ‘dmesg‘ on a command line prints boot up error/messages encountered when the system was started up.

SAR
‘sar‘ is a System Activity Reporting tool/command. Typed without parameters, it shows analysis of system processes and resource usage history. This is especially useful when determining the root causes of a slowdown on a Unix/Linux host. As with ‘ps‘ this utility has an extensive documentation and comes with many options. A variation is:

$ sar -n DEV

Which shows network activity on a host for a range of time. ‘sar‘ is used extensively in the industry and has a detailed man page of available options.

IFCONFIG
Shows network card (NIC / Network Interface Card) statistics and settings including errors on the card. Example:

$ ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1931 errors:0 dropped:0 overruns:0 frame:0
TX packets:1931 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3039216 (2.8 MiB) TX bytes:3039216 (2.8 MiB)
$

This is especially usefull when you are experiencing network issues. If there are problems with your network card, the errors can be visible after typing this command.

MPSTAT
Shows processor/CPU activity on a host for a specified time. ‘mpstat‘ without parameters shows the current snapshot of CPU related usage information. A variation of the command is ‘mpstat –a 1 1‘. Basic usage information is:

Usage: mpstat [ options… ] [ [ ] ]

IOSTAT
‘iostat‘ works similarly to ‘mpstat‘ but reports usage statistics on a drive. ‘iostat /dev/hdb ALL 1 1′ shows more detailed information taken at interval of 1 second. Basic usage and options are:

[ -c | -d ] [ -k | -m ] [ -t ] [ -V ] [ -x ]
[ [ … ] | ALL ] [ -p [ | ALL ] ]

More detailed information is available by ‘man iostat‘, ‘info iostat‘ or ‘iostat –help’.

VMSTAT
‘vmstat‘ works similar to ‘iostat‘ however reports information on memory utilization. Without any options ‘vmstat‘ prints memory utilization and may be considered more accurate in it’s reporting then ‘free‘. A number of options are available and can be seen by running ‘man vmstat‘.

LSOF
‘lsof‘ is short for ‘ls’ (list) Open Files. This command shows all currently open files on a host. This command is ideal if you want to know which process has what files open. This is especially useful in identifying commands or files being used outside their allowed locations or command using old outdated files that could be causing problems. This command is very useful since it links PID or processes with files they have open, information which is not readily available from other commands. ‘lsof‘ has a huge number of parameters that rivals ‘ps‘.

CORE FILES
This feature of UNIX / Linux systems is essentially a memory/library dump of running jobs that could be causing issues. The core files are extensively use in pin pointing problems in crashing or hung applications and are essential to diagnosis by developers. The topic of core files is far too extensive to cover here and will be covered in a separate topic in the future.

Pages: 1 2 3 4

One Response to “Linux / UNIX: Monitoring the operating system memory, cpu, hard drive, performance and other resources.”

  1. […] through the ISA I/O Ports.  See the notes above.  An earlier topic of ours also talked about hddtemp who's output looks like […]

Leave a Reply

You must be logged in to post a comment.


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License