docs(inputs.vsphere): Update inventory docs & removed unnecessary if-statement (#12819)

This commit is contained in:
Pontus Rydin 2023-03-09 10:27:31 -05:00 committed by GitHub
parent 501e920ef1
commit 405c1d97d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 19 deletions

View File

@ -344,6 +344,22 @@ We can extend this to looking at a cluster level:
`/DC0/host/Cluster1/*/hadoop*`. This selects any VM matching "hadoop*" on any
host in Cluster1.
#### Inventory paths and top-level folders
If your datacenter is in a folder and not directly below the inventory root, the
default inventory paths will not work. This is intentional, since recursive
wildcards may be slow in very large environments.
If your datacenter is in a folder, you have two options:
1. Explicitly include the folder in the path. For example, if your datacenter is in
a folder named ```F1``` you could use the following path to get to your hosts:
```/F1/MyDatacenter/host/**```
2. Use a recursive wildcard to search an arbitrarily long chain of nested folders. To
get to the hosts, you could use the following path: ```/**/host/**```. Note that
this may run slowly in a very large environment, since a large number of nodes will
be traversed.
## Performance Considerations
### Realtime vs. historical metrics
@ -354,8 +370,6 @@ metrics.
* Realtime metrics: Available at a 20 second granularity. These metrics are stored in memory and are very fast and cheap to query. Our tests have shown that a complete set of realtime metrics for 7000 virtual machines can be obtained in less than 20 seconds. Realtime metrics are only available on **ESXi hosts** and **virtual machine** resources. Realtime metrics are only stored for 1 hour in vCenter.
* Historical metrics: Available at a (default) 5 minute, 30 minutes, 2 hours and 24 hours rollup levels. The vSphere Telegraf plugin only uses the most granular rollup which defaults to 5 minutes but can be changed in vCenter to other interval durations. These metrics are stored in the vCenter database and can be expensive and slow to query. Historical metrics are the only type of metrics available for **clusters**, **datastores**, **resource pools** and **datacenters**.
For more information, refer to the vSphere [documentation][vsphere-16].
This distinction has an impact on how Telegraf collects metrics. A single
instance of an input plugin can have one and only one collection interval, which
means that you typically set the collection interval based on the most
@ -416,8 +430,6 @@ instance. For example:
collect_concurrency = 3
```
[vsphere-16]: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.pg.doc_50%2FPG_Ch16_Performance.18.2.html
### Configuring max_query_metrics setting
The `max_query_metrics` determines the maximum number of metrics to attempt to

View File

@ -155,22 +155,20 @@ func (f *Finder) descend(ctx context.Context, root types.ManagedObjectReference,
var inc int
if recurse {
inc = 0 // By default, we stay on this token
if !isLeaf {
// Lookahead to next token.
if matchName(tokens[pos+1], c.PropSet) {
// Are we looking ahead at a leaf node that has the wanted type?
// Rerun the entire level as a leaf. This is needed since all properties aren't loaded
// when we're processing non-leaf nodes.
if pos == len(tokens)-2 {
if c.Obj.Type == resType {
rerunAsLeaf = true
continue
}
} else if _, ok := containers[c.Obj.Type]; ok {
// Tokens match and we're looking ahead at a container type that's not a leaf
// Consume this token and the next.
inc = 2
// Lookahead to next token.
if matchName(tokens[pos+1], c.PropSet) {
// Are we looking ahead at a leaf node that has the wanted type?
// Rerun the entire level as a leaf. This is needed since all properties aren't loaded
// when we're processing non-leaf nodes.
if pos == len(tokens)-2 {
if c.Obj.Type == resType {
rerunAsLeaf = true
continue
}
} else if _, ok := containers[c.Obj.Type]; ok {
// Tokens match and we're looking ahead at a container type that's not a leaf
// Consume this token and the next.
inc = 2
}
}
} else {