Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add cloud.instance.name into aws ec2 metricset. {pull}20077[20077]
- Add host inventory metrics into aws ec2 metricset. {pull}20171[20171]
- Add `scope` setting for elasticsearch module, allowing it to monitor an Elasticsearch cluster behind a load-balancing proxy. {issue}18539[18539] {pull}18547[18547]
- Add host inventory metrics to azure compute_vm metricset. {pull}20641[20641]

*Packetbeat*

Expand Down
215 changes: 118 additions & 97 deletions x-pack/metricbeat/module/azure/compute_vm/_meta/data.json
Original file line number Diff line number Diff line change
@@ -1,131 +1,152 @@
{
"@timestamp":"2020-08-05T10:36:00.000Z",
"cloud":{
"provider":"azure",
"region":"westeurope",
"instance":{
"id":"/subscriptions/fd675b6f-b5e5-426e-ac45-d1f876d0ffa6/resourceGroups/obs-infrastructure/providers/Microsoft.Compute/virtualMachines/obstestmemleak",
"name":"obstestmemleak"
},
"machine":{
"type":"Standard_B2ms"
}
},
"event":{
"dataset":"azure.compute_vm",
"module":"azure",
"duration":5364973100
},
"metricset":{
"name":"compute_vm",
"period":300000
},
"azure":{
"timegrain":"PT5M",
"resource":{
"type":"Microsoft.Compute/virtualMachines",
"group":"obs-infrastructure",
"tags":{
"vmtest":"value1, value 2",
"vmtest1":"value3"
}
},
"subscription_id":"fd675b6f-b5e5-426e-ac45-d1f876d0ffa6",
"namespace":"Microsoft.Compute/virtualMachines",
"compute_vm":{
"outbound_flows":{
"avg":291.2
"@timestamp": "2017-10-12T08:05:34.853Z",
"azure": {
"compute_vm": {
"cpu_credits_consumed": {
"avg": 0.07
},
"cpu_credits_remaining": {
"avg": 576
},
"outbound_flows_maximum_creation_rate":{
"avg":6
"disk_read_bytes": {
"total": 4863478.41
},
"inbound_flows_maximum_creation_rate":{
"avg":6
"disk_read_operations_per_sec": {
"avg": 0.1
},
"os_per_disk_read_bytes_per_sec":{
"avg":341.35875
"disk_write_bytes": {
"total": 12664679.24
},
"per_disk_read_bytes_per_sec":{
"avg":0
"disk_write_operations_per_sec": {
"avg": 1.8094999999999999
},
"os_disk_queue_depth":{
"avg":0
"inbound_flows": {
"avg": 257
},
"os_per_disk_qd":{
"avg":0
"inbound_flows_maximum_creation_rate": {
"avg": 4
},
"os_disk_read_bytes_per_sec":{
"avg":341.35875
"network_in": {
"total": 1268082
},
"network_in":{
"total":3933481.0
"network_in_total": {
"total": 1463307
},
"network_out":{
"total":7169752.0
"network_out": {
"total": 876498
},
"os_disk_write_operations_per_sec":{
"avg":4.994285714285715
"network_out_total": {
"total": 1517541
},
"percentage_cpu":{
"avg":8.780625
"os_disk_queue_depth": {
"avg": 0.002
},
"cpu_credits_remaining":{
"avg":864
"os_disk_read_bytes_per_sec": {
"avg": 16211.591
},
"network_out_total":{
"total":9249694.0
"os_disk_read_operations_per_sec": {
"avg": 0.2
},
"disk_read_operations_per_sec":{
"avg":0.022857142857142857
"os_disk_write_bytes_per_sec": {
"avg": 42215.592
},
"disk_write_bytes":{
"total":1.759878456E7
"os_disk_write_operations_per_sec": {
"avg": 3.6189999999999998
},
"os_disk_write_bytes_per_sec":{
"avg":73050.70375
"os_per_disk_qd": {
"avg": 0.002
},
"cpu_credits_consumed":{
"avg":0.175
"os_per_disk_read_bytes_per_sec": {
"avg": 16211.591
},
"per_disk_qd":{
"avg":0
"os_per_disk_read_operations_per_sec": {
"avg": 0.2
},
"disk_write_operations_per_sec":{
"avg":2.5221428571428572
"os_per_disk_write_bytes_per_sec": {
"avg": 42215.592
},
"os_per_disk_write_operations_per_sec":{
"avg":4.994285714285715
"os_per_disk_write_operations_per_sec": {
"avg": 3.6189999999999998
},
"per_disk_write_operations_per_sec":{
"avg":0.049999999999999996
"outbound_flows": {
"avg": 257
},
"inbound_flows":{
"avg":291.2
"outbound_flows_maximum_creation_rate": {
"avg": 4
},
"os_disk_read_operations_per_sec":{
"avg":0.045714285714285714
"per_disk_qd": {
"avg": 0
},
"disk_read_bytes":{
"total":81926.52
"per_disk_read_bytes_per_sec": {
"avg": 0
},
"network_in_total":{
"total":4920267.0
"per_disk_read_operations_per_sec": {
"avg": 0
},
"per_disk_read_operations_per_sec":{
"avg":0
"per_disk_write_bytes_per_sec": {
"avg": 0
},
"per_disk_write_bytes_per_sec":{
"avg":277.56
"per_disk_write_operations_per_sec": {
"avg": 0
},
"os_per_disk_write_bytes_per_sec":{
"avg":73050.70375
"percentage_cpu": {
"avg": 3.901
}
},
"namespace": "Microsoft.Compute/virtualMachines",
"resource": {
"group": "obs-test",
"type": "Microsoft.Compute/virtualMachines"
},
"subscription_id": "7657426d-c4c3-44ac-88a2-3b2cd59e6dba",
"timegrain": "PT5M"
},
"cloud": {
"instance": {
"id": "/subscriptions/7657426d-c4c3-44ac-88a2-3b2cd59e6dba/resourceGroups/obs-test/providers/Microsoft.Compute/virtualMachines/test1067",
"name": "test1067"
},
"machine": {
"type": "Standard_B2s"
},
"provider": "azure",
"region": "westeurope"
},
"event": {
"dataset": "azure.compute_vm",
"duration": 115000,
"module": "azure"
},
"host": {
"cpu": {
"pct": 3.901
},
"disk": {
"read": {
"bytes": 4863478.41
},
"os_per_disk_read_operations_per_sec":{
"avg":0.045714285714285714
"write": {
"bytes": 12664679.24
}
},
"id": "/subscriptions/7657426d-c4c3-44ac-88a2-3b2cd59e6dba/resourceGroups/obs-test/providers/Microsoft.Compute/virtualMachines/test1067",
"name": "test1067",
"network": {
"in": {
"bytes": 1463307,
"packets": 1517541
},
"out": {
"bytes": 1268082,
"packets": 876498
}
}
},
"service":{
"type":"azure"
"metricset": {
"name": "compute_vm",
"period": 10000
},
"service": {
"type": "azure"
}
}
}
24 changes: 24 additions & 0 deletions x-pack/metricbeat/module/azure/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,13 @@ func createEvent(timestamp time.Time, metric Metric, metricValues []MetricValue)
event.RootFields.Put("cloud.provider", "azure")
event.RootFields.Put("cloud.region", metric.Resource.Location)
event.RootFields.Put("cloud.instance.name", metric.Resource.Name)
event.RootFields.Put("host.name", metric.Resource.Name)
if metric.Resource.SubId != "" {
event.RootFields.Put("cloud.instance.id", metric.Resource.SubId)
event.RootFields.Put("host.id", metric.Resource.SubId)
} else {
event.RootFields.Put("cloud.instance.id", metric.Resource.Id)
event.RootFields.Put("host.id", metric.Resource.Id)
}
if metric.Resource.Size != "" {
event.RootFields.Put("cloud.machine.type", metric.Resource.Size)
Expand All @@ -200,6 +203,7 @@ func createEvent(timestamp time.Time, metric Metric, metricValues []MetricValue)
metricList.Put(fmt.Sprintf("%s.%s", metricNameString, "count"), *value.count)
}
}
event = addHostFields(event, metricList)
return event, metricList
}

Expand Down Expand Up @@ -229,3 +233,23 @@ func returnAllDimensions(dimensions []Dimension) (bool, []Dimension) {
}
return true, dims
}

func addHostFields(event mb.Event, metricList common.MapStr) mb.Event {
hostFieldTable := map[string]string{
"percentage_cpu.avg": "host.cpu.pct",
"network_in_total.total": "host.network.in.bytes",
"network_in.total": "host.network.out.bytes",
"network_out_total.total": "host.network.in.packets",
"network_out.total": "host.network.out.packets",
"disk_read_bytes.total": "host.disk.read.bytes",
"disk_write_bytes.total": "host.disk.write.bytes",
}

for metricName, hostName := range hostFieldTable {
metricValue, err := metricList.GetValue(metricName)
if err == nil {
event.RootFields.Put(hostName, metricValue)
}
}
return event
}