Thứ Năm, Tháng Năm 19, 2022
ITFORVN.COM
  • Cloud Computing
    • Azure
    • AWS
    • GCP
    • Cloud Other
  • System
    • Virtualization
    • Microsoft
    • Linux/Unix
    • Databases
    • Monitoring
    • Logging
  • Networking
    • Routing
    • Switch
    • Firewall
  • Security
    • SIEM
    • CIS
    • Audit
  • DevOps
    • CI/CD
    • Docker
    • K8s
    • IaC
  • Resource
    • Tools
    • Documents
    • Download
ITFORVN.COM
  • Cloud Computing
    • Azure
    • AWS
    • GCP
    • Cloud Other
  • System
    • Virtualization
    • Microsoft
    • Linux/Unix
    • Databases
    • Monitoring
    • Logging
  • Networking
    • Routing
    • Switch
    • Firewall
  • Security
    • SIEM
    • CIS
    • Audit
  • DevOps
    • CI/CD
    • Docker
    • K8s
    • IaC
  • Resource
    • Tools
    • Documents
    • Download
ITFORVN.COM

[Prometheus từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

hieuit1506 bởi hieuit1506
25/05/2020
trong Monitoring
Reading Time: 5 mins read
A A
0
Trang chủ System Monitoring
0
Chia sẻ
4k
xem
Share on FacebookShare on Twitter

Bài viết chỉ mang tính chất tham khảo và chia sẻ, các trong quá trình làm chắc chắn sẽ có bạn gặp bug. Nếu gặp bug thì vào telegram group ITFORVN để nhờ support từ cộng đồng. Hoặc các bạn thể có truy cập vào nguồn tham khảo để làm theo hướng dẫn chính thống. Ngoài ra bạn có thể tham gia Forum Google [prometheus-users] của nước ngoài để hỏi đáp. 

Thân chào anh em. Để tiếp tục seri chia sẻ về Promehtues và Grafana. Hôm nay mình xin chia sẻ với mọi người cách giám sát các Vmware với Prometheus. Để giám sát được các ESXi host hoặc vCenter chúng ta cần cài vmware_exporter trên prometheus server.

Bước 01: Cài đặt python 3.x bởi vì vmware-exporter yêu cầu Python >= 3.6

wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
tar -xJf Python-3.6.4.tar.xz
cd Python-3.6.4
./configure
make
make install
pip3 install --upgrade pip

Bước 02: Cài đặt vmware_exporter

pip3 install vmware_exporter

Sau khi cài đặt xong, đường dẫn lưu trử tại đây.

/usr/local/lib/python3.6/site-packages/vmware_exporter

Trong trường hợp không có trong đường dẫn này thì bạn có thể sử dụng câu lệnh sau để tìm:

find / -name "vmware_exporter"

Bước 03: Tạo user read-only dùng để monitor trên vcenter hoặc ESXi host.

1 4 - [Prometheus từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

Hình 01: [Promethues từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

Bước 04: Tạo file cấu hình cho vmware_exporter

cd /usr/local/lib/python3.6/site-packages/vmware_exporter
vi config.yml

Nội dung file config như sau:

default:
    vsphere_host: 10.10.10.43
    vsphere_user: 'monitor'
    vsphere_password: '[email protected]'
    ignore_ssl: True
    specs_size: 5000
    collect_only:
        vms: True
        vmguests: False
        datastores: True
        hosts: True
        snapshots: True
esxi02:
    vsphere_host: 10.10.10.41
    vsphere_user: 'monitor'
    vsphere_password: '[email protected]'
    ignore_ssl: True
    specs_size: 5000
    collect_only:
        vms: True
        vmguests: False
        datastores: True
        hosts: True
        snapshots: True
esxi01:
    vsphere_host: 10.10.10.40
    vsphere_user: 'monitor'
    vsphere_password: '[email protected]'
    ignore_ssl: True
    specs_size: 5000
    collect_only:
        vms: True
        vmguests: False
        datastores: True
        hosts: True
        snapshots: False
  • Nếu bạn có nhiều vCenter hoặc ESXi host thì bạn có thể add thêm như highlight ở trên.

Bước 05: Tạo service trong systemd cho vmware_exporter

vi /etc/systemd/system vmware_exporter.service

Nội dung file như sau:

[Unit]
Description=Prometheus VMWare Exporter
After=network.target
[Service]
User=root
Group=root
ExecStart=/usr/bin/python3 /usr/local/bin/vmware_exporter -c /usr/local/lib/python3.6/site-packages/vmware_exporter/config.yml
Type=simple
[Install]
WantedBy=multi-user.target

Bước 06: Enable và start service

systemctl enable vmware_exporter.service
systemctl start vmware_exporter.service

Bước 07: Tạo job trong prometheus để giám sát Vmware. Đối với vmware để lấy dc metric của nhiều host ESXi thì chúng ta phải tạo nhiều job. Bạn nào có cách khác hay hơn thì chỉ lại mình nhé. Nội dung job như sau:

################################ VMWARWE
  - job_name: 'ESXi03'
    metrics_path: '/metrics'
    static_configs:
      - targets: 
        - 10.10.10.43
        labels:
         hostname: ESXi03
         device: VMWARE
         company: ITFORVN
    params:
      section: [default]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 10.10.10.26:9272
  - job_name: 'ESXi02'
    metrics_path: '/metrics'
    static_configs:
      - targets:
        - 10.10.10.41
        labels:
         hostname: ESXi02
         device: VMWARE
         company: ITFORVN
    params:
      section: [esxi02]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 10.10.10.26:9272
  - job_name: 'ESXi01'
    metrics_path: '/metrics'
    static_configs:
      - targets:
        - 10.10.10.40
        labels:
         hostname: ESXi01
         device: VMWARE
         company: ITFORVN
    params:
      section: [esxi01]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 10.10.10.26:9272

Bước 08: Restart prometheus service và kiểm tra lại kết quả

Tại đây bạn phải nhớ mở port 9272 nhé.

2 4 - [Prometheus từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

Hình 02: [Promethues từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

Chọn vào 1 job để kiểm tra metric.

3 5 - [Prometheus từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

Hình 03: [Promethues từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

Bước 09: Đăng nhập vào grafana tạo dashboard

Cách tạo dashboard trong grafana mình có hướng dẫn tại Bước 09 trong bài viết này.

Đây là dashboard của linux server sau khi đã import xong.

4 3 - [Prometheus từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

Hình 04: [Promethues từ A đến Z] Phần 06. Giám sát Vmware với Prometheus

 

Đây là dashboard EXSi host của mình bạn có thể download tại đây.

Về dashboard bạn có thể tham khảo thêm tại đây nhé. https://grafana.com/grafana/dashboards

Tài liệu tham khảo: https://github.com/pryorda/vmware_exporter

Tác giả:  Nguyễn Hiếu – ITFORVN.COM

To you support to access:  Nhóm Facebook ITFORVN

 

Tất cả bài viết về prometheus tại đây.

Giới thiệu về giải pháp giám sát hệ thống Prometheus và Grafana

Phần 01 – Cài đặt Prometheus và Grafana trên CentOS 07

Phần 02 – Giám sát Windows Server với Prometheus

Phần 03 – Giám sát firewall Fortigate với Prometheus

Phần 04 – Giám sát thiết bị mạng Cisco với Prometheus

Phần 05 – Giám sát firewall pfSense® và Linux Server với Prometheus

Phần 06 – Giám sát VMWARE với Prometheus

Phần 07 –  Cấu hình alert trong Prometheus và gửi tin nhắn qua telegram

The: Prometheus
Bài trước

Cách hot-extend VMDK disk lớn hơn 2 TB với vSphere 7.0

Bài kế tiếp

[Prometheus từ A đến Z] Phần 07. Cấu hình Alert trong Prometheus gửi tin nhắn qua telegram

hieuit1506

hieuit1506

Bài viết liên quan

[Prometheus từ A đến Z] Phần 07. Cấu hình Alert trong Prometheus gửi tin nhắn qua telegram
Monitoring

[Prometheus từ A đến Z] Phần 07. Cấu hình Alert trong Prometheus gửi tin nhắn qua telegram

25/05/2020
[Prometheus từ A đến Z] Phần 05. Giám sát firewall pFsense và Linux server với Prometheus
Monitoring

[Prometheus từ A đến Z] Phần 05. Giám sát firewall pFsense và Linux server với Prometheus

22/05/2020
[Prometheus từ A đến Z] Phần 04. Giám sát thiết bị mạng Cisco qua snmp với Prometheus
Monitoring

[Prometheus từ A đến Z] Phần 04. Giám sát thiết bị mạng Cisco qua snmp với Prometheus

22/05/2020
Bài kế tiếp
[Prometheus từ A đến Z] Phần 07. Cấu hình Alert trong Prometheus gửi tin nhắn qua telegram

[Prometheus từ A đến Z] Phần 07. Cấu hình Alert trong Prometheus gửi tin nhắn qua telegram

VMware vSphere 7 Clustered VMDK

VMware vSphere 7 Clustered VMDK

1 1 vote
Article Rating
Subscribe
Connect with
Login
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Notify of
guest
Connect with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
guest
0 Comments
Inline Feedbacks
View all comments

Bài viết hay

Bản cập nhật của Window 10 có mặt tháng 5 2019 với những tính năng mới.

Bản cập nhật của Window 10 có mặt tháng 5 2019 với những tính năng mới.

25/05/2019
CẤU HÌNH RAID BẰNG WEB BIOS TRÊN SERVER IBM 3650M4

CẤU HÌNH RAID BẰNG WEB BIOS TRÊN SERVER IBM 3650M4

04/02/2017
Cấu hình Wireless Controller Zyxel  Phần 3

Cấu hình Wireless Controller Zyxel Phần 3

20/01/2018
ITFORVN

KIẾN THỨC LÀ 1 NGỌN LỬA, CHIA SẺ CÀNG NHIỀU NÓ CÀNG BÙNG CHÁY MẠNH

Chuyên mục

  • Audit
  • Azure
  • Backup & Restore
  • CEH
  • Cloud Computing
  • Cloud Other
  • Databases
  • Documents
  • Firewall
  • IaC
  • Khác
  • Linux/Unix
  • Logging
  • Mail Server
  • Microsoft
  • Monitoring
  • Networking
  • Office 365
  • Routing
  • Security
  • Security Awareness
  • Server & Storage
  • SIEM
  • Switch
  • System
  • Tools
  • Virtualization
  • Website

Tags

AD ARM Cacti CCNA Centos Cisco Citrix Controller DLP EIRGP EthernetChannel EVE-NG Exchange Fortinet FreePBX HCIBench HP IBM Installation iRedMail LAB McAfee MCSA Meeting Microsoft Teams Monitoring MSSQL P2S Prometheus SAN Splunk STP TCP/IP Ubuntu VDI Virtual Machine VLAN VMware VPN VTP Windows 10 Windows Server Wireless XPENOLOGY Zabbix

Bài Viết Gần Đây

  • Hướng dẫn cài đặt Windows Subsystem for linux version 2 (WSL2) 14/12/2021
  • Hướng dẫn Active code Azurepass 14/12/2021
  • [Tự học MCSA MCSE 2016]Lab 17 Cấu hình DFS trên Windows Server 2016 phần 1 23/08/2021
  • Zabbix monitoring network 10:Upgrade Zabbix from 4.4 to 5.0 LTS 27/06/2021
  • Zabbix monitoring network 9: Convert character Zabbix Database 07/06/2021
  • Zabbix monitoring network 8: Zabbix Grafana 16/05/2021
  • Zabbix monitoring network 7: Telegram Alert 09/05/2021

© 2021 Cộng Đồng IT Việt - ITFORVN

  • Cloud Computing
    • Azure
    • AWS
    • GCP
    • Cloud Other
  • System
    • Virtualization
    • Microsoft
    • Linux/Unix
    • Databases
    • Monitoring
    • Logging
  • Networking
    • Routing
    • Switch
    • Firewall
  • Security
    • SIEM
    • CIS
    • Audit
  • DevOps
    • CI/CD
    • Docker
    • K8s
    • IaC
  • Resource
    • Tools
    • Documents
    • Download

© 2021 Cộng Đồng IT Việt - ITFORVN

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply
This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.