1. Connect to MongoDB
1) If no username and password is set , the command is as follows:
mongo
2) If the username and password are set (for example: ceilometer / password ), the command is as follows:
mongo 10.10.119.189:27017/ceilometer -u ceilometer -p password
2. Connect to the database
use ceilometer
where ceilometer is the name of the database to be used.
3. Execute the query
The query SQL is as follows:
db.meter.find({
"counter_name":"physical.cpu.utilization", "resource_id":"此处填写实际物理机的uuid", timestamp:{
"$gte":new Date(ISODate("2021-03-30T01:55:00Z")),"$lte":new Date(ISODate("2021-03-30T13:55:00Z"))}}).sort({
"timestamp":-1}).limit(5);
Among them,
meter is the name of the performance table,
physical.cpu.utilization is the name of the indicator, and
timestamp is the timestamp