{"id":10189,"date":"2012-03-26T14:11:31","date_gmt":"2012-03-26T12:11:31","guid":{"rendered":"http:\/\/nolabnoparty.com\/?p=10189"},"modified":"2014-08-18T14:24:19","modified_gmt":"2014-08-18T12:24:19","slug":"monitor-esxi-servers-health-nagios","status":"publish","type":"post","link":"https:\/\/nolabnoparty.com\/en\/monitor-esxi-servers-health-nagios\/","title":{"rendered":"Monitor ESXi servers health with Nagios"},"content":{"rendered":"<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi1\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi1.jpg\" alt=\"hwesxi1\" width=\"602\" height=\"202\" border=\"0\" \/><\/p>\n<p>Monitoring\u00a0ESXi servers health is the keyword to keep the virtual infrastructure<strong> fully working<\/strong>\u00a0and the servers status under control.<\/p>\n<p>As monitoring systems, Nagios is the\u00a0solution I mostly use for the networks I manage. To check\u00a0<strong>VMware ESXi 4.x\/5.0<\/strong>\u00a0servers, there is a great\u00a0plugin called\u00a0<strong>check_esxi_hardware.py<\/strong> written by\u00a0<a href=\"http:\/\/www.claudiokuenzler.com\/nagios-plugins\/check_esxi_hardware.php\" target=\"_blank\" rel=\"noopener\">Claudio Kuenzler<\/a>\u00a0mentioned also in the <a href=\"http:\/\/communities.vmware.com\/docs\/DOC-7170\" target=\"_blank\" rel=\"noopener\">VMware community<\/a>.<\/p>\n<p><!--more-->Information reported by the plugin are the same as shown in the\u00a0<strong>vSphere Client <\/strong>navigating to <strong>Configuration tab \u2013&gt; Health Status<\/strong>.<\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi2\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi2.jpg\" alt=\"hwesxi2\" width=\"600\" height=\"228\" border=\"0\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"color: #666666;\">Prerequisites<\/span><\/h2>\n<p>To use the plugin, Nagios server requires the following components installed:<\/p>\n<ul>\n<li>Python<\/li>\n<li>Python extension <a href=\"http:\/\/pywbem.sourceforge.net\" target=\"_blank\" rel=\"noopener\">pywbem<\/a>.\u00a0Download the extension\u00a0<a href=\"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%2F&amp;ts=1332321760&amp;use_mirror=freefr\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2><span style=\"color: #666666;\">Procedure<\/span><\/h2>\n<p>In Nagios server, install\u00a0Python\u00a0using the command\u00a0<em>yum<\/em>.<\/p>\n<p><span style=\"color: #0000a0;\"># yum install python<\/span><\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi3\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi3.jpg\" alt=\"hwesxi3\" width=\"600\" height=\"258\" border=\"0\" \/><\/p>\n<p>Using <em>wget<\/em> command, download the Python <strong>pywbem<\/strong> extension in the system.<\/p>\n<p><span style=\"color: #0000a0;\"># wget http:\/\/downloads.sourceforge.net\/project\/pywbem\/pywbem\/pywbem-0.7\/<br \/>\npywbem-0.7.0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpywbem%2<br \/>\nFfiles%2F&amp;ts=1332321760&amp;use_mirror=freefr<\/span><\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi4\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi4.jpg\" alt=\"hwesxi4\" width=\"600\" height=\"420\" border=\"0\" \/><\/p>\n<p><strong>Unpack the downloaded file<\/strong>\u00a0using the\u00a0<em>tar\u00a0<\/em>command.<\/p>\n<p><span style=\"color: #0000a0;\"># tar -vxzf pywbem-0.7.0.tar.gz<\/span><\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi5\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi5.jpg\" alt=\"hwesxi5\" width=\"600\" height=\"242\" border=\"0\" \/><\/p>\n<p><strong>Install the pywbem extension<\/strong>\u00a0running from the console the command <strong>setup.py<\/strong>.<\/p>\n<p><span style=\"color: #0000a0;\"># cd pywbem-0.7.0<br \/>\n# python setup.py install<\/span><\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi6\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi6.jpg\" alt=\"hwesxi6\" width=\"600\" height=\"257\" border=\"0\" \/><\/p>\n<p>Download the\u00a0<a href=\"http:\/\/www.claudiokuenzler.com\/nagios-plugins\/check_esxi_hardware.py\" target=\"_blank\" rel=\"noopener\">check_esxi_hardware.py<\/a>\u00a0plugin and copy the file in the directory \u00a0<em>\/usr\/lib\/nagios\/plugins<\/em>.<\/p>\n<p><span style=\"color: #0000a0;\"># wget http:\/\/www.claudiokuenzler.com\/nagios-plugins\/check_esxi_hardware.py<br \/>\n# cp check_esxi_hardware.py \/usr\/lib\/nagios\/plugins\/<\/span><\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi7\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi7.jpg\" alt=\"hwesxi7\" width=\"600\" height=\"280\" border=\"0\" \/><\/p>\n<p>When the plugin\u00a0has been copied, make the file\u00a0<em>check_esxi_hardware.py<\/em> <strong>executable<\/strong>.<\/p>\n<p><span style=\"color: #0000a0;\"># chmod 755 check_esxi_hardware.py<\/span><\/p>\n<p><strong>The correct\u00a0syntax\u00a0<\/strong>to check the ESXi server is the following:<\/p>\n<pre class=\"brush: shell; gutter: true\">.\/check_esxi_hardware.py -H IP_address_esxi -U username -P password -V vendor<\/pre>\n<p>Where the\u00a0<em>username<\/em>\u00a0must be created in the\u00a0<strong>host ESXi and member of the root group<\/strong>. Since the use of the <strong>root user is not recommended<\/strong> for security reasons,\u00a0create a dedicated\u00a0account with\u00a0vSphere Client.<\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi8\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi8.jpg\" alt=\"hwesxi8\" width=\"383\" height=\"543\" border=\"0\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"color: #666666;\">Testing the plugin<\/span><\/h2>\n<p>When installation completes, the\u00a0plugin should be tested to check the correct functionality. To test an <strong>HP server health status<\/strong>\u00a0for instance, from the console type the command:<\/p>\n<p><span style=\"color: #0000a0;\"># .\/check_esxi_hardware.py -H esxi1 -U username -P password -V hp<\/span><\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi8\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi81.jpg\" alt=\"hwesxi8\" width=\"600\" height=\"89\" border=\"0\" \/><\/p>\n<p>If everything works as expected, you should receive a\u00a0message similar as reported in the\u00a0picture above.<\/p>\n<p>To make the hardware check\u00a0automatic, the <strong>correct command must be defined<\/strong> in Nagios.<\/p>\n<pre class=\"brush: shell; gutter: true\">define command { \r\ncommand_name   check_esxi_hardware \r\ncommand_line   $USER1$\/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ \u2013P $ARG2$ -V $ARG3$ \r\n}<\/pre>\n<p>The monitoring system is now able to to <strong>display the hardware health status<\/strong> of configured servers in the network.\u00a0For<strong> additional configuration<\/strong>\u00a0check the plugin author\u00a0<a href=\"http:\/\/www.claudiokuenzler.com\/nagios-plugins\/check_esxi_hardware.php\" target=\"_blank\" rel=\"noopener\">website<\/a>.<\/p>\n<p><img decoding=\"async\" style=\"background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;\" title=\"hwesxi10\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2012\/03\/hwesxi10.jpg\" alt=\"hwesxi10\" width=\"600\" height=\"72\" border=\"0\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>When the hardware status of ESXi servers is properly monitored, time requested to identify a\u00a0problem is lower\u00a0minimizing the risk of a service interruption.<br \/>\n<img decoding=\"async\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/images\/firma.jpg\" alt=\"\" title=\"\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Monitoring\u00a0ESXi servers health is the keyword to keep the virtual infrastructure fully working\u00a0and the servers status under control. As monitoring systems, Nagios is the\u00a0solution I mostly use for the networks I manage. To check\u00a0VMware ESXi 4.x\/5.0\u00a0servers, there is a great\u00a0plugin called\u00a0check_esxi_hardware.py written by\u00a0Claudio Kuenzler\u00a0mentioned also in the VMware community.<\/p>\n","protected":false},"author":3,"featured_media":4711,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rop_custom_images_group":[],"rop_custom_messages_group":[],"rop_publish_now":"initial","rop_publish_now_accounts":{"linkedin_93tdZWzMZc_93tdZWzMZc":"","facebook_2879994398731222_17841400390232720":"","twitter_113568041_113568041":"","mastodon_115463926174894442_115463926174894442":""},"rop_publish_now_history":[],"rop_publish_now_status":"pending","footnotes":""},"categories":[898,901,902],"tags":[580,1035,1036,634,1037],"class_list":["post-10189","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-monitoring-en","category-nagios-en","category-plugins-en","tag-esxi-en","tag-hardware-en","tag-health-check","tag-monitoring-en","tag-status-en","has_thumb"],"_links":{"self":[{"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/posts\/10189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/comments?post=10189"}],"version-history":[{"count":0,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/posts\/10189\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/media\/4711"}],"wp:attachment":[{"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/media?parent=10189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/categories?post=10189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/tags?post=10189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}