smon

System monitor

Synopsis

smon [-h|-v] [-q]
  start|stop|restart|status|cklog|cksize|cktime|fetch|purge|fg
  [-dt Interval] [-xmem %Usage] [-xdsk %Usage] [-wrn] [-n Count]

Description

smon is a system monitor. It normally runs as a daemon and collects system statistics at regular interval in the background. Collected result is saved in a stats log “smon.out” in the daemon’s runtime directory.

smon can also run in the foreground and output stats as soon as they are collected.

Note: This tool only works under Linux.

Options

-q
Quiet. Suppress info level messages that normally go to stdout.
cpu
Select tasks by top CPU usage. This is the default.
start
Start stats collection daemon. The daemon collects system statistics every 30 sec and saves result in stats log “smon.out”.
stop
Stop the daemon if it is running.
restart
Start daemon if it is not running. No action is taken if the daemon is already running.
status
Report whether the daemon is running.
cklog
Retrieve all records from stats log “smon.out” that have the warning field set. See -xmem and -xdsk regarding how warning is set. Output goes to stdout.
cksize
Get the stats log “smon.out” file size. Output goes to stdout.
cktime
Get the beginning and ending time from stats log “smon.out”. Output goes to stdout.
fetch
Retrieve all records from stats log “smon.out”. Output goes to stdout.
purge
Delete stats log “smon.out”.
fg
Collect and print stats in the foreground every 5 sec. No stats log is generated.
-dt Interval
For start and fg only: Collect stats every Interval seconds. Default is 30 sec for start and 5 sec for fg.
-xmem %Usage
For start and fg only: Set the stats warning field if memory usage exceeds the %Usage threshold. Default is 94%.
-xdsk %Usage
For start and fg only: Set the stats warning field if disk usage exceeds the %Usage threshold. Default is 94%.
-wrn
For start and fg only: Only save/print stats with a warning set. See -xmem and -xdsk regarding how warning is set.
-n Count
For start and fg only: Quit after saving/printing Count stats records. Default is unlimited.

Stats Log Format

The stats log is in CSV format. For example:

n3212,1406334500,cpu=4009|1192|29 cpu0=1003|1|0 cpu1=1002|1002|100 cpu2=1002|188|18 cpu3=1003|2|0,mem=6091604|3565476|58 swap=2056312|43732|2,/=9920624|3519880|35 /home/local=18253712|6145392|33,
n3212,1406334530,cpu=3963|2041|51 cpu0=1003|21|2 cpu1=1003|1003|100 cpu2=975|135|13 cpu3=982|882|89,mem=6091604|5826816|95 swap=2056312|53700|2,/=9920624|3519880|35 /home/local=18253712|6145392|33,mem|95

The format is:

label,time,cpu=tot|used|%used cpu0=tot|used|%used ...,mem=tot|used|%used swap=tot|used|%used,directory=tot|used|%used directory=tot|used|%used ...,warnings

Column 1: Label

A machine spacific label, usually the first part of its domain name.

Column 2: Time

The time (UNIX seconds) at which the stats are collected.

Column 3: CPU usages

The column may contain several space separated fields - one for the overall system CPU usage, and one for each CPU/core if applicable. Each field has the form:

cpu[Id]=total|used|percent_used

The total and used values do not have any particular unit, just use them to calculate usage percentage.

Column 4: Memory usages

The column may contain up to 2 space separated fields - one for the physical memory usage and one for the swap usage. Each field has the form:

memory_type=total|used|percent_used

The total and used values are in kilobytes.

Column 5: Disk usages

The column may contain several space separated fields - one for each mounted filesystem. Each field has the form:

mount_point=total|used|percent_used

The total and used values are in kilobytes.

Column 6: Warnings

This column is usually empty unless either memory or disk usage exceeded the -xmem or -xdsk threshold (94% by default). The warning may contain several space separated fields, one for each resource exceeding the threshold. Possible fields are:

memory_type=percent_used
mount_point=percent_used

See Also

  • tmon - Task monitor