找回密码
 注册
查看: 650|回复: 1

openstack resource usage show --os-placement-api-version 1.9 <PROJECT_ID>

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-4-5 11:21:31 | 显示全部楼层 |阅读模式
openstack resource usage show --os-placement-api-version 1.9 <PROJECT_ID>
+ N" N  H) \+ R6 O* ^' V9 {  W/ p4 B! T
Installation of the openstack-client extension: pip install osc-placement
5 n8 s* A( A0 y3 ^
8 s7 l$ _& ?/ n' L4 s' BRessource-usage of a project:4 B% E5 X$ k6 b4 d( g7 _6 X
3 K' M4 G* M5 B) O" U- d4 x
openstack resource usage show --os-placement-api-version 1.9 <PROJECT_ID>
1 O) Z% _. q/ u' ]+ V4 i1 u7 l
2 q$ i' C3 m' M5 H9 J: nRessource-usage of a specific user within a project:3 r4 s9 O8 `! \5 y3 M: l
* b. u* C, z* B; U8 g3 ^+ Q8 j* I
openstack resource usage show --os-placement-api-version 1.9 --user-id <USER_ID>  <PROJECT_ID>
- y, U! c: @- X, K6 V; X4 p
, t/ v8 M: [5 z) e% E# X1 |8 r9 jExample:% {" g% ]6 ~$ m$ R! ^& H" i
9 s$ `; \" d" O4 h5 T8 W6 x
openstack resource usage show --os-placement-api-version 1.9 --user-id 98378bd3cdd94218bf7b6ef4ec80e74a  7733616a513444c2a106243db318b0dd/ i# t1 ]: U+ k) {$ ^0 G2 ~
+----------------+-------+8 y8 |3 `" N7 p8 Z0 s' |
| resource_class | usage |
6 L+ `9 {* v1 R$ u& N+----------------+-------+  P* h% o# Q3 T7 ~4 ?" z9 K" r
| VCPU           |     3 |
) Z6 X% i6 g9 e$ \  H| MEMORY_MB      |   768 |
4 p1 q: [4 C/ M6 G

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-4-19 14:30:10 | 显示全部楼层
Show usage statistics for hosts and instances7 d7 w9 e& D* j8 @& A# E
  1 H. S" i' f  |" g0 f. \, j
UPDATED: 2022-05-24 16:03
9 _& v8 }, W+ R* @  ?You can show basic statistics on resource usage for hosts and instances.
% \% @% s0 Z! Q9 N+ `8 S7 S, k; h" c  ^& L! C$ u5 @8 L, f# A
Note
8 ~: f7 D0 H! p2 E/ }* l$ K
: t* K6 ^. _- C0 v8 gFor more sophisticated monitoring, see the Ceilometer project. You can also use tools, such as Ganglia or Graphite, to gather more detailed data.
% y& L; ~- |4 u* s5 F/ @2 k
* I0 a2 f7 L0 B, WShow host usage statistics¶0 r3 f: ~; ]0 g6 Q. V! O" L
The following examples show the host usage statistics for a host called devstack.7 d3 _2 x# A( [
# w7 P3 r2 ~2 q9 A( p' M% C$ Q- D+ G
List the hosts and the nova-related services that run on them:
- R1 c9 C6 O- P2 L" p  ^# A2 z$ ~4 O* i+ _) ?+ T( d/ U' r& Y
$ openstack host list# s; ?8 u  o6 I
+-----------+-------------+----------+# V1 g' q$ F" }6 l- c6 d2 A( N/ K
| Host Name | Service     | Zone     |2 c& y) l5 M" O2 J7 K
+-----------+-------------+----------+
$ Q7 D: m; H& X, C  a9 M. \# x| devstack  | conductor   | internal |
9 q% i- a% `$ z# h1 S  \+ t9 ^| devstack  | compute     | nova     |$ N  B4 v- S& P% z
| devstack  | network     | internal |" m9 C6 W5 `9 q9 K2 C4 v
| devstack  | scheduler   | internal |( J: |- J$ C3 d! b: y' O2 d" N
| devstack  | consoleauth | internal |$ O4 o$ M, R6 l/ w# J( N/ H9 q
+-----------+-------------+----------+
; O* o1 m3 a9 A0 {& s; PGet a summary of resource usage of all of the instances running on the host:
" b) _! {, h0 I3 Q5 O; Y
4 f% V0 o9 V& }, h9 c& F$ openstack host show devstack
# i, `/ N4 S4 V( w7 p! l+----------+----------------------------------+-----+-----------+---------+
/ C  P: ~2 a* v* o0 H| Host     | Project                          | CPU | MEMORY MB | DISK GB |9 h! [: M& ?, |2 O8 |. ]  V
+----------+----------------------------------+-----+-----------+---------+
% Q5 D: v3 _. Q& j) Y9 }| devstack | (total)                          | 2   | 4003      | 157     |: U6 D% [3 X: q( U% k# p9 W* ?
| devstack | (used_now)                       | 3   | 5120      | 40      |3 g; _' m" o; X* K9 h
| devstack | (used_max)                       | 3   | 4608      | 40      |/ o/ z+ B% J& H- f2 o9 B. g3 P) K
| devstack | b70d90d65e464582b6b2161cf3603ced | 1   | 512       | 0       |
- O) s9 I# K7 B| devstack | 66265572db174a7aa66eba661f58eb9e | 2   | 4096      | 40      |
* b0 r* E" I1 Z% t' q& j2 l' {0 ^+----------+----------------------------------+-----+-----------+---------+2 |* ^$ N7 y9 g, x  l
The CPU column shows the sum of the virtual CPUs for instances running on the host.6 G! h6 L+ g, r  o* v1 q. ~6 p2 C

* e# y  T) E2 a- t# c- ~The MEMORY MB column shows the sum of the memory (in MB) allocated to the instances that run on the host.0 @" F- {) C1 E5 d0 T4 s9 a- }

' C( @9 n( m. z! fThe DISK GB column shows the sum of the root and ephemeral disk sizes (in GB) of the instances that run on the host.
5 ]( k9 o4 Y% Y$ ?6 M# \( N; v
6 X* x8 I7 }" ^" u- hThe row that has the value used_now in the PROJECT column shows the sum of the resources allocated to the instances that run on the host, plus the resources allocated to the host itself.# @' [0 |) O, i6 H6 G- V

, ?& J. E5 e5 I* VThe row that has the value used_max in the PROJECT column shows the sum of the resources allocated to the instances that run on the host.3 H7 c) A5 a" N0 y+ |3 S8 |; R

$ y' D0 L$ @, R6 v! z Note
( j6 P9 p' n, _# {
  P, G. {- D6 LThese values are computed by using information about the flavors of the instances that run on the hosts. This command does not query the CPU usage, memory usage, or hard disk usage of the physical host.
# I, \. b8 U1 T! E# V. z) Z$ K* @& `; G. c- x3 Y) h' j
Show instance usage statistics¶
; d0 r# c# g: @% u; y4 n. CGet CPU, memory, I/O, and network statistics for an instance.; v" Q' W0 y& s; I+ l' K$ X) I

/ ?3 L- H) E' S1 B. _( A& `: ~( {List instances:" G9 n  i; [" i% H8 Z

7 g9 R. a  y$ C+ Q$ openstack server list" q) v7 ?/ a/ V, x- k
+----------+----------------------+--------+------------------+--------+----------+7 g$ Y0 h, O/ f/ e  W
| ID       | Name                 | Status | Networks         | Image  | Flavor   |$ A& U2 ~6 i7 l$ ^3 N7 a% N
+----------+----------------------+--------+------------------+--------+----------+
, Z& P" I: ~% [| 84c6e... | myCirrosServer       | ACTIVE | private=10.0.0.3 | cirros | m1.tiny  |" ?$ `; l% t% J5 ~6 {0 R$ Y6 m8 |4 S
| 8a995... | myInstanceFromVolume | ACTIVE | private=10.0.0.4 | ubuntu | m1.small |
. a$ ~( T$ ~4 t) p+----------+----------------------+--------+------------------+--------+----------+% f& M, e6 B0 }: y
Get diagnostic statistics:
# e3 p( Q$ h- T2 Q# [( K( K8 |( \2 L( Y& o- }/ L/ k
Note+ @: J/ m- G5 m: r; ~, f+ e

3 C1 S* Z8 c, E) l! F. pAs of microversion v2.48, diagnostics information for all virt drivers will have a standard format as below. Before microversion 2.48, each hypervisor had its own format. For more details on diagnostics response message see server diagnostics api documentation.6 W& B: r/ o3 X7 T+ I  W

9 Z, S* I8 G2 s$ nova diagnostics myCirrosServer
  W: V! S( i: X' v4 o+----------------+------------------------------------------------------------------------+& w7 [+ G8 y; P6 r+ Y9 u
| Property       | Value                                                                  |7 {; J6 t$ i! S4 x1 z* J0 I3 [
+----------------+------------------------------------------------------------------------+
4 X- H6 w8 \, ^$ u| config_drive   | False                                                                  |( ]. l% r' n  h7 y* c5 l
| cpu_details    | []                                                                     |( y, q7 `$ E& ^: O
| disk_details   | [{"read_requests": 887, "errors_count": -1, "read_bytes": 20273152,    |
/ U. S  O0 x; b2 Z) F|                | "write_requests": 89, "write_bytes": 303104}]                          |
7 I  x4 m9 k) O1 e| driver         | libvirt                                                                |* O2 G: _3 F+ j
| hypervisor     | qemu                                                                   |
0 m: Z4 B, F; G1 Y( F1 }| hypervisor_os  | linux                                                                  |0 D( U# g. F) N  e8 M8 M7 X
| memory_details | {"used": 0, "maximum": 0}                                              |
+ i- r, o. @, o' `% H6 m| nic_details    | [{"rx_packets": 9, "rx_drop": 0, "tx_octets": 1464, "tx_errors": 0,    |, y* P6 I5 p, B( m; R" f
|                | "mac_address": "fa:16:3e:fa:db:d3", "rx_octets": 958, "rx_rate": null, |
# @/ c1 n* d6 Q|                | "rx_errors": 0, "tx_drop": 0, "tx_packets": 9, "tx_rate": null}]       |
0 ]/ F0 h0 p3 i2 f7 I9 G- O| num_cpus       | 0                                                                      |& i& \7 }$ G) y$ [; H
| num_disks      | 1                                                                      |
3 s( R2 j0 F" H# V| num_nics       | 1                                                                      |
- ~3 ^0 x" H4 I4 ^5 y+ y| state          | running                                                                |
3 }6 L  V& D. `  f3 o! V: M| uptime         | 5528                                                                   |
. h" y9 _  b- X4 V$ s7 c9 O+----------------+------------------------------------------------------------------------++ Y! A+ L; K) k
config_drive indicates if the config drive is supported on the instance.
( q7 I, Z' ~$ J* ]. H0 g3 k  G3 [2 q) W
cpu_details contains a list of details per vCPU.$ V3 e. q" L) E9 v% e7 A

( v; R( G) ^9 O8 @disk_details contains a list of details per disk.
! d, r0 W) \* J8 p" O5 J* q7 x  [6 W6 c( R- k1 Q  V# T8 z
driver indicates the current driver on which the VM is running.
, E# m* B, r1 B1 N" j9 v; y9 t
6 r1 y7 l' h3 Whypervisor indicates the current hypervisor on which the VM is running.3 W. @% |& K( ~

$ g0 B0 [- `0 X( e1 n4 ?nic_details contains a list of details per vNIC.( ~0 d+ K; u& \7 _7 L8 @

6 @" r2 U1 O/ i1 Muptime is the amount of time in seconds that the VM has been running.5 ?/ ]2 u6 B- O9 R! X7 e' `

1 Y. V  g$ E) \
3 M* A0 s7 j5 KDiagnostics prior to v2.48:
8 l) R, O/ f: b2 x" |" p8 i5 m1 X7 M1 c* b
$ nova diagnostics myCirrosServer
; g9 ?* X5 ?( `5 h& a' k+---------------------------+--------+9 w( M' h4 Z/ ?. x0 ^! X; z9 K
| Property                  | Value  |
5 M: G0 m+ g5 G& r6 H4 h+---------------------------+--------+; f# e& E# h' \2 \7 O5 n
| memory                    | 524288 |2 m0 ~- n' e, t. K1 D
| memory-actual             | 524288 |1 H7 h, [5 \% a) r
| memory-rss                | 6444   |
. h: d. Y) U$ A. M7 B| tap1fec8fb8-7a_rx         | 22137  |
9 t) d. d  ]% |* v" @' I| tap1fec8fb8-7a_rx_drop    | 0      |
( M7 u" s- s* F5 Y% |; O| tap1fec8fb8-7a_rx_errors  | 0      |
8 [7 I, h. l/ ]3 L3 \| tap1fec8fb8-7a_rx_packets | 166    |) B: s8 E: E  i  {/ E; z9 e
| tap1fec8fb8-7a_tx         | 18032  |
3 ?3 m7 h, [* L$ ^) b| tap1fec8fb8-7a_tx_drop    | 0      |
' I& _+ n* a9 n, [2 d, ?| tap1fec8fb8-7a_tx_errors  | 0      |
% E1 O9 H) y' G& z, A| tap1fec8fb8-7a_tx_packets | 130    |8 D; p% g0 x' W2 }" B" H
| vda_errors                | -1     |, Q8 N, R1 r9 O
| vda_read                  | 2048   |& H& ?' ~7 k0 q' M8 P
| vda_read_req              | 2      |
4 \4 Y# `' H- ^7 @- ~| vda_write                 | 182272 |9 ~  A7 L- K/ e$ }7 y6 }
| vda_write_req             | 74     |) x& Y- r  `3 G' K5 z
+---------------------------+--------+5 z" y3 \  O6 Y
Get summary statistics for each project:
2 R5 N, H; h: L3 f# w
* ?$ W$ {0 A$ ?1 X0 a/ _6 d$ openstack usage list
# P4 X( n. a. J+ m+ ^* |" `; PUsage from 2013-06-25 to 2013-07-24:& a! H4 F" i: ]
+---------+---------+--------------+-----------+---------------+
$ Y# q  F% T5 z, n| Project | Servers | RAM MB-Hours | CPU Hours | Disk GB-Hours |! v! P' d  m& a
+---------+---------+--------------+-----------+---------------+
8 h, q6 M8 u8 d3 o| demo    | 1       | 344064.44    | 672.00    | 0.00          |
, E8 \0 f1 x8 k% X# r7 F# e| stack   | 3       | 671626.76    | 327.94    | 6558.86       |
8 M7 k) b' O% c% G7 K+---------+---------+--------------+-----------+---------------+
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:16 , Processed in 0.020128 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表