找回密码
 注册
查看: 656|回复: 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>
' q4 X- s" C* Z# U& E
! @/ l3 b( E! q0 F
Installation of the openstack-client extension: pip install osc-placement
  @$ q# e6 O8 M5 V/ r/ \# n; A" f/ ^; T1 \& P
Ressource-usage of a project:+ X: R( l4 h8 \- b. X: B
8 \  o" Y% e2 B- K$ i
openstack resource usage show --os-placement-api-version 1.9 <PROJECT_ID>
1 l( Z! d0 z( E) B
; R* G7 D; \! j4 ARessource-usage of a specific user within a project:
9 Y' J2 A& _7 h/ ^$ V
$ P8 y' O+ l' Gopenstack resource usage show --os-placement-api-version 1.9 --user-id <USER_ID>  <PROJECT_ID># N4 `& L% O0 T& E

" S3 @3 \- j4 e% y) e+ xExample:
! E% p* q  {4 d$ D2 J
5 f( a" B% v* i3 uopenstack resource usage show --os-placement-api-version 1.9 --user-id 98378bd3cdd94218bf7b6ef4ec80e74a  7733616a513444c2a106243db318b0dd
, g" c8 W* E+ t/ A+----------------+-------+
% D: I  j# M/ |0 {/ ]0 R: Z| resource_class | usage |
  l! r' {! K* G9 v; a3 u+----------------+-------+
$ [. Y% [8 d2 ?/ z& @1 d| VCPU           |     3 |
2 Q0 K' V; _4 l5 v$ q+ ^4 \' w| MEMORY_MB      |   768 |$ s7 A, V, P& E1 t1 M3 t

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-4-19 14:30:10 | 显示全部楼层
Show usage statistics for hosts and instances3 s0 D, _$ y0 c
  : `. V8 ]* x9 p3 y# }0 V
UPDATED: 2022-05-24 16:03
' q" l) R  d* J  j2 m0 xYou can show basic statistics on resource usage for hosts and instances., T) |% c0 T) N) b- W, X

: v  S- I3 a* P0 g; H; h4 B Note
- I5 w% F7 I7 E' z
% O* p* U' h# hFor more sophisticated monitoring, see the Ceilometer project. You can also use tools, such as Ganglia or Graphite, to gather more detailed data./ E3 Q/ i" _: k0 P$ J2 l

" Q; {- ?2 t  I$ p  Y* z$ t4 h; sShow host usage statistics¶
% c, [3 i, c$ n: |( K. hThe following examples show the host usage statistics for a host called devstack.
" j5 s/ }8 U) C) }: ?% w/ \: `% G2 i
List the hosts and the nova-related services that run on them:4 |- Q( k% y4 C* g% \) K

; ?6 o$ J  G0 E$ p+ ?5 c1 z# ]4 O$ openstack host list- i6 s. J6 x  P7 z# ?4 R
+-----------+-------------+----------+
" R6 T1 H4 j; @/ o* u$ h0 t| Host Name | Service     | Zone     |
% v  I1 w" {+ p) L; a7 v& A! E+-----------+-------------+----------+
/ E# x' x- I5 b$ m- e( B| devstack  | conductor   | internal |+ C! v7 ~1 A5 B% U& n
| devstack  | compute     | nova     |( N5 `+ L( G8 {! h: r
| devstack  | network     | internal |
9 d" l( l; W( S- i4 \| devstack  | scheduler   | internal |* F+ S( w" x; `! H
| devstack  | consoleauth | internal |9 @3 U: {. y( X) o0 R
+-----------+-------------+----------+8 K$ b! p* T# A1 j  |* S, }; A% l
Get a summary of resource usage of all of the instances running on the host:" Y9 G% U' H/ n$ W& p5 o1 ]

  C' U* q: R. o- t$ openstack host show devstack1 J- \9 O: v  K, M: `$ |
+----------+----------------------------------+-----+-----------+---------+
1 E! p3 A2 m; \| Host     | Project                          | CPU | MEMORY MB | DISK GB |
* I6 H! B& r! `5 z, a+----------+----------------------------------+-----+-----------+---------+
+ _& a3 H  N/ Y! Q' O* W| devstack | (total)                          | 2   | 4003      | 157     |
' h5 n5 t8 M8 Y| devstack | (used_now)                       | 3   | 5120      | 40      |
: B6 Q& \$ b0 d9 B| devstack | (used_max)                       | 3   | 4608      | 40      |+ j& M; @1 M9 P: x/ |$ P
| devstack | b70d90d65e464582b6b2161cf3603ced | 1   | 512       | 0       |
2 J( X  _& K) J. k| devstack | 66265572db174a7aa66eba661f58eb9e | 2   | 4096      | 40      |
% a$ q, Z( f4 A( k+----------+----------------------------------+-----+-----------+---------+
! U8 j  [! [% W2 IThe CPU column shows the sum of the virtual CPUs for instances running on the host.
; |2 j- X9 P$ s; d- |  X' i4 s
: b8 m, v" ]: I  M- ?' e0 kThe MEMORY MB column shows the sum of the memory (in MB) allocated to the instances that run on the host.
7 t+ R2 n  T' y6 ^8 r& h
& v7 e$ x, Q( V$ BThe DISK GB column shows the sum of the root and ephemeral disk sizes (in GB) of the instances that run on the host.
0 e( C) d, G2 g
2 ]* c& \  y  e. j+ |4 j8 a5 ~The 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.6 x. w) M" \& _. r6 f; {( b
3 _; j* S) L1 S7 r$ F3 k4 E% a4 k( L
The 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.- m' \* w2 T8 {! Z1 |
; \+ s1 [) q. s( Y: @
Note) s1 v6 [2 A  h$ j" P* m

5 M& A+ [7 g' t4 X) {These 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.
  S* ~( ]7 ]' e  a% v! u( P* F* N
; ^4 v: X! x6 D2 u9 H$ e, N9 Y2 |Show instance usage statistics¶9 P# s# j+ k# d. k
Get CPU, memory, I/O, and network statistics for an instance.+ q0 D. \1 l1 v2 L! W9 \% M
9 W5 _, d6 c1 X5 C
List instances:
8 Q" \; X9 @! _5 I0 y5 G4 k7 a* ^6 P% u( V7 c( y; ^
$ openstack server list
& d2 c3 b6 y( u- U8 S# X+----------+----------------------+--------+------------------+--------+----------+# b0 t5 J5 y8 h8 E. w6 o
| ID       | Name                 | Status | Networks         | Image  | Flavor   |
' w! o4 ^8 X" P) J6 I. V5 _1 z. X+----------+----------------------+--------+------------------+--------+----------+
7 U4 M3 q0 C+ k+ w& r9 P: o$ F0 c& g| 84c6e... | myCirrosServer       | ACTIVE | private=10.0.0.3 | cirros | m1.tiny  |8 N9 m- A+ C2 V. O6 O
| 8a995... | myInstanceFromVolume | ACTIVE | private=10.0.0.4 | ubuntu | m1.small |
' n, W6 T' o, D: y+----------+----------------------+--------+------------------+--------+----------+
. z) u8 F: y' D8 a8 jGet diagnostic statistics:
8 L+ ~& j' I( c% e8 i2 a3 v5 U! b) x; W
Note
9 X, S' W/ {1 l. t, n' f* a# D2 N0 v* ?, O1 T9 A, E7 Y
As 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.% K; |& G- t# l! ?/ E. y
. p* p7 q6 g' c4 F& [) V$ p
$ nova diagnostics myCirrosServer
8 _& J' W+ w  q& f6 Z+----------------+------------------------------------------------------------------------+0 i# v/ `6 D1 l% M/ ?" L. H
| Property       | Value                                                                  |: Z7 G, y3 t: ]- ^7 Y5 t
+----------------+------------------------------------------------------------------------+2 g7 D6 J+ X, ?5 ~; `7 t
| config_drive   | False                                                                  |! R" K6 |  W& t8 k1 R1 g
| cpu_details    | []                                                                     |3 g) d) N- x) Y: a
| disk_details   | [{"read_requests": 887, "errors_count": -1, "read_bytes": 20273152,    |
8 N, C3 {" G7 B' Y8 n. u8 ?|                | "write_requests": 89, "write_bytes": 303104}]                          |! W+ x% l9 Q4 i# O$ r
| driver         | libvirt                                                                |* x+ q# o2 ^; n2 d9 Z/ s* M+ K9 p" x
| hypervisor     | qemu                                                                   |0 n! @, k/ R/ `
| hypervisor_os  | linux                                                                  |
+ M; K6 v# k: i2 R$ B# J- s2 g' J| memory_details | {"used": 0, "maximum": 0}                                              |* g* \. H9 X1 z7 w
| nic_details    | [{"rx_packets": 9, "rx_drop": 0, "tx_octets": 1464, "tx_errors": 0,    |3 ?7 b7 R- I: O  R6 [$ v
|                | "mac_address": "fa:16:3e:fa:db:d3", "rx_octets": 958, "rx_rate": null, |. M( p9 [+ _0 B# ]6 r0 v
|                | "rx_errors": 0, "tx_drop": 0, "tx_packets": 9, "tx_rate": null}]       |
$ Z" A1 H$ B/ E/ z9 v2 v| num_cpus       | 0                                                                      |
0 n% c4 b  ]2 y% h* |# i2 x| num_disks      | 1                                                                      |
7 ~2 s0 U1 }% Q; t| num_nics       | 1                                                                      |
% e+ X$ @: o# i( i+ e| state          | running                                                                |
$ Q, M- i3 x: t! O( v% K0 m, G| uptime         | 5528                                                                   |( D' f2 ^4 k# I$ k5 w8 K2 n6 h9 p
+----------------+------------------------------------------------------------------------++ D) C1 q# T% H# V  I4 `
config_drive indicates if the config drive is supported on the instance.* `9 E4 T8 p3 I) n: i' n

, Y$ i2 E( Z! d( _- E4 ~# d# _0 ccpu_details contains a list of details per vCPU.
) @2 T& o) K5 V) A9 ?+ [
1 P; ^4 s) E2 f! {0 U% t2 ]( udisk_details contains a list of details per disk.% u9 T5 v" m5 P, t
* e; k; ]/ P, b( [, F
driver indicates the current driver on which the VM is running.
' a7 _0 g* z9 G# e2 f! p5 _' y9 \3 ]0 i
% ^$ X: b2 A4 a! Nhypervisor indicates the current hypervisor on which the VM is running.
$ y) W% B. S- T, b  {2 f* g
$ W# ]. ~4 b/ h; p2 Snic_details contains a list of details per vNIC.
) F- Z6 ~1 S% \6 ]) c& B) }1 M9 j8 H# a0 P1 G/ X8 J: V
uptime is the amount of time in seconds that the VM has been running.* s, [/ ~6 d8 j7 D6 w+ K
: V& j/ Z0 I4 O8 |6 f9 [5 z. g
' S4 W9 j- Z3 L. ?& |5 X3 Y
Diagnostics prior to v2.48:$ a) M- M) t; j( q! F
$ Y( y, b9 Z' v* l$ I! C
$ nova diagnostics myCirrosServer, X/ V3 y4 u: Z! |
+---------------------------+--------+
' u  p0 b0 a1 m/ I. S0 ^6 p1 X+ C1 Q| Property                  | Value  |% s6 E, N% g4 b) p1 S4 I
+---------------------------+--------+! n$ N) S5 k7 k! U
| memory                    | 524288 |
7 b5 o1 Y+ h# s5 ]- g| memory-actual             | 524288 |9 U, O0 q( `& v* e# q& R1 F5 j3 y2 o
| memory-rss                | 6444   |
% z* T8 B3 Z" ]8 ^| tap1fec8fb8-7a_rx         | 22137  |
9 k  Y' Y, Y& x2 C| tap1fec8fb8-7a_rx_drop    | 0      |
  f8 A& B" ], I0 ^* s# Y: P" O| tap1fec8fb8-7a_rx_errors  | 0      |  m$ b) \  N& C7 P* |& ^) b: C
| tap1fec8fb8-7a_rx_packets | 166    |+ r4 A+ f. b( Z  J) e/ z
| tap1fec8fb8-7a_tx         | 18032  |2 u+ l9 ?5 a( E3 t) k
| tap1fec8fb8-7a_tx_drop    | 0      |
3 q8 {5 q6 [; n& j9 E$ t| tap1fec8fb8-7a_tx_errors  | 0      |2 R$ P" c/ `( c8 U) j3 ]2 l
| tap1fec8fb8-7a_tx_packets | 130    |! c# s- t7 b( n3 ?" U8 G% q, f
| vda_errors                | -1     |
  G- t. F( }' ]/ l% ~; [| vda_read                  | 2048   |
1 v3 s% t+ A7 w8 |; j) m, L3 s1 `| vda_read_req              | 2      |! ?" Q9 |7 ^# G- T/ A
| vda_write                 | 182272 |
+ p0 T  G8 L' J! }% m| vda_write_req             | 74     |4 @: Q1 r/ i* H. h1 F; N7 k1 I
+---------------------------+--------+
/ G% C$ H+ J( V2 NGet summary statistics for each project:
  p9 \, a# k$ z/ p0 a* g) y# Y3 o* e1 l. R+ ~% D' `
$ openstack usage list4 n1 L1 R1 r: {+ t1 |! M& w0 k
Usage from 2013-06-25 to 2013-07-24:1 S9 ^6 T# o5 ~! X5 A1 N  V
+---------+---------+--------------+-----------+---------------+7 H7 i5 g( q" C, F
| Project | Servers | RAM MB-Hours | CPU Hours | Disk GB-Hours |  b2 Y! J8 J2 @6 `5 c6 q
+---------+---------+--------------+-----------+---------------+( b5 ~0 ?  [2 O' [% e' |1 c; Q, r
| demo    | 1       | 344064.44    | 672.00    | 0.00          |
1 \5 a& l- }# d% w# u0 X| stack   | 3       | 671626.76    | 327.94    | 6558.86       |) A- O4 S% e5 H1 W9 I. e
+---------+---------+--------------+-----------+---------------+
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 02:19 , Processed in 0.020817 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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