Skip to content

Commit

Permalink
[receiver/vcenter] Adds Datacenter metrics (#33933)
Browse files Browse the repository at this point in the history
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
The following PR introduces multiple different metrics at a datacenter
level. It takes advantage of processing thats already done at the
cluster, host, vm, and datastore level in order to aggregate datacenter
level metrics.

```
- vcenter.datacenter.cluster.count                 status={red/green/yellow, gray}
- vcenter.datacenter.vm.count                      status={red/green/yellow, gray} power_state={on/off/suspended}
- vcenter.datacenter.datastore.count               status={red/green/yellow, gray}
- vcenter.datacenter.host.count                    status={red/green/yellow, gray} power_state={on/off/standby/unknown}
- vcenter.datacenter.disk.space                    disk_state={used/available}
- vcenter.datacenter.cpu.limit
- vcenter.datacenter.memory.limit
```

**Link to tracking Issue:** #33607

**Testing:** <Describe what testing was performed and which tests were
added.>
Tested against a live environment to make sure all values matched up.
Golden testing files have been updated.

**Documentation:** <Describe the documentation added.>
All documentation was generated through mdatagen
  • Loading branch information
BominRahmani authored Jul 10, 2024
1 parent 5c6bf71 commit 5b290f0
Show file tree
Hide file tree
Showing 17 changed files with 1,296 additions and 8 deletions.
28 changes: 28 additions & 0 deletions .chloggen/add_vcenter_datacenter_metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: vcenterreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Adds vCenter metrics at the datacenter level."

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33607]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
Introduces various datacenter metrics which work by aggregating stats from datastores, clusters, hosts, and VM's.

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
3 changes: 3 additions & 0 deletions receiver/vcenterreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@ func (vc *vcenterClient) HostSystems(ctx context.Context, containerMoRef vt.Mana
var hosts []mo.HostSystem
err = v.Retrieve(ctx, []string{"HostSystem"}, []string{
"name",
"runtime.powerState",
"summary.hardware.memorySize",
"summary.hardware.numCpuCores",
"summary.hardware.cpuMhz",
"summary.quickStats.overallMemoryUsage",
"summary.quickStats.overallCpuUsage",
"summary.overallStatus",
"vm",
"parent",
}, &hosts)
Expand Down Expand Up @@ -210,6 +212,7 @@ func (vc *vcenterClient) VMs(ctx context.Context, containerMoRef vt.ManagedObjec
"summary.quickStats.swappedMemory",
"summary.quickStats.ssdSwappedMemory",
"summary.quickStats.overallCpuUsage",
"summary.overallStatus",
"summary.config.memorySizeMB",
"summary.storage.committed",
"summary.storage.uncommitted",
Expand Down
84 changes: 83 additions & 1 deletion receiver/vcenterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The number of virtual machines in the cluster.
| Name | Description | Values |
| ---- | ----------- | ------ |
| power_state | The current power state of the virtual machine. | Str: ``on``, ``off``, ``suspended`` |
| power_state | The current power state of the virtual machine. | Str: ``on``, ``off``, ``suspended``, ``unknown`` |
### vcenter.cluster.vm_template.count
Expand Down Expand Up @@ -493,6 +493,88 @@ metrics:
enabled: true
```
### vcenter.datacenter.cluster.count
The number of clusters in the datacenter.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {clusters} | Sum | Int | Cumulative | false |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| status | The current status of the managed entity. | Str: ``red``, ``yellow``, ``green``, ``gray`` |
### vcenter.datacenter.cpu.limit
The total amount of CPU available to the datacenter.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {MHz} | Sum | Int | Cumulative | false |
### vcenter.datacenter.datastore.count
The number of datastores in the datacenter.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {datastores} | Sum | Int | Cumulative | false |
### vcenter.datacenter.disk.space
The amount of available and used disk space in the datacenter.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| By | Sum | Int | Cumulative | false |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| disk_state | The state of storage and whether it is already allocated or free. | Str: ``available``, ``used`` |
### vcenter.datacenter.host.count
The number of hosts in the datacenter.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {hosts} | Sum | Int | Cumulative | false |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| status | The current status of the managed entity. | Str: ``red``, ``yellow``, ``green``, ``gray`` |
| power_state | The current power state of the host. | Str: ``on``, ``off``, ``standby``, ``unknown`` |
### vcenter.datacenter.memory.limit
The total amount of memory available to the datacenter.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| By | Sum | Int | Cumulative | false |
### vcenter.datacenter.vm.count
The number of VM's in the datacenter.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {virtual_machines} | Sum | Int | Cumulative | false |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| status | The current status of the managed entity. | Str: ``red``, ``yellow``, ``green``, ``gray`` |
| power_state | The current power state of the virtual machine. | Str: ``on``, ``off``, ``suspended``, ``unknown`` |
### vcenter.host.cpu.capacity
Total CPU capacity of the host system.
Expand Down
28 changes: 28 additions & 0 deletions receiver/vcenterreceiver/internal/metadata/generated_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5b290f0

Please sign in to comment.