To get a gauge where you can view the % used (5673406.4) along with the full value (2658191.29), you should have 2 queries. Query A is the % used and Query B is the full value. Then use a transformation in Grafana “Config From Query Results” and set Query B to be the maximum value displayed on the gauge.
CREATE DEFINER=`root`@`localhost` PROCEDURE `DATASTORAGES_VCENTER`()
BEGIN
DECLARE i INT DEFAULT 0;
DECLARE n INT DEFAULT 0;
SET i=1;
SET n=50;
DROP TEMPORARY TABLE IF EXISTS temp_storagevcenter;
CREATE TEMPORARY TABLE temp_storagevcenter (storage VARCHAR(200));
WHILE i<n DO
INSERT INTO temp_storagevcenter(STORAGE) SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(perfdata, '=', i), ' ', -1) AS storage FROM nagios_servicestatus INNER JOIN nagios_services using (service_object_id) INNER JOIN nagios_hosts using (host_object_id) INNER JOIN nagios_hostgroup_members using (host_object_id) INNER JOIN nagios_hostgroups using (hostgroup_id) WHERE nagios_hostgroups.alias = 'Visual group VMWare' AND nagios_services.display_name LIKE 'Datastore%';
SET i = i + 1;
END WHILE;
SELECT DISTINCT STORAGE FROM temp_storagevcenter WHERE STORAGE REGEXP '^[A-Za-z0-9.,_-]+$';
DROP TEMPORARY TABLE temp_storagevcenter;
End
I called Influx’s free code-writing hotline and it says they are all booked up in 2025, but that they wrote the 7-part tutorial for anyone like yourself that seeks to better understand the language and solve a problem like this.