1.. _vmware_rest_vm_tool_information:
2
3*****************************************************
4How to get information from a running virtual machine
5*****************************************************
6
7.. contents::
8  :local:
9
10
11Introduction
12============
13
14This section shows you how to collection information from a running virtual machine.
15
16Scenario requirements
17=====================
18
19You've already followed :ref:`vmware_rest_run_a_vm` and your virtual machine runs VMware Tools.
20
21How to collect information
22==========================
23
24In this example, we use the ``vcenter_vm_guest_*`` module to collect information about the associated resources.
25
26Filesystem
27----------
28
29Here we use ``vcenter_vm_guest_localfilesystem_info`` to retrieve the details
30about the filesystem of the guest. In this example we also use a ``retries``
31loop. The VMware Tools may take a bit of time to start and by doing so, we give
32the VM a bit more time.
33
34.. literalinclude:: task_outputs/Get_guest_filesystem_information.task.yaml
35
36Result
37______
38
39.. literalinclude:: task_outputs/Get_guest_filesystem_information.result.json
40
41Guest identity
42--------------
43
44You can use ``vcenter_vm_guest_identity_info`` to get details like the OS family or the hostname of the running VM.
45
46.. literalinclude:: task_outputs/Get_guest_identity_information.task.yaml
47
48Result
49______
50
51.. literalinclude:: task_outputs/Get_guest_identity_information.result.json
52
53Network
54-------
55
56``vcenter_vm_guest_networking_info`` will return the OS network configuration.
57
58.. literalinclude:: task_outputs/Get_guest_networking_information.task.yaml
59
60Result
61______
62
63.. literalinclude:: task_outputs/Get_guest_networking_information.result.json
64
65Network interfaces
66------------------
67
68``vcenter_vm_guest_networking_interfaces_info`` will return a list of NIC configurations.
69
70See also :ref:`vmware_rest_attach_a_network`.
71
72.. literalinclude:: task_outputs/Get_guest_network_interfaces_information.task.yaml
73
74Result
75______
76
77.. literalinclude:: task_outputs/Get_guest_network_interfaces_information.result.json
78
79Network routes
80--------------
81
82Use ``vcenter_vm_guest_networking_routes_info`` to explore the route table of your vitual machine.
83
84.. literalinclude:: task_outputs/Get_guest_network_routes_information.task.yaml
85
86Result
87______
88
89.. literalinclude:: task_outputs/Get_guest_network_routes_information.result.json
90
91