You can call an API operation based on the RAM user information and the region ID to check memory usage of the instances under the current account. The script is as follows:
Note The query result is the memory usage during the period 20 minutes before the current
time of the instances.
Procedure
- Install the Alibaba Cloud Python SDK dependency package by running the following command:
pip install aliyun-python-sdk-core
. - Run the preceding script file in Python. In the script, the -r parameter is cn-hangzhou
by default. Separate multiple region values with commas. The detailed command is as
follows:
python get_used_memory.py -i ****** -s **********-r cn-hangzhou,cn-beijing -o XXX.csv
Note You can run thepython get_used_memory.py –h
command to check the usage of each parameter.