This article is first published in the dark world.
To monitor esxi, we plan to monitor it through SNMP, which is relatively simple. However, to use SNMP for monitoring, you must enable the esxi SNMP service. The methods for enabling SNMP vary depending on the version number of esxi.
Let's first introduce how to enable esxi5.0. Before enabling it, we should first use the tool provided by esxi for detection. This tool is VMware vsphere CLI, which needs to be downloaded and installed separately.
Here I have downloaded and installed the VMware vsphere CLI tool, which we primarily use to provide a vicfg-snmp.pl script. Under the system command line, switch to the installation directory of the tool. As follows:
Cd "C: \ Program Files (x86) \ VMware vsphere CLI \ bin"
650) This. width = 650; "Title =" lip_image001 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image001 "src =" http://img1.51cto.com/attachment/201411/2/526870_1414913062jkwS.png "width =" 1139 "Height =" 430 "/>
Then, run the following command to perform Detection. As follows:
Vicfg-snmp.pl -- server 192.168.1.247 -- username root -- password [email protected] # -- show
The result is as follows:
650) This. width = 650; "Title =" lip_image002 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image002 "src =" http://img1.51cto.com/attachment/201411/2/526870_1414913062vPMb.png "width =" 676 "Height =" 308 "/>
Note the *** part marked in the figure: enabled: 0. Esxi5.0 does not currently enable the SNMP service.
Note that the vicfg-snmp.pl is used as follows:
Vicfg-snmp.pl -- server [esxi Host IP] -- username [Root Account] -- password [Root Account Password] -- show
The following describes how to Enable SNMP. log on to esxi5.0 through SSH and edit the/etc/vmware/snmp. xml file. As follows:
VI/etc/vmware/snmp. xml
<Config> <snmpsettings> <enable> true </enable> <communities> Public </communities> <targets> [email protected] Public </targets> </snmpsettings> </ config>
650) This. width = 650; "Title =" lip_image003 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image003 "src =" http://img1.51cto.com/attachment/201411/2/526870_1414913063JZNk.png "width =" 1072 "Height =" 219 "/>
Pay attention to the marked part of the *** section in the figure. True indicates that the SNMP service is enabled, public indicates the group name of SNMP, and [email protected] public indicates that SNMP uses port 161, which indicates the management IP address of 192.168.1.247esxi.
After the preceding modification, the SNMP service does not take effect immediately. You must restart the system to make the modification take effect. To restart the service, run the following command:
/Sbin/services. Sh restart
650) This. width = 650; "Title =" lip_image004 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image004 "src =" http://img1.51cto.com/attachment/201411/2/526870_1414913063MU9f.png "width =" 521 "Height =" 279 "/>
Note that after esxi5.0 executes this command, ssh and vsphere connections are disconnected.
After the restart, we use the vicfg-snmp.pl script again for detection, as shown below:
650) This. width = 650; "Title =" lip_image005 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image005 "src =" http://img1.51cto.com/attachment/201411/2/526870_1414913064kGmI.png "width =" 674 "Height =" 276 "/>
Through this, we can see the marked part: enabled: 1. Esxi5.0 has enabled the SNMP service.
Now we can monitor esxi5.0 through other monitoring software. Here I use Nagios for monitoring, as follows:
650) This. width = 650; "Title =" lip_image006 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image006 "src =" http://img1.51cto.com/attachment/201411/2/526870_1414913064xmGP.png "width =" 1138 "Height =" 177 "/>
Maybe you will say, why can't you simply enable the SNMP service through vsphere?
This is where esxi5.0 is different from esxi5.1 and later versions. Let's take a look at esxi5.0, log on to vsphere, configure-software, as shown below:
650) This. width = 650; "Title =" lip_image007 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image007 "src =" http://img1.51cto.com/attachment/201411/2/526870_14149130648uh5.png "width =" 776 "Height =" 413 "/>
We can see that there is no snmp service in the "service" option, so there is no way to enable it.
However, in esxi5.1 and later versions, we log on to vsphere to view the details as follows:
650) This. width = 650; "Title =" lip_image008 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image008 "src =" http://img1.51cto.com/attachment/201411/2/526870_14149130650Fii.png "width =" 985 "Height =" 442 "/>
We can see that esxi5.1 has integrated the SNMP service. However, an error is reported when I Enable SNMP in vsphere. Later, I started SNMP using esxi5.0 and directly modified the/etc/vmware/snmp. xml file. After the service is restarted, it can be enabled in vsphere as follows:
650) This. width = 650; "Title =" lip_image009 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image009 "src =" http://img1.51cto.com/attachment/201411/2/526870_1414913065rkA7.png "width =" 1200 "Height =" 127 "/>
650) This. width = 650; "Title =" lip_image010 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image010 "src =" http://img1.51cto.com/attachment/201411/2/526870_14149130660NpW.png "width =" 571 "Height =" 573 "/>
We can see that esxi5.1's SNMP service has been started properly.
Note that esxi5.1 will not disconnect the SSH connection but the vsphere connection will be disconnected when the/sbin/services. Sh restart command is used to restart the service. This is also different from esxi5.0.
Now we can monitor esxi5.1 through Nagios, as shown below:
650) This. width = 650; "Title =" lip_image011 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" lip_image011 "src =" http://img1.51cto.com/attachment/201411/2/526870_1414913066INVP.png "width =" 1166 "Height =" 163 "/>
The above describes how to enable the SNMP service in esxi.
This article from the "muddy world" blog, please be sure to keep this source http://ilanni.blog.51cto.com/526870/1570920
Mud: esxi enables the SNMP service