{ "info": { "author": "Francois Gouteroux", "author_email": "francois.gouteroux@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Vcenter Prometheus Exporter\n\nExport prometheus metrics from vcenter host\n\n\n## Installation\n\n```bash\npip install pipenv\npipenv install vcenter_prometheus_exporter\n```\n\n## Usage\n\nDefault config file: **/etc/default/vcenter_exporter.yaml**\n\n\tvcenter_exporter run\n\nOr\n\n\tvcenter_exporter run -c config.yaml\n\n\n## How it works\n\nThis exporter read an yaml config file composed with:\n- vcenter: vcenter host and credentials\n- objects: objects to get from vcenter and filter properties\n- metrics: metrics to generates from objects\n\n**See config_sample.yaml**\n\nThe exporter will:\n- generate an exported resource view from vcenter objects \n- set the metric type\n- apply metric labels\n- set metric value\n- return Metric Object List to the embedded http server.\n\n**Output:**\n\n```\n# HELP vcenter_host_cpu_cores vcenter_host_cpu_cores\n# TYPE vcenter_host_cpu_cores gauge\nvcenter_host_cpu_cores{hostname=\"my-esx.example.com\"} 24.0\n# HELP vcenter_host_memory_capacity vcenter_host_memory_capacity\n# TYPE vcenter_host_memory_capacity gauge\nvcenter_host_memory_capacity{hostname=\"my-esx.example.com\"} 274645385216.0\n# HELP vcenter_host_uptime_seconds vcenter_host_uptime_seconds\n# TYPE vcenter_host_uptime_seconds gauge\nvcenter_host_uptime_seconds{hostname=\"my-esx.example.com\"} 3544985.0\n# HELP vcenter_host_memory_usage vcenter_host_memory_usage\n# TYPE vcenter_host_memory_usage gauge\nvcenter_host_memory_usage{hostname=\"my-esx.example.com\"} 209072.0\n# HELP vcenter_host_power_state vcenter_host_power_state\n# TYPE vcenter_host_power_state gauge\nvcenter_host_power_state{hostname=\"my-esx.example.com\"} 0.0\n# HELP vcenter_host_cpu_frequency vcenter_host_cpu_frequency\n# TYPE vcenter_host_cpu_frequency gauge\nvcenter_host_cpu_frequency{hostname=\"my-esx.example.com\"} 2195.0\n# HELP vcenter_vm_memory_usage vcenter_vm_memory_usage\n# TYPE vcenter_vm_memory_usage gauge\nvcenter_vm_memory_usage{host=\"my-esx.example.com\",vmname=\"my-testvm.example.com\"} 2785.0\n# HELP vcenter_vm_power_state vcenter_vm_power_state\n# TYPE vcenter_vm_power_state gauge\nvcenter_vm_power_state{vmname=\"my-testvm.example.com\"} 0.0\n# HELP vcenter_vm_cpu_usage vcenter_vm_cpu_usage\n# TYPE vcenter_vm_cpu_usage gauge\nvcenter_vm_cpu_usage{host=\"my-esx.example.com\",vmname=\"my-testvm.example.com\"} 6211.0\n```\n\n## Specific features\n\nThere are **four** specific features:\n- States Values\n- Regex Filters\n- Functions\n- Objects Refs\n\n**Note**: If a value to get is not specified, the default is 0.\n\n### States values\n\nAs the prometheus python client doesn't yet support (Enum, Info..) types,\nwe can map text to value.\n\n**Example:** \n\nGetting the cluster heath status send three text states: **green, yellow and red**.\n\nTo have a valid metric, we map each state to an integer value.\n\n```yaml\n metrics:\n cluster:\n vcenter_cluster_overallstatus:\n type: Gauge\n labels: [\"cluster_name\"]\n properties:\n labels: [\"name\"]\n states: {\"green\": 0, \"yellow\": 1, \"red\": 2}\n value: overallStatus\n```\n\n### Regex Filters\n\n**match_filter:** get all objects which name match with the regex\n\n```yaml\n objects:\n vm:\n type: VirtualMachine\n match_filter: \".*testvm.*\"\n properties:\n - \"name\"\n [...]\n```\n\n**ignore_filter:** ignore all objects which name match with the regex\n\n```yaml\n objects:\n vm:\n type: VirtualMachine\n ignore_filter: \"^testvm.*\"\n properties:\n - \"name\"\n [...]\n```\n\n### Functions\n\nIt's possible to call some object functions to get specfic info.\n\n**Example: get the cluster storage used in MB**\n\n\nDeclare the function to use in:\n\n```yaml\n objects:\n cluster:\n type: ComputeResource\n functions:\n - GetResourceUsage\n```\nGive the value to get in the metric:\n```yaml\n vcenter_cluster_memory_capacity:\n type: Gauge\n labels: [\"cluster_name\"]\n properties:\n labels: [\"name\"]\n value: memCapacityMB\n```\n\n#### Technical view:\n\nThis will execute the function:\n\n```\nvim.ClusterComputeResource:domain-c34.GetResourceUsage()\n\n\t(vim.cluster.ResourceUsageSummary) {\n\t dynamicType = ,\n\t dynamicProperty = (vmodl.DynamicProperty) [],\n\t cpuUsedMHz = 673265,\n\t cpuCapacityMHz = 842880,\n\t memUsedMB = 3611287,\n\t memCapacityMB = 4190768,\n\t pMemAvailableMB = ,\n\t pMemCapacityMB = ,\n\t storageUsedMB = 34709118L,\n\t storageCapacityMB = 60418304L\n\t}\n```\n\nand update the dict:\n\n```\n\t{'memUsedMB': 3611336, 'storageCapacityMB': 60418304L, 'obj': 'vim.ClusterComputeResource:domain-c34', u'name': 'cluster_integration', 'dynamicProperty': (vmodl.DynamicProperty) [], 'dynamicType': None, u'summary.numEffectiveHosts': 16, 'pMemCapacityMB': None, 'cpuUsedMHz': 665617, u'summary.numHosts': 16, 'storageUsedMB': 34709118L, 'memCapacityMB': 4190768, u'overallStatus': 'green', 'pMemAvailableMB': None, 'cpuCapacityMHz': 842880}\n```\n### Objects Refs\n\nIn some cases, we want to get a property from an another object reference.\n\n**Example: apply host label to vm metric**\n\nDeclare the property separated by **|** and the attribute to get:\n\n```yaml\n metrics:\n vm:\n vcenter_vm_cpu_usage:\n type: Gauge\n labels: [\"vmname\", \"host\"]\n properties:\n labels: [\"name\", \"runtime.host|name\"]\n value: summary.quickStats.overallCpuUsage\n```\nWe are getting the attribute **'name'** from object **'vim.HostSystem:host-6077'**.\n\n**Note: Getting an object ref consume time as it's not an view resource.**\n\n\n## References\n\nVcenter Prometheus Exporter uses theses libraries:\n- [pyVmomi](https://github.com/vmware/pyvmomi) for VMWare connection\n- Prometheus [client_python](https://github.com/prometheus/client_python) for Prometheus supervision\n\n\nInspired by:\n- https://github.com/sapcc/vcenter-exporter\n- https://github.com/pryorda/vmware_exporter\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fgouteroux/vcenter_prometheus_exporter.git", "keywords": "VMWare,VCenter,Prometheus", "license": "License :: OSI Approved :: Apache Software License", "maintainer": "", "maintainer_email": "", "name": "vcenter-prometheus-exporter", "package_url": "https://pypi.org/project/vcenter-prometheus-exporter/", "platform": "", "project_url": "https://pypi.org/project/vcenter-prometheus-exporter/", "project_urls": { "Homepage": "https://github.com/fgouteroux/vcenter_prometheus_exporter.git" }, "release_url": "https://pypi.org/project/vcenter-prometheus-exporter/0.0.1/", "requires_dist": [ "PyYAML", "prometheus-client", "pyvmomi", "docopt", "pipenv" ], "requires_python": "", "summary": "Export prometheus metrics from vcenter host", "version": "0.0.1" }, "last_serial": 4341640, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "95048cb43be69663d04da58afded7b98", "sha256": "b639e04a497fb81add9d25f26567d952c16fb26692ab3b15ea006585c3feda9f" }, "downloads": -1, "filename": "vcenter-prometheus-exporter-0.0.1.tar.gz", "has_sig": false, "md5_digest": "95048cb43be69663d04da58afded7b98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7663, "upload_time": "2018-10-04T19:52:20", "url": "https://files.pythonhosted.org/packages/a3/93/7e25af83072251a9ac499b896d90f5165b923a86be52ead8e9996916fe03/vcenter-prometheus-exporter-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "95048cb43be69663d04da58afded7b98", "sha256": "b639e04a497fb81add9d25f26567d952c16fb26692ab3b15ea006585c3feda9f" }, "downloads": -1, "filename": "vcenter-prometheus-exporter-0.0.1.tar.gz", "has_sig": false, "md5_digest": "95048cb43be69663d04da58afded7b98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7663, "upload_time": "2018-10-04T19:52:20", "url": "https://files.pythonhosted.org/packages/a3/93/7e25af83072251a9ac499b896d90f5165b923a86be52ead8e9996916fe03/vcenter-prometheus-exporter-0.0.1.tar.gz" } ] }