Using Prometheus+Grafana+VMware-exporter to monitor VMware EXSi Hosts and VMs

This article introduces a simple method to monitor VMware EXSi and VMs with VMware-exporter, related metrics can be pulled by Prometheus, and visualized by Grafana.

Here we use docker to run 4 containers that compose of the entire environment.

First of all, git clone the project from the URL: VMware-ESXI-Monitoring-Tools: Prometheus / Grafana / VMWare ESXi Metrics for Prometheus

then, you need to download docker: Get Docker | Docker Docs, and install the docker for providing docker environment.

Finally, run the command:

SMTP_HELLO=[yourdomain.com] SMTP_TO=[first.last@gmail.com] SMTP_FROM=[prometheus@yourdomain.com] SMTP_SMARTHOST=smtp.gmail.com:587 SMTP_USER=[your_gmail_user@gmail.com] SMTP_PASS=[your_google_app_password]
HOST_IP=[host_ip_running_docker_compose] VSPHERE_HOST=[esxi_host_ip_or_hostname] VSPHERE_USER=[vsphere_user] VSPHERE_PASS=[vsphere_pass] ./start_containers.sh 

If there's no need to use alert function, just remove the SMTP parameters from the command.

That's it!

If you want to get metrics from multiple vCenters, you can modify ./configs/prometheus.yml.tpl to add more jobs, for example,

- job_name: 'vmware_vcenter_0'

  ......

  static_configs:

    - targets: 

      - '{{HOST_IP}}:9272'

- job_name: 'vmware_vcenter_1'

  ......

  static_configs:

    - targets: 

      - '{{HOST_IP}}:9273'

Run docker ps to get containers, and docker compose logs to get logs.

If it's too slow to download images, you can configure Aliyun docker image mirror to speed up.

Navigate to 容器镜像服务 to get registry-mirrors

Modify daemon configuration file /etc/docker/daemon.json to use accelerator:

sudo mkdir -p /etc/docker 

sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://{{serial number}}.mirror.aliyuncs.com"] } EOF 

sudo systemctl daemon-reload  

sudo systemctl restart docker

After all set. you can get Dashboard template from Grafana Dashboard. Searching the dashboards with filters vmware or exsi and lable of prometheus to get the one you want. Remember to configure the data source first: https://{``{host_ip}}:3000

相关推荐
福大大架构师每日一题6 小时前
37.1 prometheus管理接口源码讲解
ios·iphone·prometheus
Cairry.1 天前
WatchAlert - 开源多数据源告警引擎
云原生·开源·prometheus
Mitch3111 天前
【漏洞复现】CVE-2023-37461 Arbitrary File Writing
web安全·网络安全·prometheus·metersphere·漏洞复现
福大大架构师每日一题3 天前
36.3 grafana-dashboard看图分析
linux·网络·grafana·prometheus
福大大架构师每日一题4 天前
36.2 内置的k8s采集任务分析
算法·贪心算法·kubernetes·prometheus
点燃银河尽头的篝火(●'◡'●)4 天前
【环境搭建】Grafana本地部署搭建(windows系统)
windows·grafana·环境搭建
Algorithm15764 天前
linux/ubuntu安装Prometheus&Grafana
linux·ubuntu·prometheus
福大大架构师每日一题8 天前
35.4 thanos-query 源码阅读
java·spring·ios·prometheus
福大大架构师每日一题9 天前
35.3 thanos-store 源码阅读
ios·iphone·prometheus
童安格粉丝9 天前
Grafana配置告警规则推送企微机器人服务器资源告警
机器人·企业微信·grafana·告警·dashboard·阈值