VMware VS4-STD-C Evaluator Guide - Page 58

Formatting esxcli Output, interface list, formatter, format-param - ++ pair

Page 58 highlights

VMware vSphere 5.0 Evaluation Guide - Volume One Formatting esxcli Output It is common to use the output of the esxcli command as input to another program or for inclusion in a report. To facilitate this, the esxcli command enables you to format and filter the command output in one of three formats: comma-separated values (CSV), key-value pair, or XML. In addition, you can specify which fields to include in the output. In the following example, we need to generate a report showing all the configured interfaces on a host along with the vSwitch and port group to which they are assigned. We start by running the esxcli network ip interface list command, as follows: Figure 70. esxcli network ip interface list Command from the ESXi Shell The output gives us the information we need, but it is very verbose, requiring the user to use the scroll bar to see the data for all the interfaces. Because we need only a summary showing the interface name, vSwitch, and port group, we can refine our command using the --formatter and --format-param options, as follows: TECHNICAL WHITE PAPER / 58

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106

TECHNICAL WHITE PAPER / 58
VMware vSphere 5.0 Evaluation Guide –
Volume One
Formatting esxcli Output
It is common to use the output of the esxcli command as input to another program or for inclusion in a report. To
facilitate this, the esxcli command enables you to format and filter the command output in one of three formats:
comma-separated values (CSV), key-value pair, or XML. In addition, you can specify which fields to include in the
output.
In the following example, we need to generate a report showing all the configured interfaces on a host along
with the vSwitch and port group to which they are assigned. We start by running the
esxcli
network ip
interface list
command, as follows:
Figure 70.
esxcli network ip interface list Command from the ESXi Shell
The output gives us the information we need, but it is very verbose, requiring the user to use the scroll bar to see
the data for all the interfaces. Because we need only a summary showing the interface name, vSwitch, and port
group, we can refine our command using the
--formatter
and
--format-param
options, as follows: