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

AzurePublicIpv4Addresses - list of public IPv4 addresses

class insights.parsers.azure_instance.AzureInstanceID(context, extra_bad_lines=None)[source]

Bases: CommandParser

Class 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.

id

The instance ID of the VM instance in Azure.

Type:

str

Examples

>>> azure_id.id
'f904ece8-c6c1-4b5c-881f-309b50f25e50'
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.azure_instance.AzureInstancePlan(context, extra_bad_lines=None)[source]

Bases: CommandParser

Class 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 curl command

Type:

str

Examples

>>> azure_plan.name == 'planName'
True
>>> azure_plan.product == 'planProduct'
True
>>> azure_plan.publisher == 'planPublisher'
True
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.azure_instance.AzureInstanceType(context, extra_bad_lines=None)[source]

Bases: CommandParser

Class 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:
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 curl command

Type:

str

Examples

>>> azure_type.type
'Standard'
>>> azure_type.size
'L64s'
>>> azure_type.version
'v2'
>>> azure_type.raw
'Standard_L64s_v2'
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.azure_instance.AzurePublicIpv4Addresses(context, extra_bad_lines=None)[source]

Bases: CommandParser, list

Class 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:
parse_content(content)[source]

This method must be implemented by classes based on this class.