| | 419 | == QMP == |
| | 420 | KVM(というかqemu)には、ハイパーバイザからVMのイベントや情報を取得するQMP(Qemu Messaging Protocol)が提供されています。QMPを利用することにより、様々な情報を取得することができます。下記は利用例です。 |
| | 421 | |
| | 422 | {{{ |
| | 423 | # virsh qemu-monitor-command DOMNAME '{"execute":"query-blockstats"}' |python -mjson.tool |
| | 424 | { |
| | 425 | "id": "libvirt-27", |
| | 426 | "return": [ |
| | 427 | { |
| | 428 | "device": "drive-virtio-disk0", |
| | 429 | "parent": { |
| | 430 | "stats": { |
| | 431 | "flush_operations": 0, |
| | 432 | "flush_total_time_ns": 0, |
| | 433 | "rd_bytes": 0, |
| | 434 | "rd_operations": 0, |
| | 435 | "rd_total_time_ns": 0, |
| | 436 | "wr_bytes": 0, |
| | 437 | "wr_highest_offset": 3860278784, |
| | 438 | "wr_operations": 0, |
| | 439 | "wr_total_time_ns": 0 |
| | 440 | } |
| | 441 | }, |
| | 442 | "stats": { |
| | 443 | "flush_operations": 0, |
| | 444 | "flush_total_time_ns": 0, |
| | 445 | "rd_bytes": 163434496, |
| | 446 | "rd_operations": 9976, |
| | 447 | "rd_total_time_ns": 8262845363, |
| | 448 | "wr_bytes": 13394944, |
| | 449 | "wr_highest_offset": 10235260416, |
| | 450 | "wr_operations": 1439, |
| | 451 | "wr_total_time_ns": 147967748900 |
| | 452 | } |
| | 453 | }, |
| | 454 | { |
| | 455 | "device": "drive-ide0-1-0", |
| | 456 | "parent": { |
| | 457 | "stats": { |
| | 458 | "flush_operations": 0, |
| | 459 | "flush_total_time_ns": 0, |
| | 460 | "rd_bytes": 0, |
| | 461 | "rd_operations": 0, |
| | 462 | "rd_total_time_ns": 0, |
| | 463 | "wr_bytes": 0, |
| | 464 | "wr_highest_offset": 0, |
| | 465 | "wr_operations": 0, |
| | 466 | "wr_total_time_ns": 0 |
| | 467 | } |
| | 468 | }, |
| | 469 | "stats": { |
| | 470 | "flush_operations": 0, |
| | 471 | "flush_total_time_ns": 0, |
| | 472 | "rd_bytes": 49218, |
| | 473 | "rd_operations": 15, |
| | 474 | "rd_total_time_ns": 1671233, |
| | 475 | "wr_bytes": 0, |
| | 476 | "wr_highest_offset": 0, |
| | 477 | "wr_operations": 0, |
| | 478 | "wr_total_time_ns": 0 |
| | 479 | } |
| | 480 | } |
| | 481 | ] |
| | 482 | } |
| | 483 | }}} |
| | 484 | |
| | 485 | QMPについては、あまりドキュメントが整備されていません。QMPの詳細は、下記のスキーマに記載されています |
| | 486 | |
| | 487 | * http://git.qemu-project.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD |