Vault usage comes up a lot when I talk to partners and customers. VSPC shows how much each VDC Vault is using right now, but not how that’s changed over time, and the API has no usage totals per subscription, which is how Vault is sold. I was also curious how far the VSPC API could go on its own, so I wanted to see whether I could build that view from it, keep the history for as long as I like, and answer questions like “which subscription grew the most this month” and “which vaults are getting close to their quota”.
I already run InfluxDB and Grafana in my lab, so the only new piece is a Telegraf container that polls the VSPC API. It ended up being configuration only, with no scripts and no custom image. Everything in this post (the Telegraf config, the compose snippet, and the Grafana data source and dashboard) is in my scripts repo on GitHub.
If you haven’t used the VSPC API before, part 1 of my VSPC Vault API series covers creating a REST API key. This only needs a read-only key.

Finding Vault Usage in the VSPC API#
Everything comes from one call. GET /vdcVault/storageVaults lists the storage vaults, and the expand parameter embeds each vault’s VDC tenant and Vault subscription in the same response.
GET https://vspc.domain.example/api/v3/vdcVault/storageVaults?expand=VdcVaultSubscription,VdcVaultTenant
Authorization: Bearer <read-only API key>
x-api-version: 3.6.2Unlike most list endpoints in the VSPC API, this one isn’t paged. The spec has no limit or offset for it and the response has no paging metadata, so a single request returns every vault (all 177 in my lab, in well under a second). That matters later, because it means a plain HTTP request is enough to collect everything.
Here’s one vault from the response, trimmed to the fields I use:
{
"data": [
{
"instanceUid": "16141077-df3f-4d8d-8c08-b7a2063b000c",
"name": "Alpha - Vault 01 - AUE",
"platform": "Azure",
"dataCenterId": "australiaeast",
"status": "Active",
"isReadOnly": false,
"consumedSpace": 2190433615790,
"storageQuota": null,
"quotaEnforced": false,
"_embedded": {
"tenant": {
"name": "Alpha",
"organizationUid": "b5e8480a-d3dd-4a47-b108-781d1e644773"
},
"subscription": {
"name": "Demo MSP - Advanced Core - Azure Edition",
"edition": "AdvancedCore"
}
}
}
]
}consumedSpace and storageQuota are in bytes. A storageQuota of null means the vault is unlimited, which is most of them (173 of the 177 in my lab). The tenant’s organizationUid is the VSPC company it’s mapped to, and is also null if the tenant hasn’t been mapped.
There’s no usage total for a subscription anywhere in the API. The subscriptions and tenants endpoints don’t have one, so the only way to see consumption per subscription is to add up the vaults yourself. That’s the main thing the dashboard does.
Collecting It with Telegraf#
My first plan was PowerShell. I already had the functions from the VSPC Vault series, so a script that called the API and printed InfluxDB line protocol for Telegraf’s exec input looked like the obvious route. The catch is that the stock Telegraf image doesn’t include PowerShell. I’d have needed to build and maintain a custom image, or run Telegraf on the VSPC server itself with PowerShell 7 installed, and I didn’t want either.
Because the endpoint isn’t paged, I didn’t need a script at all. Telegraf’s http input can make the request, and the json_v2 parser can turn each vault into a point. The whole collector is one telegraf.conf on the stock telegraf image.
The first half of the config sets the interval, reads secrets and makes the request:
[agent]
# Usage stats update about once a day. 30 minutes also picks up new and removed vaults quickly
interval = "30m"
round_interval = true
omit_hostname = true
# Reads Docker secrets from /run/secrets
[[secretstores.docker]]
id = "docker"
[[inputs.http]]
urls = ["https://${VSPC_SERVER}/api/v3/vdcVault/storageVaults?expand=VdcVaultSubscription,VdcVaultTenant"]
# Sent as "Authorization: Bearer <key>"
token = "@{docker:vspc_api_key}"
headers = {"x-api-version" = "3.6.2"}
timeout = "60s"
# Uncomment for a lab VSPC with a self-signed certificate
# insecure_skip_verify = true
# Drop the url tag the http input adds by default
tagexclude = ["url"]
data_format = "json_v2"Vault usage stats are only updated roughly once every 24 hours, the same as the Vault dashboard in the VDC portal, so collecting every 30 minutes doesn’t make the numbers any fresher. I chose it so new and removed vaults show up on the dashboard within half an hour, and the daily stats update lands soon after it happens. It’s a single request, so it costs VSPC almost nothing.
The API key comes from a Docker secret through Telegraf’s docker secret store, so it never sits in the config file or an environment variable. This is where I lost the most time. My compose secret was called vspc-api-key, and every request came back 401 Unauthorized. The clue was a warning further up the log, Secret "@{docker:vspc-api-key}" contains invalid character(s). Telegraf only accepts letters, digits and underscores in secret names, so it was sending the reference as the literal token. Renaming the secret to vspc_api_key fixed it.
The second half parses the response:
[[inputs.http.json_v2]]
measurement_name = "vspc_vault"
# One point per vault. Nested keys are flattened with underscores,
# so the embedded tenant's name arrives as _embedded_tenant_name.
[[inputs.http.json_v2.object]]
path = "data"
included_keys = [
"name", "instanceUid", "platform", "dataCenterId",
"consumedSpace", "storageQuota", "quotaEnforced", "isReadOnly", "status",
"_embedded_tenant_name", "_embedded_tenant_organizationUid",
"_embedded_subscription_name", "_embedded_subscription_edition",
]
tags = [
"name", "instanceUid", "platform", "dataCenterId",
"_embedded_tenant_name", "_embedded_tenant_organizationUid",
"_embedded_subscription_name", "_embedded_subscription_edition",
]
[inputs.http.json_v2.object.fields]
consumedSpace = "int"
storageQuota = "int"
[inputs.http.json_v2.object.renames]
name = "vault"
instanceUid = "vault_id"
platform = "cloud"
dataCenterId = "datacenter"
_embedded_tenant_name = "tenant"
_embedded_tenant_organizationUid = "organization_uid"
_embedded_subscription_name = "subscription"
_embedded_subscription_edition = "edition"
consumedSpace = "consumed_bytes"
storageQuota = "quota_bytes"
quotaEnforced = "quota_enforced"
isReadOnly = "read_only"The object parser treats each item in data as one point and flattens the _embedded objects into underscore-separated keys. included_keys throws away everything else in the response, tags decides which keys become tags rather than fields, and renames swaps the API’s camelCase for names that read better in queries. I set the byte counts to int explicitly, because otherwise they’re stored as floats.
Nulls are the part I checked before trusting it. I ran Telegraf locally against the API and confirmed json_v2 simply leaves a null out of the point. An unlimited vault gets no quota_bytes field, rather than a zero that would look like a full vault, and a tenant that isn’t mapped to a VSPC company gets no organization_uid tag.
json_v2 can’t do arithmetic, so the quota percentage comes from a five-line Starlark processor:
[[processors.starlark]]
namepass = ["vspc_vault"]
source = '''
def apply(metric):
quota = metric.fields.get("quota_bytes")
# Unlimited vaults have no quota_bytes, so they get no percentage
if quota:
metric.fields["quota_percent"] = metric.fields["consumed_bytes"] * 100.0 / quota
return metric
'''
[[outputs.influxdb_v2]]
urls = ["http://influxdb:8086"]
token = "@{docker:influxdb2_telegraf_token}"
organization = "${INFLUX_ORG}"
bucket = "vspc"Each collection writes one vspc_vault point per vault, with these tags and fields:
| Tags | Fields |
|---|---|
vault, vault_id, tenant, organization_uid, subscription, edition, cloud, datacenter | consumed_bytes, quota_bytes, quota_percent, quota_enforced, read_only, status |
Before wiring it up to InfluxDB, you can check the parsing with --test, which makes one request and prints the points instead of writing them. The secret store needs /run/secrets, so for a local test comment out the secretstores and outputs sections and point token at an environment variable:
# With token = "${VSPC_API_KEY}" in telegraf.conf
VSPC_SERVER=vspc.domain.example VSPC_API_KEY=... telegraf --config telegraf.conf --testIf you’d rather have the same data in PowerShell, I’ve also added Get-VspcVaultUsage to VspcVault.ps1. It makes the same call and also resolves each tenant’s VSPC company name, which is handy for a one-off report.
Wiring It into InfluxDB and Grafana#
The data goes into its own vspc bucket in InfluxDB 2, with a token that can only write to that bucket for Telegraf:
influx bucket create --name vspc --org my-org --retention 0
influx auth create --org my-org --write-bucket <bucket-id> --description telegraf-vspcI query it from Grafana with InfluxQL rather than Flux. Flux is in maintenance mode, and InfluxQL also works on InfluxDB 3 if I move later. InfluxQL queries go through InfluxDB 2’s v1 compatibility API, which finds the bucket through a database and retention policy (DBRP) mapping. I created one explicitly so the vspc database always points at this bucket, plus a second token for Grafana that can only read it:
influx v1 dbrp create --org my-org --db vspc --rp autogen --bucket-id <bucket-id> --default
influx auth create --org my-org --read-bucket <bucket-id> --description grafana-vspcTelegraf joins my existing compose file as one more service. Each token and the API key are compose secrets, saved to files next to the compose file:
services:
telegraf:
image: telegraf:1.40
container_name: telegraf-vspc
restart: unless-stopped
environment:
VSPC_SERVER: vspc.domain.example
INFLUX_ORG: my-org
secrets:
- vspc_api_key
- influxdb2_telegraf_token
volumes:
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
depends_on:
- influxdb2
secrets:
vspc_api_key:
file: ./.env.vspc-api-key
influxdb2_telegraf_token:
file: ./.env.influxdb2-telegraf-token
influxdb2_grafana_token:
file: ./.env.influxdb2-grafana-tokenCompose mounts secret files with the same permissions they have on the host, and Telegraf runs as a non-root user inside the container. If the files are only readable by your own account, Telegraf can’t read the key, so make them readable (for example chmod 644) or set user: on the service.
On the Grafana side, I provisioned the data source from a file rather than clicking through the UI, so it’s rebuilt the same way every time the container is. The read-only token comes from a secret through Grafana’s $__file{} syntax, so it isn’t in the file or in Grafana’s database:
apiVersion: 1
datasources:
- name: VSPC (InfluxDB)
uid: vspc-influxdb
type: influxdb
access: proxy
url: http://influxdb:8086
jsonData:
version: InfluxQL
dbName: vspc
httpMode: GET
# Telegraf collects every 30 minutes, so don't let Grafana group by anything shorter
timeInterval: 30m
# InfluxDB 2 accepts a token for InfluxQL queries through the v1 compatibility API
httpHeaderName1: Authorization
secureJsonData:
httpHeaderValue1: Token $__file{/run/secrets/influxdb2_grafana_token}The grafana service then needs the provisioning folders mounted and the token secret added:
grafana:
volumes:
- ./grafana-provisioning/datasources:/etc/grafana/provisioning/datasources:ro
- ./grafana-provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
secrets:
- influxdb2_grafana_tokentimeInterval is easy to miss. Without it, Grafana picks an interval based on the time range and panel width, which can be shorter than 30 minutes. Most of those buckets then have no data, and my first look in Explore showed scattered dots instead of lines. Setting it to the collection interval stops Grafana from going any finer.
One more thing caught me out. After recreating the Grafana container with the new data source, the data source picker didn’t show it, and the dashboard said “Data source not found”. The browser tab had cached the old list. A hard reload fixed it.
Building the Dashboard#
The dashboard is provisioned too, from a JSON file and a small provider definition that puts it in a VSPC folder. Grafana lets you edit a provisioned dashboard in the UI, but your changes are overwritten whenever the file changes, so I make changes in the JSON. If you don’t want to provision it, you can import the JSON by hand. It expects a data source with the UID vspc-influxdb.
There are three variables at the top for subscription, tenant and cloud. The tenant list is filtered by the selected subscription. Each one allows multiple values with a custom “All” value of .*, so every query can filter with a regex like "tenant" =~ /^$tenant$/ and “All” matches everything.
Nearly every panel is built on the same query pattern, so it’s worth explaining once. To get a total at each point in time, you need each vault’s latest value in each interval, and then the sum of those. In InfluxQL that’s a subquery:
SELECT sum("c") FROM (
-- Each vault's latest consumption in each interval
SELECT last("consumed_bytes") AS c FROM "vspc_vault"
WHERE "subscription" =~ /^$subscription$/ AND "tenant" =~ /^$tenant$/ AND "cloud" =~ /^$cloud$/ AND $timeFilter
GROUP BY time($__interval), "vault_id", "subscription"
)
-- Then add the vaults up, per subscription
WHERE $timeFilter
GROUP BY time($__interval), "subscription" fill(none)The subquery groups by vault_id rather than the vault name. Vault names don’t have to be unique across tenants, and in my lab there are several vaults with the same name. Grouping by name merged them, and Explore showed 168 series for 177 vaults.
My first version had fill(previous) on the subquery, to carry a vault’s last value forward if a collection was missed. On InfluxDB 2 that broke the outer sum(). Instead of one total per interval, it returned one row per vault per interval, nearly 4,800 rows for a few hours of data. The single-value panels picked one of those rows, so the growth panel showed the whole 8.96 TiB as growth, and one subscription’s growth bar was bigger than the subscription. With every vault collected in the same request there’s nothing to fill, so I removed it, and the sums came out right.
The rest of the panels are variations on that query:
- Total consumed, growth over the selected time range, the number of vaults, vaults at 80% of their quota or more, and read-only vaults
- Consumption by subscription over time, stacked, which is the per-subscription total the API doesn’t give you
- Current consumption by edition and by cloud, and growth by subscription
- The top 10 vaults, using
top("c", 10)with the vault, tenant and subscription tags returned alongside - Quota used for every vault that has a quota, with thresholds at 80% and 90%
- Consumption per vault over time, which is most useful after filtering to one tenant
The panels that show current values (the counts, the top 10, quota used and the edition and cloud breakdowns) only look at the last hour, which always includes the most recent collection. They show the current state no matter what time range you pick.

You can explore the dashboard snapshot with the same demo data, and hover over the panels to see the values behind them.
Leaving Pulse for Later#
VSPC also has a set of Pulse endpoints, and I looked at them while building this. /pulse/monthlyUsages covers every workload a provider reports through VCSP Pulse, not just Vault, so it was tempting to put everything on one dashboard.
It doesn’t fit this one, though. Monthly usage comes back per Pulse tenant and product, in whole TB per month. /pulse/tenants resolves those tenant IDs to names (and to the VSPC company, if the tenant has been mapped), but there’s nothing about vaults or subscriptions, so it doesn’t line up with the per-vault data here. It’s a licensing view of usage rather than a capacity one.
Monthly Pulse usage per product and per company would make a good dashboard of its own, and it can use the same Telegraf, InfluxDB and Grafana stack, so it’s one I’d like to come back to in a future post. For now, this one answers the questions I kept hearing about subscription totals, growth and quotas, using nothing but the VSPC API and a stock Telegraf container.




