The beans today want to add VMware ESXi monitoring to Nagios as well. There are many ways to monitor ESXi, the first reaction of beans is to use POWERSHELLCLI, the second is SNMP, and the third response is to find out if there is no ready-made script, you don't have to make the wheel again ~ ~
First look at how powershellcli is monitored?
The script itself is easy enough to get the corresponding information by Get-stat. For example, I intend to check the memory status of a host, the first is the state of Ballon, the second is the actual use of memory, the third is the usage rate, the fourth is allocated memory, this result and vcenter above view is consistent
Vcenter above view
The script can get the information, then the rest of the configuration steps are not discussed, you can refer to nagios How to monitor the backup status of Veeam http://blog.51cto.com/beanxyz/1981136
The second approach is SNMP
The method of opening SNMP above ESXI is usually implemented by ESXCLI. Simply set the community string, open the SNMP service, allow firewall access, I use the simplest SNMP v2 here, allow all IP access
esxcli system snmp set --communities publicesxcli system snmp set --enable trueesxcli network firewall ruleset set --ruleset-id snmp --allowed-all true[esxcli network firewall ruleset set --ruleset-id snmp --enabled true/etc/init.d/snmpd restart
Can be confirmed via Vcenter's graphical interface
Then, download the MIB file for ESXi SNMP, unzip it to
/usr/share/snmp/mibs
[[email protected] mibs]# pwd/usr/share/snmp/mibs[[email protected] mibs]# lsAGENTX-MIB.txt Ieee8021-tc-mib.mib net-snmp-extend-mib.txt snmp-notification-mib.txt Ucd-snmp-mib.txtbridge-mib.mib Ieee8023-lag-mib.mib net-snmp-mib.txt snmp-proxy-mib.txt udp-mib.mibbridge-mib.t XT If-inverted-stack-mib.txt Net-snmp-pass-mib.txt Snmp-target-mib.txt Udp-mib.txtdis Man-event-mib.txt If-mib.mib net-snmp-tc.txt snmp-user-based-sm-mib.txt uuid- Tc-mib.mibdisman-schedule-mib.txt if-mib.txt net-snmp-vacm-mib.txt Snmp-usm-aes-mib.txt Vmware-cimom-mib.mibdisman-script-mib.txt Inet-address-mib.mib network-appliance-mib.txt SNM P-usm-dh-objects-mib.txt Vmware-env-mib.mibentity-mib.mib inet-address-mib.txt NETWORK-SERVIC Es-mib.txt snmpv2-conf. MIB Vmware-esx-agentcap-mib.mibetherlike-mib.txt Ip-forward-mib.mib notification- Log-mib.txt snmpv2-conf.txt Vmware-heartbeat-mib.mibgeist_bb_mib.mib Ip-forward-mib.txt Notifications.txt Snmpv2-mib.mib Vmware-nsx-manager-agentcap-mib.mibgeist_mib.txt Ip-mib.mib P-bridge-mib.mib snmpv2-mib.txt VMWARE-NSX-MANAGER-MIB.M Ibhcnum-tc.txt Ip-mib.txt Q-bridge-mib.mib
Then you can try it out.
Snmpwalk-m all-c public-v 2c sydesx1 hrstoragehost-resources-mib::hrmemorysize.0 = integer:234845392 KBytesHOST-RESOUR ces-mib::hrstorageindex.1 = integer:1host-resources-mib::hrstorageindex.2 = Integer:2host-resources-mib:: hrstorageindex.3 = integer:3host-resources-mib::hrstorageindex.4 = Integer:4host-resources-mib::hrstorageindex.5 = integer:5host-resources-mib::hrstorageindex.6 = integer:6host-resources-mib::hrstorageindex.7 = INTEGER: 7host-resources-mib::hrstorageindex.8 = integer:8host-resources-mib::hrstorageindex.9 = INTEGER: 9host-resources-mib::hrstorageindex.10 = integer:10host-resources-mib::hrstorageindex.11 = INTEGER: 11host-resources-mib::hrstoragetype.1 = Oid:host-resources-types::hrstorageramdiskhost-resources-mib:: hrstoragetype.2 = Oid:host-resources-types::hrstorageramdiskhost-resources-mib::hrstoragetype.3 = OID: host-resources-types::hrstorageramdiskhost-resources-mib::hrstoragetype.4 = Oid:host-resources-types:: Hrstoragefixeddiskhost-resources-mib::hrstoragetype.5 = oid:host-resources-types::hrstoragefixeddiskhost-resources-mib::hrstoragetype.6 = OID: host-resources-types::hrstoragefixeddiskhost-resources-mib::hrstoragetype.7 = Oid:host-resources-types:: hrstoragefixeddiskhost-resources-mib::hrstoragetype.8 = Oid:host-resources-types:: hrstoragefixeddiskhost-resources-mib::hrstoragetype.9 = Oid:host-resources-types:: hrstoragefixeddiskhost-resources-mib::hrstoragetype.10 = Oid:host-resources-types:: hrstoragefixeddiskhost-resources-mib::hrstoragetype.11 = Oid:host-resources-types:: Hrstorageramhost-resources-mib::hrstoragedescr.1 = STRING:/vmfs/volumes/ 5d0548ee-62126bd1-5537-30262a317523host-resources-mib::hrstoragedescr.2 = STRING:/vmfs/volumes/ BECCCAE6-27D8D5C6-E47A-6EF1BABF5CC6HOST-RESOURCES-MIB::HRSTORAGEDESCR.3 = STRING:/vmfs/volumes/ 595C571E-A107B89C-252C-AC162D6E2444HOST-RESOURCES-MIB::HRSTORAGEDESCR.4 = STRING:/vmfs/volumes/ 5A13B818-EBF86368-5680-AC162D6E2444HOST-RESOURCES-MIB::HRSTORAGEDESCR.5 = STRING:/vmfs/volumeS/5A13B834-323B0B4E-290F-AC162D6E2444HOST-RESOURCES-MIB::HRSTORAGEDESCR.6 = STRING:/vmfs/volumes/ 5A13B867-E07E81D4-2ACD-AC162D6E2444HOST-RESOURCES-MIB::HRSTORAGEDESCR.7 = STRING:/vmfs/volumes/ 5A13B880-8BAABBF8-D6FF-AC162D6E2444HOST-RESOURCES-MIB::HRSTORAGEDESCR.8 = STRING:/vmfs/volumes/ 5A13CFF4-1E80A610-63B2-AC162D6E2444HOST-RESOURCES-MIB::HRSTORAGEDESCR.9 = STRING:/vmfs/volumes/ 5a1e48c8-6b5eefc4-f04e-ac162d6e1c38host-resources-mib::hrstoragedescr.10 = STRING:/vmfs/volumes/ 5a28dcf3-45c2e884-a6cb-ac162d6e2444host-resources-mib::hrstoragedescr.11 = String:real MemoryHOST-RESOURCES-MIB:: Hrstorageallocationunits.1 = integer:4096 Byteshost-resources-mib::hrstorageallocationunits.2 = integer:4096 Byteshost-resources-mib::hrstorageallocationunits.3 = integer:8192 Byteshost-resources-mib:: Hrstorageallocationunits.4 = integer:1048576 Byteshost-resources-mib::hrstorageallocationunits.5 = integer:1048576 byteshost-resources-mib::hrstorageallocationunits.6 = integer:1048576 Byteshost-resources-mib::hrstorageallocationunits.7 = integer:1048576 byteshost-resources-mib::hrstorageallocationunits.8 = integer:1048576 Bytes ...
After the SNMP is successful, the CHECK_SNMP can be used to write Nagios commands. I'm not repeating it here.
The third way, I see there is no ready-made script can be used directly, so I do not have to toss it.
can refer to this blog post, someone on the internet wrote a script in Perl, we download after the direct call on the line. Of course, make sure that the relevant modules are installed
http://www.bujarra.com/nagios-monitorizando-hosts-esxi/?lang=en
This is also very easy, common CPU, memory, storage, network monitoring are included
[[email protected] check_vmware_api-master]# ./check_vmware_api.pl -H sydesx1 -f check_vmware_api.auth -l mem -s usage -w 80 -c 90CHECK_VMWARE_API.PL OK - mem usage=60.00 % | mem_usage=60.00%;80;90[[email protected] check_vmware_api-master]# ./check_vmware_api.pl -H sydesx1 -f check_vmware_api.auth -l cpu -s usage -w 80 -c 90CHECK_VMWARE_API.PL OK - cpu usage=10.56 % | cpu_usage=10.56%;80;90
Nagios Monitors ESXi