AzureInstance
The following Azure Instance related parsers are placed in this module:
AzureInstanceID - ‘vmId’ of Azure Instance
AzureInstanceType - ‘vmSize’ of Azure Instance
AzureInstancePlan - ‘plan’ of Azure Instance
AzureInstanceComputeMetadata - ‘compute’ metadata of Azure Instance
AzurePublicIpv4Addresses - list of public IPv4 addresses
- class insights.parsers.azure_instance.AzureInstanceComputeMetadata(context)[source]
Bases:
JSONParserClass for parsing the Azure Instance compute metadata returned by the
azure_instance_compute_metadatadatasource.The datasource collects filtered fields from the Azure Instance Metadata Service endpoint:
http://169.254.169.254/metadata/instance/compute?api-version=2021-12-13&format=jsonThis parser extends JSONParser and provides dictionary-style access to the filtered metadata fields. Available fields depend on the configured filters. More fields would be included according to the custom filters. For example: -
fieldKey1- Field value 1 -fieldKey2- Field value 2Typical content of the filtered JSON data:
{ "fieldKey1": "Field value 1", "fieldKey2": "Field value 2" }
- Raises:
SkipComponent -- When content is empty, curl error occurs, or no filters defined.
Examples
>>> azure_instance_compute_metadata['licenseType'] '' >>> azure_instance_compute_metadata['vmId'] '3c29e210-0669-496f-812a-2fffffffffff' >>> azure_instance_compute_metadata['plan'] {'name': '', 'product': 'planProduct', 'publisher': ''} >>> azure_instance_compute_metadata['plan']['product'] 'planProduct'
- class insights.parsers.azure_instance.AzureInstanceID(*args, **kwargs)[source]
Bases:
CommandParserClass for parsing the Azure Instance type returned by command
curl -s -H Metadata:true http://169.254.169.254/metadata/instance/compute/vmId?api-version=2021-12-13&format=text,Typical output of this command is:
f904ece8-c6c1-4b5c-881f-309b50f25e50
- Raises:
SkipComponent -- When content is empty or no parse-able content.
ParseException -- When ID cannot be recognized.
- id
The instance ID of the VM instance in Azure.
- Type:
str
Examples
>>> azure_id.id 'f904ece8-c6c1-4b5c-881f-309b50f25e50'
- class insights.parsers.azure_instance.AzureInstancePlan(*args, **kwargs)[source]
Bases:
CommandParserClass for parsing the Azure Instance Plan returned by command
curl -s -H Metadata:true http://169.254.169.254/metadata/instance/compute/plan?api-version=2021-12-13&format=json,Typical Output of this command is:
{ "name": "planName", "product": "planProduct", "publisher": "planPublisher" },
- Raises:
SkipComponent -- When content is empty or no parse-able content.
- name
The name of the plan for the VM Instance in Azure, e.g: rhel7
- Type:
str
- product
The product of the plan for the VM Instance in Azure, e.g: RHEL
- Type:
str
- publisher
The publisher of the plan for the VM Instance in Azure, e.g: Red hat
- Type:
str
- raw
The full JSON of the plan returned by the
curlcommand- Type:
str
Examples
>>> azure_plan.name == 'planName' True >>> azure_plan.product == 'planProduct' True >>> azure_plan.publisher == 'planPublisher' True
- class insights.parsers.azure_instance.AzureInstanceType(*args, **kwargs)[source]
Bases:
CommandParserClass for parsing the Azure Instance type returned by command
curl -s -H Metadata:true http://169.254.169.254/metadata/instance/compute/vmSize?api-version=2021-12-13&format=text,Typical output of this command is:
Standard_L64s_v2- Raises:
SkipComponent -- When content is empty or no parse-able content.
ParseException -- When type cannot be recognized.
- type
The type of VM instance in Azure, e.g: Standard
- Type:
str
- size
The size of VM instance in Azure, e.g: L64s, NC12s
- Type:
str
- version
The version of VM instance in Azure, e.g: v2, v3, None for non-version
- Type:
str
- raw
The fully type string returned by the
curlcommand- Type:
str
Examples
>>> azure_type.type 'Standard' >>> azure_type.size 'L64s' >>> azure_type.version 'v2' >>> azure_type.raw 'Standard_L64s_v2'
- class insights.parsers.azure_instance.AzurePublicIpv4Addresses(context, extra_bad_lines=None)[source]
Bases:
CommandParser,listClass for parsing the Azure load balancer JSON data returned by command
curl -sH “Metadata:true” --connect-timeout 5 “http://169.254.169.254/metadata/loadbalancer?api-version=2021-12-13&format=json”
Typical Output of this command is:
{ "loadbalancer": { "publicIpAddresses": [ { "frontendIpAddress": "137.116.118.209", "privateIpAddress": "10.0.0.4" } ], "inboundRules": [], "outboundRules": [] } }
- Raises:
SkipComponent -- When content is empty or curl returned an error.
ParseException -- On JSON parsing error.