Collecting SmartOS system information
SmartOS infrastructure containers provisioned from an image include pre-defined scripts for collecting information on how your infrastructure container is using various resources.
sm-cpuinfo
: Displays the CPU cap currently in use and the percentage of system CPU currently in use.sm-meminfo
: Displays the memory cap, the amount of memory currently in use and the amount of memory currently free.sm-summary
: Displays a summary of important properties of the container. For example, container UUID, hostname, pkgsrc repository used, and so on. This script also provides information similar to the sm-cpuinfo and sm-meminfo scripts.sm-list-timezones
: List all the supported timezones for an infrastructure container.sm-set-timezone
: Set the timezone to a specific region for a infrastructure container.sm-lsof
: Show the mapping between processes and ports.
Memory system information
The sm-meminfo
script collects information about how your system uses memory compared to the total amount installed.
Before you begin
Before invoking this script, ensure you know the following. You will pass these in as arguments for the script:
- The type of memory installed in the machine: rss or swap.
- Specify that you want to generate the system information in a format that is machine readable. The default is to display the output in human readable format. Use the
-p
option to specify this.
Invoking the script
To invoke the script:
- SSH into the machine.
- Run the
sm-meminfo
command specifying the type of memory and if you want to generate the information in a machine-readable format. The script will gather memory system information and display it onscreen.
-
For example; this displays rss in machine-readable format:
# sm-meminfo -p rss * Gathering rss memory infomation for 9272333a-80dc-4a2d-a0b6-321e9e4f5a93.. mem_cap:2147483648 mem_used:212860928 mem_free:1934622720
-
The following is the same information in a human-readable format:
# sm-meminfo rss * Gathering rss memory infomation for 9272333a-80dc-4a2d-a0b6-321e9e4f5a93.. Memory cap: 2.0 GiB Memory used: 207.0 MiB Memory free: 1.7 GiB
CPU system information
The sm-cpuinfo
script collects information about how your system uses available CPU resources compared to the total amount available.
Invoking the Script
To invoke the script:
- SSH into your machine.
-
Run the
sm-cpuinfo
command. The script will gather CPU system information and display it onscreen. For example:# sm-cpuinfo * Gathering cpu infomation for 9272333a-80dc-4a2d-a0b6-321e9e4f5a93.. CPU Cap Used: 6 % System CPU Used: 0.0 %
System summary
The sm-summary
script collects a basic system summary that includes important properties of the system. The information collected from this script is useful for troubleshooting possible issues that you can quickly share with support representatives. This script also provides information about installed memory and memory usage.
Invoking the script
To invoke the script:
- SSH into your machine.
- Run the
sm-summary
command. The script will gather information on system properties and display it onscreen. For example:# sm-summary * Gathering SmartMachine summary.. SM UUID 9272333a-80dc-4a2d-a0b6-321e9e4f5a93 SM ID 257 Hostname mydomain.com SmartOS build joyent_20120126T071347Z Dataset newds 3.4.41 Pkgsrc https://pkgsrc.smartos.org/sdc6/2011Q4/i386/All Processes 42 Memory (RSS) Cap 2048M Memory (RSS) Used 206M Memory (RSS) Free 1842M Swap Cap 4096M Swap Used 574M /tmp Used 4.0K Disk Quota 62G % Disk Used 4%
Working with timezones
You can use the timezone scripts to find a specific timezone and set your SmartMachine to that timezone. These scripts are located in /opt/local/bin/sm-list-timezones
and /opt/local/bin/sm-set-timezone
respectively.
Listing timezones
Use this script to generate a list of values that you can use with the sm-set-timezone
command. You invoke this script by running the sm-list-timezones
command. The location of this script is /opt/local/bin/sm-list-timezones
.
Invoking the script
To invoke the script:
- SSH into your system.
-
Run the
sm-list-timezones
command. The script will generate a large list of timezone values that you can then use with thesm-set-timezone
command.# sm-list-timezones * Listing timezones for 9272333a-80dc-4a2d-a0b6-321e9e4f5a93.. Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara Africa/Asmera Africa/Bamako Africa/Bangui Africa/Banjul ...
Setting a timezone
Use this script to set the timezone to the region you specify. You invoke this script by running the sm-set-timezone
command. The location of this script is /opt/local/bin/sm-set-timezone
.
Before you begin
Before invoking this script, ensure you know the following. You will pass this in an argument for the script:
- The timezone to which you want to set the system. You can use the
sm-list-timezones
command to find the value you need.
Invoking the script
To invoke the Script:
- SSH into your system.
-
Run the
sm-set-timezone
command specifying the timezone to which you want to set the SmartMachine. For example:# sm-set-timezone US/Pacific-New * Setting timezone for 9272333a-80dc-4a2d-a0b6-321e9e4f5a93.. * Changed to timezone to US/Pacific-New. You will need to reboot.
-
The script will set the timezone and prompt you to reboot the system for the change to take affect.
- Reboot the system.
You can reboot the system by running the sm-reboot
script.
Process mapping
Use this script to determine how processes are mapped to ports, files, and directories. You invoke this script by running the sm-lsof
command. The location of this script is /opt/local/bin/sm-lsof
.
Available options
Option | Description |
---|---|
-p |
Displays port information for all running processes including the associated process ID (PID), IP, and port. |
-f |
Displays file information for all processes on the system including the associated process ID and file/device. |
-P <PID> |
Displays all ports used for a process specified by the process ID. |
-F <PID> |
Displays all files used for a process specified by the process ID. |
-o <port> |
Displays all processes that map to the specified port. |
-i <file> |
Displays all processes that map to the specified file. |
-d <directory> |
Displays all processes that map to the specified directory. |
Invoking the script
To invoke the script:
- SSH into your system.
- Run the
sm-lsof
command specifying an option:
-
To see a list of all running processes:
# sm-lsof -p * Displaying port information for all processes.. PID PROCESS IP PORT x ----------------------------------------------------------------- 11971 /usr/lib/ssh/sshd ::ffff:165.225.129.242 22 11971 /usr/lib/ssh/sshd ::ffff:38.104.194.102 9730 11972 /usr/lib/ssh/sshd ::ffff:165.225.129.242 22 11972 /usr/lib/ssh/sshd ::ffff:38.104.194.102 9730 83735 /opt/local/sbin/httpd 0.0.0.0 80
-
To determine which processes map to port 22:
# sm-lsof -o 22 * Displaying process information for port 22.. PID PROCESS IP PORT ----------------------------------------------------------------- 11971 /usr/lib/ssh/sshd ::ffff:165.225.129.242 22 11971 /usr/lib/ssh/sshd ::ffff:38.104.194.102 9730 11972 /usr/lib/ssh/sshd ::ffff:165.225.129.242 22 11972 /usr/lib/ssh/sshd ::ffff:38.104.194.102 9730 85993 /usr/lib/ssh/sshd ::ffff:165.225.129.242 22
-
To determine which ports map to processes with a PID of 85993:
# sm-lsof -P 85993 * Displaying process information for pid 85993.. PID PROCESS IP PORT ----------------------------------------------------------------- 85993 /usr/lib/ssh/sshd ::ffff:165.225.129.242 22 85993 /usr/lib/ssh/sshd ::ffff:38.104.194.102 58867