I use software:
ESXi 4.0:
ESXi 4 with HP agents
On Zabbix Server:
Software monitoring
VMware Infrastructure (VI) Perl Toolkit
See vSphere SDK for Perl Installation Guide http://www.vmware.com/support/developer/viperltoolkit/
Hardware monitoring
WBEM wbemcli
Used TCP ports:
WBEM https (TCP 5989)
VMware Infrastructure (VI) Perl Toolkit https (TCP 443)
/etc/zabbix/zabbix_server.conf
…
Timeout=30
….
/etc/zabbix/zabbix_agentd.conf
Timeout=30
### VMWare WBEM Monitoring
UserParameter=WBEM[*],/etc/zabbix/zabbix_wbem_vmware.pl $1 $2 $3
UserParameter=NumericSensor[*],egrep -i "SMX_NumericSensor_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Temperature[*],egrep -i "Temperature_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Power_Supply[*],egrep -i "Power_Supply_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Fan[*],egrep -i "Fan_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Proc[*],egrep -i "Proc_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Array[*],egrep -i "Array_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=System_Memory[*],egrep -i "System_Memory:" /tmp/vmware_$1.txt|sed 's/.*\t//'
### End VMWare WBEM Monitoring
### VMWare Perl API Monitoring
UserParameter=API[*],/etc/zabbix/zabbix_perl_api_vmware.pl $1 $2 $3
UserParameter=Volume.Capacity[*],egrep -i "Volume.Capacity_$2:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=Volume.Free[*],egrep -i "Volume.Free_$2:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=CpuTotal[*],egrep -i "CpuTotal:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=CpuUsed[*],egrep -i "CpuUsed:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=MemSize[*],egrep -i "MemSize:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=MemUsage[*],egrep -i "MemUsage:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=MaintenanceMode[*],egrep -i "MaintenanceMode:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=MEM[*],egrep -i "MEM_$2:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=Array_stat[*],egrep -i "Array_$2.$3:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=NET[*],egrep -i "vmnic$2.$3:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=Uptime[*],egrep -i "Uptime:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
### End VMWare Perl API Monitoring
For monitoring hardware I use script
/etc/zabbix/zabbix_wbem_vmware.pl IP password username
For monitoring software I use script
/etc/zabbix/zabbix_perl_api_vmware.pl IP password username
where
IP – IP address of ESXi hypervisor
password – password for ESXi hypervisor
username - username for ESXi hypervisor
The scripts writes data in files
WBEM: /tmp/vmware_IP.txt
VMware Infrastructure (VI) Perl Toolkit: /tmp/vmware_api_IP.txt
Data format:
Key: Data
IP – IP address of ESXi hypervisor
Example:
cat /tmp/vmware_172.16.38.103.txt
SMX_NumericSensor_18: 2
Temperature_5: 34
Temperature_19: 42
SMX_NumericSensor_27: 2
Power_Supply_2: 2
Temperature_6: 51
Temperature_20: 48
SMX_NumericSensor_1: 2
Temperature_18: 42
Temperature_9: 37
SMX_NumericSensor_0: 2
Proc_1: 2
Power_Supply[172.16.38.103,1] – status 1-st Power_Supply on ESXi HyperVisor 172.16.38.103
/usr/local/bin/zabbix_get -s localhost -k Power_Supply[172.16.38.103,1]
Proc[172.16.38.103,2] - status 2-nd Processor on ESXi HyperVisor 172.16.38.103
/usr/local/bin/zabbix_get -s localhost -k Proc[172.16.38.103,2]
In Zabbix template
Macros
{$HOST} - IP address of ESXi hypervisor
{$PASSWORD} – password for ESXi hypervisor
{$USERNAME} - username for ESXi hypervisor
In Zabbix HOST IP Address = 127.0.0.1 for ALL ESXi hypervisor
Testing on HP DL360G5, HP DL360G6, HP DL360G7 and ESXi 4.0, ESXi 4.1, ESXi 5.0
Use command-line utils for testing
WBEM:
/usr/bin/wbemcli ei -noverify "https://root:[email protected]/root/hpq:SMX_FAN"
VMware Infrastructure (VI) Perl Toolkit:
/usr/lib/vmware-viperl/apps/performance/viperformance.pl --host vmware2 --server 172.16.38.103 --countertype net --samples 1 --instance "*" --username root --password XXXXXX
Alternative method of access to WBEM Class via VMware Infrastructure (VI) Perl Toolkit
1.10.2010 New Version ESXi4_VMWare.2010.10.01.zip
Changes:
1) Error handler for wbemcli is improved
Administration ->General ->VALUE MAPPING for Items "Perl API client status" and "WBEM client status"
VMWare client status
2)Template for ESXi4.1 is added
3) add -i option for egrep in /etc/zabbix/zabbix_agentd.conf
16.11.2010 new XML Template
P.S. On other versions ESXi the name of variables can be others. Fix names in Template Template_VMWare_HP_DL360_G6.xml
ESXi 4.0:
ESXi 4 with HP agents
On Zabbix Server:
Software monitoring
VMware Infrastructure (VI) Perl Toolkit
See vSphere SDK for Perl Installation Guide http://www.vmware.com/support/developer/viperltoolkit/
Hardware monitoring
WBEM wbemcli
Used TCP ports:
WBEM https (TCP 5989)
VMware Infrastructure (VI) Perl Toolkit https (TCP 443)
/etc/zabbix/zabbix_server.conf
…
Timeout=30
….
/etc/zabbix/zabbix_agentd.conf
Timeout=30
### VMWare WBEM Monitoring
UserParameter=WBEM[*],/etc/zabbix/zabbix_wbem_vmware.pl $1 $2 $3
UserParameter=NumericSensor[*],egrep -i "SMX_NumericSensor_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Temperature[*],egrep -i "Temperature_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Power_Supply[*],egrep -i "Power_Supply_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Fan[*],egrep -i "Fan_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Proc[*],egrep -i "Proc_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=Array[*],egrep -i "Array_$2:" /tmp/vmware_$1.txt|sed 's/.*\t//'
UserParameter=System_Memory[*],egrep -i "System_Memory:" /tmp/vmware_$1.txt|sed 's/.*\t//'
### End VMWare WBEM Monitoring
### VMWare Perl API Monitoring
UserParameter=API[*],/etc/zabbix/zabbix_perl_api_vmware.pl $1 $2 $3
UserParameter=Volume.Capacity[*],egrep -i "Volume.Capacity_$2:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=Volume.Free[*],egrep -i "Volume.Free_$2:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=CpuTotal[*],egrep -i "CpuTotal:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=CpuUsed[*],egrep -i "CpuUsed:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=MemSize[*],egrep -i "MemSize:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=MemUsage[*],egrep -i "MemUsage:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=MaintenanceMode[*],egrep -i "MaintenanceMode:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=MEM[*],egrep -i "MEM_$2:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=Array_stat[*],egrep -i "Array_$2.$3:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=NET[*],egrep -i "vmnic$2.$3:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
UserParameter=Uptime[*],egrep -i "Uptime:" /tmp/vmware_api_$1.txt|sed 's/.*\t//'
### End VMWare Perl API Monitoring
For monitoring hardware I use script
/etc/zabbix/zabbix_wbem_vmware.pl IP password username
For monitoring software I use script
/etc/zabbix/zabbix_perl_api_vmware.pl IP password username
where
IP – IP address of ESXi hypervisor
password – password for ESXi hypervisor
username - username for ESXi hypervisor
The scripts writes data in files
WBEM: /tmp/vmware_IP.txt
VMware Infrastructure (VI) Perl Toolkit: /tmp/vmware_api_IP.txt
Data format:
Key: Data
IP – IP address of ESXi hypervisor
Example:
cat /tmp/vmware_172.16.38.103.txt
SMX_NumericSensor_18: 2
Temperature_5: 34
Temperature_19: 42
SMX_NumericSensor_27: 2
Power_Supply_2: 2
Temperature_6: 51
Temperature_20: 48
SMX_NumericSensor_1: 2
Temperature_18: 42
Temperature_9: 37
SMX_NumericSensor_0: 2
Proc_1: 2
Power_Supply[172.16.38.103,1] – status 1-st Power_Supply on ESXi HyperVisor 172.16.38.103
/usr/local/bin/zabbix_get -s localhost -k Power_Supply[172.16.38.103,1]
Proc[172.16.38.103,2] - status 2-nd Processor on ESXi HyperVisor 172.16.38.103
/usr/local/bin/zabbix_get -s localhost -k Proc[172.16.38.103,2]
In Zabbix template
Macros
{$HOST} - IP address of ESXi hypervisor
{$PASSWORD} – password for ESXi hypervisor
{$USERNAME} - username for ESXi hypervisor
In Zabbix HOST IP Address = 127.0.0.1 for ALL ESXi hypervisor
Testing on HP DL360G5, HP DL360G6, HP DL360G7 and ESXi 4.0, ESXi 4.1, ESXi 5.0
Use command-line utils for testing
WBEM:
/usr/bin/wbemcli ei -noverify "https://root:[email protected]/root/hpq:SMX_FAN"
VMware Infrastructure (VI) Perl Toolkit:
/usr/lib/vmware-viperl/apps/performance/viperformance.pl --host vmware2 --server 172.16.38.103 --countertype net --samples 1 --instance "*" --username root --password XXXXXX
Alternative method of access to WBEM Class via VMware Infrastructure (VI) Perl Toolkit
1.10.2010 New Version ESXi4_VMWare.2010.10.01.zip
Changes:
1) Error handler for wbemcli is improved
Administration ->General ->VALUE MAPPING for Items "Perl API client status" and "WBEM client status"
VMWare client status
Code:
0 OK 1 VMWare client error 2 Status file write error 3 bad username or password 4 Can't connect to ESXi 5 Can't get data from ESXi
3) add -i option for egrep in /etc/zabbix/zabbix_agentd.conf
16.11.2010 new XML Template
P.S. On other versions ESXi the name of variables can be others. Fix names in Template Template_VMWare_HP_DL360_G6.xml

. My plans are use your main scripts (zabbix_perl_api_vmware.pl and zabbix_wbem_vmware.pl) as external monitoring items. This way I could use real IPs of my ESXi hypervisors (zabbix hosts) and not fake IPs (127.0.0.1). I wouldn't change the logic of your scripts, therefore, they would continue to write info in temp files. I intend to write some scritps in order to read the temp files. These scripts would also be run by zabbix server as external monitoring scripts, again passing the real IP of ESXi hypervisors as parameters.
Comment