You can use Cloud Assistant to compile commands used to view the system configurations of Elastic Compute Service (ECS) instances and run the commands on multiple ECS instances at the same time. Then, you can determine the subsequent actions based on the command outputs, such as downloading or updating software. This topic uses shell commands for Linux to describe how to view the system configurations of ECS instances.
Background information
Before you view the system configurations of ECS instances, make sure that you are familiar with Cloud Assistant and how to use Cloud Assistant. For more information, see Overview and Use Cloud Assistant.
The operating systems and system configurations of ECS instances determine whether the sample commands described in this topic can run on the instance. We recommend that you modify the command content based on your business requirements. You can include custom parameters {{key}} in commands to increase the applicability of the commands.
NoteThe execution status and results of Cloud Assistant commands may vary based on the operating systems and system configurations of ECS instances. You can view the error messages in the execution results and troubleshoot the issues in the ECS console or by calling an API operation. For more information, see Check execution results and troubleshoot common issues.
View the basic configurations of ECS instances
Scenario: Use Cloud Assistant to view the system configurations of multiple ECS instances at the same time instead of viewing the system configurations of each ECS instance one by one.
Procedure: Create and run a Cloud Assistant command to view the basic configurations of multiple ECS instances. For more information, see Create a command and Run a command.
You can run the following Cloud Assistant command to view specific instance configurations:
# View information about network interface controllers (NICs) that are enabled. ifconfig # View information about all NICs. ifconfig -a # View brief information about NICs. ifconfig -s # View memory information. free -g # View memory information. cat /proc/meminfo # View operating system information, such as the kernel version. uname -a # View the usage of hard disks. df -h # View information about all hardware. dmidecode | more
For example, after the ifconfig command is run to view information about NICs that are enabled, the following output is displayed.
View information about system processes or files
Scenario: Use Cloud Assistant to view information about system processes and files on an instance.
Procedure: Create and run a Cloud Assistant command to view information about system processes or files. For more information, see Create a command and Run a command.
You can run the following Cloud Assistant command to view information about files and system processes:
# View information about all system processes. ps -ef # View information about a specific system process. {{processName}} is the key of a custom parameter. Before you run the command, specify a value for the key. ps -ef | grep {{processName}} # View the details of a file. ls -la {{fileName}} # Query the path of a file. find {{path}} | grep {{fileName}}
For example, after the
ps -ef
command is run to view information about all system processes, the following output is displayed.
View information about Java projects
Scenario: Use Cloud Assistant to view the details of a specific process, such as the memory or usage frequency of the process, on an ECS instance.
Procedure: Create and run a Cloud Assistant command to view information about processes or memory in a Java project. For more information, see Create a command and Run a command.
You can run the following Cloud Assistant command to view information about processes or memory in a Java project:
# View real-time monitoring statistics on the resources and performance of applications, such as the heap size and garbage collection statistics. jstat jstat -compiler pid: provides information about the number of Just in Time (JIT) compilers on the Java Virtual Machine (JVM). jstat -class pid: provides information about the number of loaded class files and the space they occupy. jstat -gcnew pid: provides information about new objects. jstat -gcnewcapacity pid: provides information about new objects and their usage. jps # Obtain memory matching details from core files or processes, such as the heap size and perm size of the JMV heap. jmap jmap -histo pid
For example, after the
jps
command is run to view the running Java processes on an ECS instance, the following output is displayed.