You can use Cloud Assistant to compile scripts for viewing instance configurations and run the scripts on multiple ECS instances simultaneously. Then, you can determine what action to take next based on the responses, such as continuing downloading or updating the software. This topic uses shell scripts for Linux as an example to describe how to view instance configurations.

Make sure that you fully understand how to use Cloud Assistant. For more information, see Use the cloud assistant .

Overview

Whether the scripts in this topic can be run on an ECS instance depends on the operating system and configurations of the instance. We recommend that you modify the scripts as needed. You can include the custom parameter {{key}} in the script to increase its applicability.

View basic configurations of an instance

  • Scenario: You can use Cloud Assistant to query multiple instances simultaneously.
  • Example: You can run the following scripts to view some configurations of an instance.
    # View information of activated network interface controllers (NICs). ifconfig
    # View information of all NICs. ifconfig -a
    # View brief information of NICs. ifconfig -s
    # View memory information. free -g
    # View memory information. cat /proc/meminfo
    # View operation system information, such as the kernel version. uname -a
    # View hard disk usage. df -h
    # View information of all hardware. dmidecode | more
  • Result: If you run the ifconfig script, the following output is displayed in the ECS console.Example of Cloud Assistant scripts

View system processes or file details

  • Scenario: You can use Cloud Assistant to view system processes or file details within an instance.
  • Example: You can run the following scripts to query information of files and system processes.
    # View information of all system processes. ps -ef
    # View information of a specific system process. {{processName}} is the key of a custom parameter and you need to set the corresponding value before you run the script. ps -ef | grep {{processName}}
    # View details of the file. ls -la {{fileName}}
    # Query the file path. find {{path}} | grep {{fileName}}
  • Result: If you run the ls -la /root/HelloWorld.class script, the following output is displayed in the ECS console.View processes and file details within an instance

View information of Java projects

  • Scenario: You can use Cloud Assistant to view the details of a specific process in the instance, such as memory or usage frequency of the process.
  • Example: You can run the following scripts to view information of 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. jstat
    jstat -compiler pid: shows information about the number of Just in Time (JIT) compilers on the Java Virtual Machine (JVM). jstat -class pid: shows information about the number and space usage of loaded class files. jstat -gcnew pid: shows information about new objects. jstat -gcnewcapacity pid: shows information and usage of new objects. 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
  • Result: The following output is displayed in the ECS console.View information of processes within an application