GCPInstanceType¶
This parser simply reads the output of command
curl http://metadata.google.internal/computeMetadata/v1/instance/machine-type -H 'Metadata-Flavor: Google'
,
which is used to check the machine type of the Google instance of the host.
For more details, See: - https://cloud.google.com/compute/docs/machine-types - https://cloud.google.com/compute/docs/storing-retrieving-metadata#api_4
-
class
insights.parsers.gcp_instance_type.
GCPInstanceType
(context, extra_bad_lines=None)[source]¶ Bases:
insights.core.CommandParser
Class for parsing the GCP Instance type returned by command
curl -s -H 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/instance/machine-type
,Typical output of this command is:
projects/123456789/machineTypes/n2-highcpu-16
Raises: SkipComponent
-- When content is empty or no parse-able content.ParseException
-- When type cannot be recognized.
-
type
¶ The type of VM instance in GCP, e.g: n2
Type: str
-
size
¶ The size of VM instance in GCP, e.g: highcpu-16
Type: str
-
raw
¶ The fully type string, e.g. ‘n2-highcpu-16’
Type: str
-
raw_line
¶ The fully type string returned by the
curl
commandType: str
Examples
>>> gcp_inst.type 'n2' >>> gcp_inst.size 'highcpu-16' >>> gcp_inst.raw 'n2-highcpu-16'