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

相关推荐
牛奶咖啡138 小时前
zabbix结合grafana打造自定义炫酷监控界面实战
zabbix·grafana·grafana的安装配置·grafana的插件安装配置·grafana仪表盘的搜索导入·grafana监控zabbix·grafana配置图表
水岸齐天8 小时前
prometheus和Grafana介绍
grafana·prometheus
oneslide9 小时前
Kubernetes V1.24+ & Docker运行时 grafana容器指标显示异常
docker·kubernetes·grafana
cui_win17 小时前
Prometheus实战教程 05 - 告警通知实现 - 邮件 + 钉钉 + 自定义告警模板
钉钉·prometheus·邮件通知
杰克逊的日记2 天前
通过Prometheus对GPU集群进行监控以及搭建(小型集群)
prometheus·gpu算力·gpu服务器监控
happy_king_zi2 天前
RabbitMQ-Exporter 监控 TLS 加密的 RabbitMQ 集群
分布式·安全·rabbitmq·prometheus
青鱼入云3 天前
Grafana介绍
grafana
梁正雄5 天前
6、prometheus资源规划
运维·服务器·服务发现·prometheus·监控
梁正雄5 天前
4、prometheus-服务发现k8s api-2
kubernetes·服务发现·prometheus
路由侠内网穿透.9 天前
外网访问可视化工具 Grafana (Linux版本)
linux·运维·服务器·grafana·远程工作