Oxalide / vsphere-influxdb-go

Collect VMware vSphere, vCenter and ESXi performance metrics and send them to InfluxDB
GNU General Public License v3.0
216 stars 61 forks source link

Compute usage percentage of datastore. #81

Closed krische closed 6 years ago

krische commented 6 years ago

I would like to display the usage of my datastores as a percentage in Grafana. However, as far as I can tell, it is not possible to "compute" this value in Grafana with the InfluxDB data source with just the capacity and free_space values.

Thus I added another datastore field usage that computes the usage of a datastore as a percentage (0.0 - 1.0) in the script and stores the value in InfluxDB.

sofixa commented 6 years ago

Hi,

Sorry for the late reply!

You can actually calculate the value in Grafana by going into edit mode on the query (the hamburger icon, toggle edit mode) where you can write full InfluxDB queries, like this:

SELECT mean("size-used") / mean("size-total") * 100 FROM "aggr-usage" WHERE "netapp" =~ /^$netapp$/ AND "aggregate" =~ /^$aggregate$/ AND $timeFilter GROUP BY time(5m) fill(null)

(it's an example of percentage query i have)

Cheers, Adrian