Pulling Super Metric Values from the VCF Operations API
- Brock Peterson

- Sep 14
- 2 min read
ESXi Hosts in VCF Operations have dozens of CPU and Memory related metrics, but they don't have any "capacity free" type metrics, so I created my own. My CPU Free (%) Super Metric looks like this:
(100 - {This Resource: cpu|usage_average})My Memory Free (%) Super Metric looks like this.
(100 - {This Resource: mem|usage_average})If you want these Super Metrics, they are available here. Once in place and acitvated in your Policy/s, they'll look like this.

Inspecting the values, you'll see they are what you would expect them to be.
Now, I've been pulling several other out-of-the-box metrics out of VCF Operations via the API, but how do I get these? Well, they present like any other metric on the API surface. Looking up the statkeys on an ESXi Host in my environment, shows the following.

The sm_id, maps to the Super Metric Identifier in the UI.

So, to pull the CPU Free Percentage metric value, I'll be looking for the the one ending in 0972. There it is!

I can see the Super Metric values in the UI, by executing this.

Scroll down to see the metric values.

Which correspond with what we see in the VCF Operations UI.

The Swagger UI also provides the curl command to pull these programatically, your IP, Super Metric Id, and OpsToken will be different.
curl -X 'GET' \
'https://192.168.135.113/suite-api/api/resources/stats?resourceId=5ea8df6b-1b01-4d27-b639-e3cdba4e2ed8&statKey=Super%20Metric%7Csm_c8917409-669f-4e99-b1a0-28be536f0972&statKey=string&_no_links=true' \
-H 'accept: application/json' \
-H 'Authorization: OpsToken 303829ed-8f02-4b76-821b-2663304cc852::813716e1-eb79-4a23-98b4-f5f2178bbf0c'Executing this in my lab looks like this (I added the -k flag to ignore the self-signed certificate).
brockp@P794NX491T ~ % curl -k -X 'GET' \
'https://192.168.135.113/suite-api/api/resources/stats?resourceId=5ea8df6b-1b01-4d27-b639-e3cdba4e2ed8&statKey=Super%20Metric%7Csm_c8917409-669f-4e99-b1a0-28be536f0972&statKey=string&_no_links=true' \
-H 'accept: application/json' \
-H 'Authorization: OpsToken 303829ed-8f02-4b76-821b-2663304cc852::813716e1-eb79-4a23-98b4-f5f2178bbf0c'
{"values":[{"resourceId":"5ea8df6b-1b01-4d27-b639-e3cdba4e2ed8","stat-list":{"stat":[{"timestamps":[1757802006407,1757802315535,1757802619352,1757802937955,1757803260175,1757803608955,1757804033123,1757804338799,1757804639820,1757804952955,1757805261557,1757805564387,1757805864367,1757806166138,1757806467816,1757806805351,1757807106560,1757807410371,1757807814747,1757808131128,1757808440722,1757808743606,1757809067084,1757809374293,1757809681544,1757809990438,1757810297386,1757810601271,1757810930862,1757811344873,1757811647432,1757811954557,1757812257804,1757812566064,1757812885785,1757813204400,1757813504442,1757813819867,1757814119293,1757814442965,1757814763533,1757815182138,1757815499995,1757815804922,1757816113057,1757816423767,1757816724298,1757817033379,1757817335108,1757817649541,1757817952090,1757818254298,1757818558326,1757818865547,1757819173199,1757819478338,1757819778962,1757820095320,1757820401481,1757820709385,1757821012939,1757821318545,1757821624440,1757821930525,1757822246111,1757822605238,1757822905286,1757823209597,1757823520951,1757823849496,1757824152873,1757824460009,1757824774729,1757825074979,1757825386077,1757825688523,1757825990074,1757826294769,1757826605097,1757826912656,1757827240739,1757827540877,1757827853079,1757828163019,1757828470382,1757828774891,1757829082782,1757829406207,1757829719530,1757830033292,1757830349421,1757830685117,1757830986037,1757831290113,1757831595393,1757831939214,1757832251251,1757832551289,1757832893795,1757833207313,1757833521364,1757833825470,1757834161509,1757834478727,1757834783494,1757835088169,1757835392449,1757835696067,1757836000420,1757836342558,1757836646338,1757837035060,1757837337084,1757837640204,1757837949001,1757838279844,1757838582889,1757838886650,1757839192657,1757839507333,1757839811721,1757840149142,1757840585845,1757840905807,1757841228678,1757841559811,1757841884810,1757842190986,1757842493453,1757842797538,1757843119703,1757843421986,1757843728714,1757844033459,1757844382999,1757844690382,1757844997173,1757845318649,1757845625272,1757845936264,1757846242893,1757846547225,1757846873314,1757847198749,1757847502293,1757847835877,1757848150542,1757848450634,1757848770991,1757849071040,1757849371077,1757849673054,1757849978721,1757850289168,1757850610251,1757850918731,1757851218773,1757851573091,1757851878698,1757852178407,1757852478447,1757852780982,1757853081034,1757853399964,1757853700003,1757854002592,1757854312586,1757854612353,1757854914500,1757855220808,1757855521010,1757855836064,1757856138587,1757856443264,1757856742822,1757857046937,1757857347160,1757857652427,1757858008424,1757858308377,1757858618003,1757858953753,1757859287654,1757859590535,1757859890955,1757860190996,1757860492939,1757860855080,1757861155118],"statKey":{"key":"Super Metric|sm_c8917409-669f-4e99-b1a0-28be536f0972"},"intervalUnit":{"quantifier":1},"data":[96.78600311279297,96.77799987792969,96.74466705322266,96.80133056640625,96.81800079345703,96.767333984375,96.73666381835938,96.79133605957031,96.71133422851562,96.50267028808594,96.66533660888672,96.69132995605469,96.60733032226562,96.80266571044922,96.75066375732422,96.77066802978516,96.78466796875,96.78133392333984,96.72000122070312,96.35133361816406,96.67266845703125,96.78466796875,96.85133361816406,96.75066375732422,96.75133514404297,96.79933166503906,96.75599670410156,96.84066772460938,96.55333709716797,96.83999633789062,96.7786636352539,96.73133087158203,96.80599975585938,96.70800018310547,96.72799682617188,96.74466705322266,96.75,96.79467010498047,96.76266479492188,96.74800109863281,96.8153305053711,96.72799682617188,94.7786636352539,94.25066375732422,94.41600036621094,94.27133178710938,94.45066833496094,95.99800109863281,96.73933410644531,96.767333984375,96.84666442871094,96.76066589355469,96.8413314819336,96.78466796875,96.64800262451172,96.7959976196289,96.7586669921875,96.70066833496094,96.74466705322266,96.78266906738281,96.69000244140625,96.82933044433594,96.72799682617188,96.62999725341797,96.7979965209961,96.73666381835938,96.5606689453125,96.80933380126953,96.81133270263672,96.80266571044922,96.68199920654297,96.74333190917969,96.78333282470703,96.75599670410156,96.72866821289062,96.80867004394531,96.7126693725586,96.74199676513672,96.7239990234375,96.85466766357422,96.59266662597656,96.75666809082031,96.79000091552734,96.74866485595703,96.75066375732422,96.79733276367188,96.71733093261719,96.79866790771484,96.76266479492188,96.6673355102539,96.81800079345703,96.79000091552734,96.72866821289062,96.76000213623047,96.83399963378906,96.83200073242188,96.71800231933594,96.79066467285156,96.77933502197266,96.77799987792969,96.76399993896484,96.78866577148438,96.78666687011719,96.63666534423828,96.7040023803711,96.80000305175781,96.8106689453125,96.87466430664062,96.78666687011719,96.73066711425781,96.84333038330078,96.80266571044922,96.59333038330078,96.8106689453125,96.74866485595703,96.71666717529297,96.802001953125,96.86933135986328,96.7760009765625,96.76599884033203,96.86666870117188,96.82599639892578,96.83399963378906,96.72866821289062,96.83399963378906,96.84600067138672,96.76866912841797,96.81466674804688,96.86133575439453,96.77733612060547,96.70066833496094,96.72733306884766,96.66133117675781,96.79866790771484,96.67933654785156,96.74866485595703,96.74866485595703,96.74800109863281,96.74400329589844,96.73600006103516,96.71733093261719,96.78266906738281,96.77666473388672,96.68800354003906,96.83733367919922,96.6546630859375,96.67533111572266,96.7300033569336,96.76667022705078,96.67133331298828,96.75,96.73733520507812,96.75133514404297,96.87999725341797,96.60399627685547,96.7386703491211,96.70532989501953,96.83399963378906,96.8306655883789,96.78800201416016,96.70333099365234,96.8393325805664,96.81666564941406,96.79000091552734,96.80799865722656,96.78466796875,96.79266357421875,96.67066955566406,96.77532958984375,96.66533660888672,96.86399841308594,96.84933471679688,96.7586669921875,96.84400177001953,96.8586654663086,96.85933685302734,96.80733489990234,96.67400360107422,96.78533172607422,96.84266662597656,96.79066467285156,96.72533416748047,96.79066467285156,96.86799621582031,96.7386703491211,96.76799774169922,96.70532989501953,96.8219985961914,96.64666748046875]}]}}]}% If you want to get just the latest values, you an always use the GET /api/resources/stats/latest endpoint, like this.

The Swagger UI provides the related curl as well, so powerful, enjoy!
Comments