Prometheus exporter, which utilises the VMware SDK and SSH to get metrics from VMware ESXi-HostSystems.
This exporter contains a critical service collector and a overall state collector. It monitors the service state of services like hostd or ntpd and gathers the ESXi-HostSystem overallState from vCenters.
- Configure the project
- Credentials are passed by environment variables.
config.yamlcontains some static configuration- There are command-line options for more console output
- Run
exporter.pywith python3
Environment variables
VCENTER_USERthe vCenter username.VCENTER_PASSWORDthe vCenter password.VCENTER_MPWif set, master_password mechanism will be used.ESXI_USERthe ESXi-host ssh username.ESXI_PASSWORDthe ESXi-host ssh password.ATLAS_FILEthe path to the atlas file containing esxi_hosts and vcenters.CONFIG_FILEpath to config file.
Command-line arguments
-vsets logger to info output-vvsets logger to debug output
https://github.com/sapcc/atlas
This is an atlas scheme reduced to the information required by this exporter.
[
{
"labels": {
"job": "vmware-esxi or vcenter",
"name": "",
"server_name": "",
"status": "Active",
"site": ""
}
},
]- All collectors inherit from the
BaseCollector - Interfaces are used to provide a common exchange data type. Eg it defines how a Host and a Vcenter should be passed around. (the term interface is used as in Angular/Typescript vocabular)
- Modules provide shared core functionality
- api → very basic functionality. Enables connectivity to ESXi-hosts etc. They are designed in an interchangeable manner. See helpers which are some kind of wrapper.
- helper → Are some kind of wrapper which combine different APIs in order to provide a unified interface. If an api-file gets interchanged, the helper/wrapper still expects the same format as before. For instance if you want to use a different SSH-library than paramiko then change the ssh-api-file in the api folder and make sure it still returns the console output of the remote host as before.
- configuration → some small models that collect configuration from yaml, environment and commandline arguments in order to provide configuration in a dynamic and scoped manner to specific parts of the exporter.
- exporter.py is the entry point. It dynamicly invokes collectors based on the configuration and sets up the whole program.