Obtain Tags from VMware Resources ([[inputs.vsphere]])
Use Case
We need the ability to further filter VMware virtual machine resources by Tags. Specifically, we have tags that identify elements like fault domain, product code, owner, etc. This functionality is crucial for configuring custom dashboards in Grafana and enabling customers to view metrics for their specific resources. While the [[inputs.vsphere]] plugin currently supports Custom Attributes, we require similar support for Tags.
The primary feature request is to pull Tags for virtual machines, though ideally, Tags would be accessible on all resources. To manage potential issues with resources containing many Tags, a filter option would be ideal, allowing selection of specific Tags—similar to how Custom Attributes are handled.
Not to cram one more feature in here, but knowing the power status of a VM would be helpful as well. There are certain cases where we may want to filter on the power status of a VM, on/off/suspended. I see the vsphere_vm_power_power_average metric, but I believe that is related to "Average power use in watts".
Expected behavior
The plugin is expected to return VMware resource Tags in the same way it handles Custom Attributes, with an option to filter specific Tags to avoid potential issues.
Actual behavior
Currently, [[inputs.vsphere]] does not support VMware resource Tags.
Additional info
No response
hello
digging in the API call of Vcenter/vsphere i found this url to get the tags (but i see the version maybe too old
https://developer.broadcom.com/xapis/vsphere-automation-api/v6.5-v7.0.0/vcenter/rest/vcenter/vm/vm/tags/get/
maybe it can help.
I believe your correct. Were having someone who knows Go on our end poke at this as well. I believe the code for pulling Custom Attributes is here:
https://github.com/influxdata/telegraf/blob/master/plugins/inputs/vsphere/endpoint.go#L341 https://github.com/influxdata/telegraf/blob/master/plugins/inputs/vsphere/client.go#L355
So, something similar would have to be done with Tags. Will keep you updated on our progress with this.
We ended up moving away from Telegraf and to another exporter written in Python. This project is pretty old and no longer being updated, but works perfect in a K8S container. In addition, its super easy to add additional metrics and for us to maintain vs compiling Go code. Thought I would throw this option out there as an alternative which natively pulls Tags:
https://github.com/pryorda/vmware_exporter