Skip to content

Commit 5b290f0

Browse files
authored
[receiver/vcenter] Adds Datacenter metrics (#33933)
**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
1 parent 5c6bf71 commit 5b290f0

17 files changed

+1296
-8
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: vcenterreceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "Adds vCenter metrics at the datacenter level."
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [33607]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
Introduces various datacenter metrics which work by aggregating stats from datastores, clusters, hosts, and VM's.
20+
21+
# If your change doesn't affect end users or the exported elements of any package,
22+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
23+
# Optional: The change log or logs in which this entry should be included.
24+
# e.g. '[user]' or '[user, api]'
25+
# Include 'user' if the change is relevant to end users.
26+
# Include 'api' if there is a change to a library API.
27+
# Default: '[user]'
28+
change_logs: [user]

receiver/vcenterreceiver/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,13 @@ func (vc *vcenterClient) HostSystems(ctx context.Context, containerMoRef vt.Mana
154154
var hosts []mo.HostSystem
155155
err = v.Retrieve(ctx, []string{"HostSystem"}, []string{
156156
"name",
157+
"runtime.powerState",
157158
"summary.hardware.memorySize",
158159
"summary.hardware.numCpuCores",
159160
"summary.hardware.cpuMhz",
160161
"summary.quickStats.overallMemoryUsage",
161162
"summary.quickStats.overallCpuUsage",
163+
"summary.overallStatus",
162164
"vm",
163165
"parent",
164166
}, &hosts)
@@ -210,6 +212,7 @@ func (vc *vcenterClient) VMs(ctx context.Context, containerMoRef vt.ManagedObjec
210212
"summary.quickStats.swappedMemory",
211213
"summary.quickStats.ssdSwappedMemory",
212214
"summary.quickStats.overallCpuUsage",
215+
"summary.overallStatus",
213216
"summary.config.memorySizeMB",
214217
"summary.storage.committed",
215218
"summary.storage.uncommitted",

receiver/vcenterreceiver/documentation.md

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ The number of virtual machines in the cluster.
7272
7373
| Name | Description | Values |
7474
| ---- | ----------- | ------ |
75-
| power_state | The current power state of the virtual machine. | Str: ``on``, ``off``, ``suspended`` |
75+
| power_state | The current power state of the virtual machine. | Str: ``on``, ``off``, ``suspended``, ``unknown`` |
7676
7777
### vcenter.cluster.vm_template.count
7878
@@ -493,6 +493,88 @@ metrics:
493493
enabled: true
494494
```
495495
496+
### vcenter.datacenter.cluster.count
497+
498+
The number of clusters in the datacenter.
499+
500+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
501+
| ---- | ----------- | ---------- | ----------------------- | --------- |
502+
| {clusters} | Sum | Int | Cumulative | false |
503+
504+
#### Attributes
505+
506+
| Name | Description | Values |
507+
| ---- | ----------- | ------ |
508+
| status | The current status of the managed entity. | Str: ``red``, ``yellow``, ``green``, ``gray`` |
509+
510+
### vcenter.datacenter.cpu.limit
511+
512+
The total amount of CPU available to the datacenter.
513+
514+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
515+
| ---- | ----------- | ---------- | ----------------------- | --------- |
516+
| {MHz} | Sum | Int | Cumulative | false |
517+
518+
### vcenter.datacenter.datastore.count
519+
520+
The number of datastores in the datacenter.
521+
522+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
523+
| ---- | ----------- | ---------- | ----------------------- | --------- |
524+
| {datastores} | Sum | Int | Cumulative | false |
525+
526+
### vcenter.datacenter.disk.space
527+
528+
The amount of available and used disk space in the datacenter.
529+
530+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
531+
| ---- | ----------- | ---------- | ----------------------- | --------- |
532+
| By | Sum | Int | Cumulative | false |
533+
534+
#### Attributes
535+
536+
| Name | Description | Values |
537+
| ---- | ----------- | ------ |
538+
| disk_state | The state of storage and whether it is already allocated or free. | Str: ``available``, ``used`` |
539+
540+
### vcenter.datacenter.host.count
541+
542+
The number of hosts in the datacenter.
543+
544+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
545+
| ---- | ----------- | ---------- | ----------------------- | --------- |
546+
| {hosts} | Sum | Int | Cumulative | false |
547+
548+
#### Attributes
549+
550+
| Name | Description | Values |
551+
| ---- | ----------- | ------ |
552+
| status | The current status of the managed entity. | Str: ``red``, ``yellow``, ``green``, ``gray`` |
553+
| power_state | The current power state of the host. | Str: ``on``, ``off``, ``standby``, ``unknown`` |
554+
555+
### vcenter.datacenter.memory.limit
556+
557+
The total amount of memory available to the datacenter.
558+
559+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
560+
| ---- | ----------- | ---------- | ----------------------- | --------- |
561+
| By | Sum | Int | Cumulative | false |
562+
563+
### vcenter.datacenter.vm.count
564+
565+
The number of VM's in the datacenter.
566+
567+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
568+
| ---- | ----------- | ---------- | ----------------------- | --------- |
569+
| {virtual_machines} | Sum | Int | Cumulative | false |
570+
571+
#### Attributes
572+
573+
| Name | Description | Values |
574+
| ---- | ----------- | ------ |
575+
| status | The current status of the managed entity. | Str: ``red``, ``yellow``, ``green``, ``gray`` |
576+
| power_state | The current power state of the virtual machine. | Str: ``on``, ``off``, ``suspended``, ``unknown`` |
577+
496578
### vcenter.host.cpu.capacity
497579
498580
Total CPU capacity of the host system.

receiver/vcenterreceiver/internal/metadata/generated_config.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/vcenterreceiver/internal/metadata/generated_config_test.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)