{"id":13796067,"url":"https://github.com/equelin/vsanmetrics","last_synced_at":"2026-03-12T20:12:10.689Z","repository":{"id":55496829,"uuid":"132108260","full_name":"equelin/vsanmetrics","owner":"equelin","description":"Export VMware vSAN metrics to InfluxDB ","archived":false,"fork":false,"pushed_at":"2020-12-26T23:08:43.000Z","size":62,"stargazers_count":16,"open_issues_count":5,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-10T01:14:01.795Z","etag":null,"topics":["influxdb","vmware","vsan"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/equelin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-04T07:58:23.000Z","updated_at":"2025-07-07T01:41:42.000Z","dependencies_parsed_at":"2022-08-15T01:50:18.367Z","dependency_job_id":null,"html_url":"https://github.com/equelin/vsanmetrics","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/equelin/vsanmetrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equelin%2Fvsanmetrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equelin%2Fvsanmetrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equelin%2Fvsanmetrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equelin%2Fvsanmetrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/equelin","download_url":"https://codeload.github.com/equelin/vsanmetrics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equelin%2Fvsanmetrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30441857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["influxdb","vmware","vsan"],"created_at":"2024-08-03T23:01:05.758Z","updated_at":"2026-03-12T20:12:10.664Z","avatar_url":"https://github.com/equelin.png","language":"Python","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# vsanmetrics\n\nvsanmetrics is a tool written in Python for collecting usage and performance metrics and health status from a VMware vSAN cluster and translating them in [InfluxDB's line protocol](https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md).\n\nIt can be useful to send metrics in a time-serie database like [InfluxDB](https://www.influxdata.com/) or [Graphite](https://graphiteapp.org/) with the help of [Telegraf](https://www.influxdata.com/time-series-platform/telegraf/) and then display metrics in [Grafana](https://grafana.com/).\n\nA detailed list of all entities types and metrics is available [here](entities.md)\n\n## Prerequisites\n\n- Python 3 (This script has been tested with python 3.6.7)\n- [Pyvmomi](https://github.com/vmware/pyvmomi#installing) python's librairy\n\n\u003e You can install the librairies with pip -\u003e `pip install -r requirements.txt`\n\n- [VMware vSAN Management SDK for python](https://code.vmware.com/web/sdk/6.7.0/vsan-python)\n\n\u003e To use the vSAN Python bindings, download the SDK and place `vsanmgmtObjects.py` and `vsanapiutis.py` on a path where your Python applications can import library or in the same folder than `vsanmetrics.py`.\n\n## Installation\n\n- Download the script `vsanmetrics.py`\n- On linux box, make the script executable\n\n```bash\n% chmod +x ./vsanmetrics\n```\n\n- Run the script with the -h parameter to check if it works\n\n```bash\n% ./vsanmetrics -h\n\nusage: vsanmetrics.py [-h] -s VCENTER [-o PORT] -u USER [-p PASSWORD] -c\n                      CLUSTERNAME [--performance] [--capacity] [--health]\n                      [--skipentitytypes SKIPENTITYTYPES]\n\nExport vSAN cluster performance and storage usage statistics to InfluxDB line\nprotocol\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -s VCENTER, --vcenter VCENTER\n                        Remote vcenter to connect to\n  -o PORT, --port PORT  Port to connect on\n  -u USER, --user USER  User name to use when connecting to vcenter\n  -p PASSWORD, --password PASSWORD\n                        Password to use when connecting to vcenter\n  -c CLUSTERNAME, --cluster_name CLUSTERNAME\n                        Cluster Name\n  --performance         Output performance metrics\n  --capacity            Output storage usage metrics\n  --health              Output cluster health status\n  --skipentitytypes SKIPENTITYTYPES\n                        List of entity types to skip. Separated by a comma\n  --cachefolder CACHEFOLDER\n                        Folder where the cache files are stored\n  --cacheTTL CACHETTL   TTL of the object inventory cache\n```\n\n## Usage\n\nRun the script against a vSAN cluster to gather the storage usage statistics.\n\n```bash\n% ./vsanmetrics.py -s vcenter.example.com -u administrator@vsphere.local -p MyAwesomePassword -c VSAN-CLUSTER --capacity\n\ncapacity_global,scope=global,vcenter=vcenter.example.com,cluster=VSAN-CLUSTER totalCapacityB=7200999211008,freeCapacityB=1683354550260 1525422314084382976\ncapacity_summary,scope=summary,vcenter=vcenter.example.com,cluster=VSAN-CLUSTER temporaryOverheadB=0,physicalUsedB=2636212338688,primaryCapacityB=2688980877312,usedB=5380734189568,reservedCapacityB=3607749040540,overReservedB=2744521850880,provisionCapacityB=6986210377728,overheadB=2828663783436 1525422314084382976\ncapacity_vmswap,scope=vmswap,vcenter=vcenter.example.com,cluster=VSAN-CLUSTER temporaryOverheadB=0,physicalUsedB=8422162432,primaryCapacityB=177330978816,usedB=355240771584,reservedCapacityB=355089776640,overReservedB=346818609152,overheadB=177909792768 1525422314084382976\ncapacity_checksumOverhead,scope=checksumOverhead,vcenter=vcenter.example.com,cluster=VSAN-CLUSTER temporaryOverheadB=0,physicalUsedB=0,primaryCapacityB=0,usedB=8858370048,reservedCapacityB=0,overReservedB=0,overheadB=8858370048 1525422314084382976\n```\n\nRun the script against a vSAN cluster to gather performance statistics.\n\n```bash\n% ./vsanmetrics.py -s vcenter.example.com -u administrator@vsphere.local -p MyAwesomePassword -c VSAN-CLUSTER --performance\n\ncluster-domclient,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,uuid=52b29fa6-9cb9-6d67-31ed-4bf8f2dd9294 oio=7.0,throughputRead=40883.0,latencyAvgWrite=11218.0,latencyAvgRead=985.0,iopsRead=1.0,throughputWrite=2819.0,congestion=0.0,iopsWrite=0.0 1525462200000000000\ncluster-domcompmgr,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,uuid=52b29fa6-9cb9-6d67-31ed-4bf8f2dd9294 oio=6.0,throughputRecWrite=0.0,latencyAvgRecWrite=0.0,throughputRead=45309.0,latencyAvgWrite=1335.0,tputResyncRead=0.0,latencyAvgRead=935.0,iopsRead=1.0,throughputWrite=14476.0,latAvgResyncRead=0.0,iopsResyncRead=0.0,iopsRecWrite=0.0,iopsWrite=2.0,congestion=0.0 1525462200000000000\nhost-domclient,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,hostname=esx01.example.com,uuid=5ae60a2b-fe13-25dd-1f19-005056a3a442 oio=1.0,throughputRead=95.0,latencyAvgWrite=0.0,latencyAvgRead=340.0,iopsRead=0.0,clientCacheHitRate=0.0,throughputWrite=0.0,congestion=0.0,iopsWrite=0.0,clientCacheHits=0.0 1525462200000000000\nhost-domclient,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,hostname=esx03.example.com,uuid=5ae750e2-bc6d-487b-1283-005056a38be2 oio=6.0,throughputRead=40788.0,latencyAvgWrite=11218.0,latencyAvgRead=1000.0,iopsRead=1.0,clientCacheHitRate=0.0,throughputWrite=2819.0,congestion=0.0,iopsWrite=0.0,clientCacheHits=0.0 1525462200000000000\nhost-domclient,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,hostname=esx02.example.com,uuid=5ae7229f-771d-1091-ffe7-005056a35f01 oio=0.0,throughputRead=0.0,latencyAvgWrite=0.0,latencyAvgRead=0.0,iopsRead=0.0,clientCacheHitRate=0.0,throughputWrite=0.0,congestion=0.0,iopsWrite=0.0,clientCacheHits=0.0 1525462200000000000\n```\n\nRun the script against a vSAN cluster to gather performance statistics and skip some entity types like virtual machines or VSCSI entities:\n\n```bash\n% ./vsanmetrics.py -s vcenter.example.com -u administrator@vsphere.local -p MyAwesomePassword -c VSAN-CLUSTER --performance --skipentitytypes virtual-machine,vscsi\n\ncluster-domclient,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,uuid=52b29fa6-9cb9-6d67-31ed-4bf8f2dd9294 oio=7.0,throughputRead=40883.0,latencyAvgWrite=11218.0,latencyAvgRead=985.0,iopsRead=1.0,throughputWrite=2819.0,congestion=0.0,iopsWrite=0.0 1525462200000000000\ncluster-domcompmgr,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,uuid=52b29fa6-9cb9-6d67-31ed-4bf8f2dd9294 oio=6.0,throughputRecWrite=0.0,latencyAvgRecWrite=0.0,throughputRead=45309.0,latencyAvgWrite=1335.0,tputResyncRead=0.0,latencyAvgRead=935.0,iopsRead=1.0,throughputWrite=14476.0,latAvgResyncRead=0.0,iopsResyncRead=0.0,iopsRecWrite=0.0,iopsWrite=2.0,congestion=0.0 1525462200000000000\nhost-domclient,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,hostname=esx01.example.com,uuid=5ae60a2b-fe13-25dd-1f19-005056a3a442 oio=1.0,throughputRead=95.0,latencyAvgWrite=0.0,latencyAvgRead=340.0,iopsRead=0.0,clientCacheHitRate=0.0,throughputWrite=0.0,congestion=0.0,iopsWrite=0.0,clientCacheHits=0.0 1525462200000000000\nhost-domclient,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,hostname=esx03.example.com,uuid=5ae750e2-bc6d-487b-1283-005056a38be2 oio=6.0,throughputRead=40788.0,latencyAvgWrite=11218.0,latencyAvgRead=1000.0,iopsRead=1.0,clientCacheHitRate=0.0,throughputWrite=2819.0,congestion=0.0,iopsWrite=0.0,clientCacheHits=0.0 1525462200000000000\nhost-domclient,cluster=VSAN-CLUSTER,vcenter=vcenter.example.com,hostname=esx02.example.com,uuid=5ae7229f-771d-1091-ffe7-005056a35f01 oio=0.0,throughputRead=0.0,latencyAvgWrite=0.0,latencyAvgRead=0.0,iopsRead=0.0,clientCacheHitRate=0.0,throughputWrite=0.0,congestion=0.0,iopsWrite=0.0,clientCacheHits=0.0 1525462200000000000\n```\n\n## Cache\n\nThe script will try to maintain an inventory of the vSAN infrastructure in a cache. There are two major benefits:\n\n- Reducing the global execution time of the script for larger environnement\n- Avoid errors when a host is disconnected wilhe the script is executing\n\nBy default cache validity duration is 60 minutes. You can choose your own duration with the parameter `--cacheTTL`. Cache files are stored where the script is executed, you can modify this behavior with parameter `--cachefolder`.\n\n```bash\n% ./vsanmetrics.py -s vcenter.example.com -u administrator@vsphere.local -p MyAwesomePassword -c VSAN-CLUSTER --performance --cacheTTL 300 --cachefolder /tmp\n```\n\n## List of available entities types\n\nA more detailed list of entities and metrics is available [here](entities.md)\n\n|Name|Description|\n|---|---|\n|cluster-domclient|Metrics about clusters in the perspective of VM consumption.|\n|cluster-domcompmgr|Metrics about clusters in the perspective of vSAN backend.|\n|host-domclient|Metrics about hosts in the perspective of VM consumption|\n|host-domcompmgr|Metrics about hosts in the perspective of vSAN backend.|\n|cache-disk|Metrics about Cache-tier disks|\n|capacity-disk|Metrics about Capacity-tier disks|\n|disk-group|Metrics about disk groups.|\n|vscsi|Metrics for Virtual SCSI of virtual machines|\n|virtual-machine|Metrics for virtual machines|\n|virtual-disk|Metrics for virtual disks.|\n|vsan-vnic-net|Metrics for vSAN VMkernel Network Adapter.|\n|vsan-host-net|Metrics for vSAN Host Network.|\n|vsan-pnic-net|Metrics for vSAN physical NIC.|\n|vsan-iscsi-host|Metrics for all vSAN iSCSI targets on this ESXi host.|\n|vsan-iscsi-target|Metrics for all LUNs on a vSAN iSCSI target.|\n|vsan-iscsi-lun|Metrics for a vSAN iSCSI LUN.|\n\n## Using vsanmetrics with Telegraf\n\nThe `exec` input plugin of Telegraf executes the `commands` on every interval and parses metrics from their output in any one of the accepted [Input Data Formats](https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md).\n\n\u003e Don't forget to configure Telegraf to output data to a [time series database](https://docs.influxdata.com/telegraf/v1.6/concepts/data_formats_output/) !\n\n`vsanmetrics` output the metrics in InfluxDB's line protocol. Telegraf will parse them and send them to any data format configured in the [outputs plugins](https://docs.influxdata.com/telegraf/v1.6/plugins/outputs/).\n\n`vsanmetrics` and and the Python's librairies should be available by the user who run the Telegraf service. (typically root on Linux boxes...).\n\n\u003e TIP: On Linux, install the librairies with the command `sudo -H pip install -r requirements.txt` to make it available to the root user.\n\nHere is an example of a working telegraf's config file:\n\n```Toml\n###############################################################################\n#                            INPUT PLUGINS                                    #\n###############################################################################\n\n[[inputs.exec]]\n  # Shell/commands array\n  # Full command line to executable with parameters, or a glob pattern to run all matching files.\n  commands = [\"/path/to/script/vsanmetrics.py -s vcenter01.example.com -u administrator@vsphere.local -p MyAwesomePassword -c VSAN-CLUSTER --performance --capacity --health\"]\n\n  # Timeout for each command to complete.\n  timeout = \"60s\"\n\n  # Data format to consume.\n  # NOTE json only reads numerical measurements, strings and booleans are ignored.\n  data_format = \"influx\"\n\n  interval = \"300s\"\n```\n\nIf needed, you can specify more than one input plugin. It might be useful if you want to gather different statistics with different intervals or if you want to query different vSAN clusters.\n\n```Toml\n###############################################################################\n#                            INPUT PLUGINS                                    #\n###############################################################################\n\n[[inputs.exec]]\n  # Shell/commands array\n  # Full command line to executable with parameters, or a glob pattern to run all matching files.\n  commands = [\"/path/to/script/vsanmetrics.py -s vcenter01.example.com -u administrator@vsphere.local -p MyAwesomePassword -c VSAN-CLUSTER --performance --capacity --health\"]\n\n  # Timeout for each command to complete.\n  timeout = \"60s\"\n\n  # Data format to consume.\n  # NOTE json only reads numerical measurements, strings and booleans are ignored.\n  data_format = \"influx\"\n\n  interval = \"300s\"\n\n[[inputs.exec]]\n  # Shell/commands array\n  # Full command line to executable with parameters, or a glob pattern to run all matching files.\n  commands = [\"/path/to/script/vsanmetrics.py -s vcenter02.example.com -u administrator@vsphere.local -p MyAwesomePassword -c VSAN-CLUSTER --performance --capacity --health\"]\n\n  # Timeout for each command to complete.\n  timeout = \"60s\"\n\n  # Data format to consume.\n  # NOTE json only reads numerical measurements, strings and booleans are ignored.\n  data_format = \"influx\"\n\n  interval = \"300s\"\n```\n\n# Author\n\n**Erwan Quélin**\n- \u003chttps://github.com/equelin\u003e\n- \u003chttps://twitter.com/erwanquelin\u003e\n\n# License\n\nCopyright 2018 Erwan Quelin and the community.\n\nLicensed under the Apache License 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequelin%2Fvsanmetrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fequelin%2Fvsanmetrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequelin%2Fvsanmetrics/lists"}