Check all articles

Commands to monitor services on Solaris

Depending on how we use a server with a Solaris operating system, such as: email server, web server, print server, file server, application server or database management server... there are resources that we want to monitor intensively according to the service that the server provides; it could be CPU, memory, network usage, storage, etc. Regardless of the resource that we want to monitor, there are some commands that must be well known by the Server Administrators and the Computer Center Operators.

This article is a guide for the most frequently used commands. For a completed reference about commands please check the documentation for Oracle Solaris 11.

If you need a server with Oracle Solaris to do a lab and test these commands, see the article Installation of Solaris 11 on Intel.


These commands to monitor the services are listed below:

How to look for help

Although it seems irrelevant, it is always very important to know all the functionality of a command and the parameters it supports, for this we use the command man with the name of the command that we want the help information or we can do searches: a) by adding the -k parameter in lowercase with a "keyword" about the command, b) with -K in uppercase for looking the keyword in the description of the command:

$man boot
$man -k keyword
$man -K keyword

It is recommended that for each of the commands that we are going to learn in this article, their documentation should be verified to fully cover the parameters that these commands support.

Know the server

The following commands allow us to obtain general information about the server that we are going to check.

Get the date/time of the system.

$date

Obtain the operating system version.

$cat /etc/release

Get the name of the server.

$uname -a

Obtain server identification.

$hostid

Know the total physical memory.

$prtconf | grep Memory

Obtain the processor architecture.

$isalist

Know the number of processors.

$psrinfo -p

Know the detail of the virtual processors, brand and speed.

$psrinfo -pv

Verify CPU usage

We need to know how the CPU is being used as a whole.

The reporter of the system activity called sar, is a utility that lets us know how much CPU is being used at the user level, at the system level, when it is inactive waiting for the completion of an I/O operation and the idle percentage. The result of this command is a snapshot (photograph) that indicates how our equipment is working; we will call this result "a sample". This command can receive 2 numeric parameters, the first is the interval in seconds that we want to obtain between sample and sample, the second is the quantity of these samples.

$sar 5 10

To have a continuous view of the use of resources for each system process we use the command top. This command give a continuous output, for stopping press the "q" key on your keyboard in order to quit.

$top

Verify memory usage

To know the usage of memory let's execute the command vmstat that has as output memory, paging, disks, faults and cpu. It is also obtained as a snapshot, the first parameter is the time in seconds of the interval between the samples and the second is the number of samples.

$vmstat 2 5

The next utility obtain metrics on the activity to the terminal, disks, tape and the use of the CPU. Allows to count the read/write operations and the used bytes of these operations

$iostat 5 10

Verify space usage

To verify the allocated, used and available space of our storage, let's use:

$df -hk

Verify network usage

To show the status of the network, let's use netstat, this command accepts several parameters like those we have already seen for cpu and memory. Depending on what we want to check:

Statistics by protocol:

$netstat -s

The status of network interfaces:

$netstat -i

Statistics for packet transmission:

$netstat -f inet

Verify running processes

To have a list with the detail of the processes/services that are being executed, we use:

$ps -ef

To know which processes are being executed in the operating system with a percentage of usage, execute the command prstat, it is very similar to the command top that only groups and summarizes the processes showing the total amount in the column NLWP:

$prstat

Check the error log

To verify recent messages that the system has registered, we use:

$dmesg

If we want to see all the messages registered in the system, we use:

$more /var/adm/messages

To have a continuous output of the last messages as they occur, we use:

$tail -f /var/adm/messages

Monitor in graphic mode

If we have access to the operating system desktop, we can use 2 tools to monitor our system graphically.

We can see system information, system processes, a graphical view of resources and the use of the file system, from the menu on the desktop /Applications/System Tools/Performance Monitor

MonitorSolarisScreen1

To see all the services that are being executed in the system, from the menu on the desktop /System/Administration/SMF Services

MonitorSolarisScreen2