Nagios monitors servers that install ESXi (host)

Source: Internet
Author: User

First of all, the blog is mostly from the network, and a small part of its own monitoring process encountered problems. If there is infringement, please contact the notification!!!

Now Internet companies, have the ability to research and development monitoring system, either Zabbix or millet monitoring, also all two times development, and so on, may use Nagios not so much. Haha, make a record, for reference only!!!

< ready to deploy using Open-falcon (Xiaomi open source) >

Most of the following are from the network:

Common Dell Server hardware monitoring We can do this through nagios+openmanage, but how does the hardware monitoring of ESXi hosts in vsphere environments be implemented?

There are two types of scenarios:

1. Implemented through the Nagios plug-in Check_esx, which requires the installation of the VMware vsphere SDK for Perl toolkit

2. Implemented with Nagios plugin check_esxi_hardware.py, this plugin is written in Python.

Touching feeling the second way is simpler, Python is inherently built into Linux, do you need more reason?

First look at the official website introduction:

Http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php#.VWV5_JCUfTA

which

Requirements
-Python must be installed
-The Python extension PYWBEM must be installed
Windows users click here for a step-by-step the guide and the Install Python and PYWBEM on a Windows server.
-If There is a firewall between your monitoring and ESXi server, open ports 443 and 5989

These are the prerequisites for implementing monitoring:

1.python must be installed

Expansion pack PYWBEM for 2.python must be installed

3. The 443,5989 port of your ESXi host must be open to the Nagios monitoring side

OK, let's do it now!

1. Installing check_essi_hardware.py

    1. cd/usr/local/nagios/libexecwget http://Www.claudiokuenzler.com/nagios-plugins/check_esxi_ hardware.py
      This link download may fail, available online, and can be downloaded by itself.
      755 check_esxi_hardware.py
After the installation is complete, let's look at the parameters of this plugin:
    1.  [[email protected] libexec]#./check_ Esxi_hardware.pytraceback (most recent): File   " ./check_esxi_hardware.py  " , line 222 , in  <module>import pywbemimporterror:no module named pywbem[[email protected] libexec]#.  /check_esxi_hardware.py-htraceback (most recent call last): File  "  ./check_esxi_hardware.py   ", line 222 , in  <module>import pywbemimporterror:no Module named Pywbem    
Oh, the original PYWBEM module is not installed, then hurry to install it. 2. Installing Python's third-party modules
    1. cd/usr/local/srcwget http://downloads.sourceforge.net/project/pywbem/pywbem/pywbem-0.7/ pywbem-0.7.0.tar.gz?r=http%3a%2f%2fsourceforge.net%2fprojects%2fpywbem%2ffiles%2fpywbem%2f&ts=1299742557 &use_mirror=voxeltar-zxvf pywbem-0.7. 0 . TAR.GZCD Pywbem-0.7. 0  --record Files.txt
Or you can use Yum directly: (recommended)
    1. yum install pywbem -y
Try again, or an error:
    1. [Email protected] libexec]#./"./check_esxi_hardware.py"251in <module> 
Solve:
    1. [[email protected] libexec]# yum install python-setuptools -y
There is a lack of module errors, many domestic articles are source code to install plug-in modules, can also, but the problem is more; It is recommended to use Yum directly so that it is simple and does not depend on the problem . I am a CentOS 6.x system, direct use of Yum installation is not a problem, CentOS 7.x no test, please test yourself.

Using Yum basically does not involve the following issues.

Note: (1). do not use the pywbem-0.8.0 version, this version has a bug that makes our plugin unusable

(2). Python setup.py install--record files.txt The purpose of recording the installation directory is to facilitate the uninstallation of the plugin, cat Files.txt | Xargs RM-RF

3. Normal use of plug-ins

  1. [Email protected] libexec]#.check_esxi_hardware.pyno Parameters specifiedUsage:check_esxi_hardware.py https://hostname user Password system [verbose]example:check_esxi_hardware.py https://my-shiny-new-vmware-server Root Fakepassword dellOrusing Newstyle options:usage:check_esxi_hardware.py-H hostname-u username-p Password [-v system-v-P-I xx]example:check_esxi_hardware.py-H my-shiny-New-vmware-server-u root-p fakepassword-v Auto-I Ukor, verbosely:usage:check_esxi_hardware.py--host=hostname--user=username--pass=password [--vendor=system--verbose--perfdata--html=XX] Options:--version Show Program'S version number and exit-H,--help show ThisHelp message and Exitmandatory parameters:-H HOST,--host=Hostreport on HOST-U USER,--user=Useruser to connect as-P PASS,--pass=Passpassword,ifPassword matches file:<path>, first lineof given file 'll be used aspasswordoptional Parameters:-V VENDOR,--vendor=Vendorvendor Code:auto, Dell, HP, IBM, Intel, or unknown (default)-V,--verbose print status messages to stdout (default  isTo Bequiet)-P,--perfdata collect performance data forPnp4nagios (default  isNot to )-I XX,--html=xx generate HTML links forCountry XX (default  isNot to )-T TIMEOUT,--timeout=TimeouttimeoutinchSeconds-no effect on Windows (default=no timeout)-I IGNORE,--ignore=Ignorecomma-separated list of elements to ignore--no-power Don'T collect Power performance data--no-volts Don'T collect voltage performance data--no-current Don'T collect current performance data--no-temp Don'T collect temperature performance data--no-fan Don'T collect fan performance data
As can be seen from the above, this plugin requires a username and password to connect to the ESXi host to use. Of course, to keep it safe, just create a read-only user name and password on the ESXi host

Where-u user name-p password-V server type, with DELL,HP and so on, according to the actual situation-V Print status information-P combined Drawing tool drawing

-I output link to Dell or other official website, find solution-t Timeout time-I ignore a monitoring content

--no-power does not collect power information, the following are identical.

4. Set up read-only users for ESXi hosts

If you are using vcenter, you first need to turn on SSH monitoring of the ESXi host;


Connect to a host via VMware VSphere client, create a user (read only), note: The password has complexity requirements!

(1) First login to ESXi host, in the "Local Users and Groups" tab, right-click "Add" in the blank, you can add users.

(2) Set the Nagios user to "read-only role". In the Permissions tab, right-click Add Permissions in the space, and then press action

OK, the read-only user Nagios is added.

    1.  [[Email protected]176  libexec ]#./check_esxi_hardware.py-h 192.168 . 0.100 -u nagios-p nagios-v delltraceback (most Recent call last): File   ./check_esxi_ hardware.py  , line 617 , in  <module>wbemclient  = Pywbem. Wbemconnection (Hosturl, (User,password), No_verification=true) TypeError: __init__ () Got an unexpected keyword argument   " no_ Verification   " 

       

In this case, edit the check_esxi_hardware.py file to delete "No_verification=true" and then test:
    1. [Email protected]176192.168. 0.100 -u nagios-p qwe123,./,./-V dellunknown:authentication Error

"Unknown:authentication error" appears, continue processing SSH login to ESXi host, edit as follows:
    1. ~ # cat/etc/security/ is autogenerated and must isn't be edited. +:d cui:all+: Root:all+: Vpxuser:all+: Vslauser:all-: Nagios:all-:all: All

Remove the "-:nagios:all", in the second line with "+:NAGIOS:SFCB" this way is suitable for the use of infrequently added users, only one time, but often add users may cause access.conf changes, you need to set up a scheduled task add "+: NAGIOS:SFCB "
    1. 10.10. 10.1 -u nagios-p nagios-Server:dell Inc. PowerEdge R610 S/n: XXXXXX System bios:xxxxxxxxxx
OK, monitor normal.

6. Add it to the monitoring system below.

(1) First add the command in Commands.cfg.

    1. vim/usr/local/nagios/etc/objects/commands.cfg  define command {      command_name check_esxi_hardware      Command_line $USER 1$    
(2) Add service
    1. Define Service{
      ==> according to its own company configuration, define the monitoring service item;
      }
Restart nagios!!!


(3) Monitoring

One of the links in the href is our check_esxi_hardware.py-I parameter generation, which allows us to find solutions directly.

Nagios monitors servers that install ESXi (host)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.