{"id":4722,"date":"2017-04-13T23:27:07","date_gmt":"2017-04-14T04:27:07","guid":{"rendered":"http:\/\/cdnhost.net\/?p=4722"},"modified":"2017-04-13T23:27:07","modified_gmt":"2017-04-14T04:27:07","slug":"how-to-properly-monitor-your-dell-raid-and-physical-disks-using-vmware-esxi-5-5","status":"publish","type":"post","link":"https:\/\/cdnhost.net\/content\/how-to-properly-monitor-your-dell-raid-and-physical-disks-using-vmware-esxi-5-5\/","title":{"rendered":"How to properly monitor your Dell RAID and physical disks using VMWare ESXi 5.5"},"content":{"rendered":"<p>Steps are required.<\/p>\n<p>&nbsp;<\/p>\n<p>1. download VMWare CLI\u00a0https:\/\/my.vmware.com\/group\/vmware\/details?downloadGroup=VCLI550&amp;productId=352<\/p>\n<p>2.<\/p>\n<p>Download check_megaraid_sas @ <a href=\"http:\/\/www.techno-obscura.com\/~delgado\/code\/check_megaraid_sas\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.techno-obscura.com\/~delgado\/code\/check_megaraid_sas<\/a><br \/>\na change has to be made in the script to make it report correctly:<\/p>\n<p>on line 144, change<\/p>\n<p>if ( m\/Size\\s*:\\s*((\\d+\\.?\\d*)\\s*(MB|GB|TB))\/ ) {<\/p>\n<p>to<\/p>\n<p>if ( m\/^Size\\s*:\\s*((\\d+\\.?\\d*)\\s*(MB|GB|TB))\/ ) {<\/p>\n<p>Copy both MegaCli and check_megaraid_sas to your vmware host<br \/>\ncopy MegaCli \/usr\/bin\/<br \/>\nchmod +x check_megaraid_sas<br \/>\ncopy check_megaraid_sas \/usr\/share\/snmp\/<\/p>\n<p>3. test that it&#8217;s working<\/p>\n<p>Now check your megaraid controller from the command line-<br \/>\n\/usr\/share\/snmp\/check_megaraid_sas -s (num of spares)<\/p>\n<p>from a good system, you should get:<br \/>\n\/usr\/share\/snmp\/check_megaraid_sas -s 3<br \/>\nOK: 0:0:RAID-5:3 drives:271.899GB:Optimal 0:1:RAID-1:2 drives:135.899GB:Optimal 0:2:RAID-1:2 drives:135.899GB:Optimal 0:3:RAID-5:3 drives:271.899GB:Optimal 0:4:RAID-5:3 drives:271.898GB:Optimal 0:5:RAID-5:8 drives:951.794GB:Optimal Drives:24 Hotspare(s):3<\/p>\n<p>a system starting to have trouble:<br \/>\n\/usr\/share\/snmp\/check_megaraid_sas -s 3<br \/>\nWARNING: 0:0:RAID-5:3 drives:271.945GB:Optimal 0:1:RAID-1:2 drives:135.972GB:Optimal 0:2:RAID-1:2 drives:135.972GB:Optimal 0:3:RAID-5:3 drives:271.945GB:Optimal 0:4:RAID-5:3 drives:271.945GB:Optimal 0:5:RAID-5:8 drives:951.808GB:Optimal Drives:23 Hotspare(s):2 (of 3)<\/p>\n<p>(yes I know, raid5 bad bad bad, tell that to the customer who insists on it&#8230;)<\/p>\n<p>4.<\/p>\n<p>now to edit \/etc\/snmp\/snmpd.conf<br \/>\nIn the section called : Access Control<br \/>\nscroll down until you find &#8220;Third, create a view for use to let the group have rights to:<\/p>\n<p>you&#8217;ll need to add<br \/>\nview systemview included .1.3.6.1.4.1.6876.99999<\/p>\n<p>now scroll down until you find: Executable\/scripts<br \/>\nAdd in<br \/>\nexec .1.3.6.1.4.1.6876.99999.2 check_megaraid_sas \/usr\/share\/snmp\/check_megaraid_sas -s 3<\/p>\n<p>note, the -s shows how many active spares you have assigned! if any are missing, that&#8217;s usually a sign of a problem&#8230;<\/p>\n<p>now, save and restart snmpd<\/p>\n<p>service snmpd restart<\/p>\n<p>now, from nagios machine:<\/p>\n<p>snmpwalk -v 1 -c public &lt;HOSTNAME or IP&gt; .1.3.6.1.4.1.6876.99999<\/p>\n<p>this will walk through (and hopefully) display the output of your script. if it works, you should wind up with:<\/p>\n<p>SNMPv2-SMI::enterprises.6876.99999.2.1.1 = INTEGER: 1<br \/>\nSNMPv2-SMI::enterprises.6876.99999.2.2.1 = STRING: &#8220;check_megaraid_sas&#8221;<br \/>\nSNMPv2-SMI::enterprises.6876.99999.2.3.1 = STRING: &#8220;\/usr\/share\/snmp\/check_megaraid_sas -s 3&#8221;<br \/>\nSNMPv2-SMI::enterprises.6876.99999.2.100.1 = INTEGER: 0<br \/>\nSNMPv2-SMI::enterprises.6876.99999.2.101.1 = STRING: &#8220;OK: 0:0:RAID-5:3 drives:271.899GB:Optimal 0:1:RAID-1:2 drives:135.899GB:Optimal 0:2:RAID-1:2 drives:135.899GB:Optimal 0:3:RAID-5:3 drives:271.899GB:Optimal 0:4:RAID-5:3 drives:271.898GB:Optimal 0:5:RAID-5:8 drives:951.794GB:Optimal Drives:24 Hotspare(s):3&#8221;<br \/>\nSNMPv2-SMI::enterprises.6876.99999.2.102.1 = INTEGER: 0<br \/>\nSNMPv2-SMI::enterprises.6876.99999.2.103.1 = &#8220;&#8221;<\/p>\n<p>5.<\/p>\n<div class=\"how-to-step steps-content \">\n<div class=\"step-content\">\n<p>First part done! *whew*<\/p>\n<p>Now to pull this into nagios!<\/p>\n<p>you&#8217;ll notice from this part of the reply, that the only thing we really care about is<\/p>\n<p>SNMPv2-SMI::enterprises.6876.99999.2.101.1 = STRING: &#8220;OK: 0:0:RAID-5:3 drives:271.899GB:Optimal 0:1:RAID-1:2 drives:135.899GB:Optimal 0:2:RAID-1:2 drives:135.899GB:Optimal 0:3:RAID-5:3 drives:271.899GB:Optimal 0:4:RAID-5:3 drives:271.898GB:Optimal 0:5:RAID-5:8 drives:951.794GB:Optimal Drives:24 Hotspare(s):3&#8221;<\/p>\n<p>This is the output of your script. you&#8217;ll need to have something else to pull that in!<\/p>\n<p>First thing is to create the command for nagios to use:<br \/>\nI store mine in a file under \/etc\/nagios-plugins\/config\/check_megaraid_snmp.cfg<br \/>\ncat check_megaraid_snmp.cfg<\/p>\n<p># &#8216;check_megaraid_snmp&#8217; command definition<br \/>\ndefine command{<br \/>\ncommand_name check_megaraid_snmp<br \/>\ncommand_line \/usr\/lib\/nagios\/plugins\/check_megaraid_snmp $HOSTADDRESS<br \/>\n}<\/p>\n<p>save and close it.<\/p>\n<p>check the script for correctness by running<\/p>\n<p>\/usr\/sbin\/nagios3 -v \/etc\/nagios3\/nagios.cfg<\/p>\n<p>If you get an answer of: Things look okay &#8211; blah blah blah, then go onto the next step<\/p>\n<\/div>\n<\/div>\n<div class=\"how-to-step steps-content \">\n<div class=\"step-header\">\n<div class=\"number\">5<\/div>\n<h3>Configuring Nagios, part 2 (or the wall of TL;DR)<\/h3>\n<\/div>\n<div class=\"step-content\">\n<p>The script! you&#8217;ll notice we named it check_megaraid_snmp above, so let&#8217;s create the file now<br \/>\nvi \/usr\/lib\/nagios\/plugins\/check_megaraid_snmp (or whatever flavor of editor you prefer)<br \/>\n&#8212;&#8211;<br \/>\n#!\/bin\/sh<\/p>\n<p>if [ $# -lt 1 ]; then<br \/>\necho &#8220;Usage: $0 &lt;host&gt;&#8221;<br \/>\nexit -1<br \/>\nfi<\/p>\n<p>HOST=$1<\/p>\n<p>TMPFILE=`mktemp \/tmp\/check_megaraid_snmp.XXXXXX`<\/p>\n<p>FOUND=`snmpget $HOST -c public -v 1 .1.3.6.1.4.1.6876.99999.2.101.1 | cut -d&#8221;\\&#8221;&#8221; -f 2 &gt; $TMPFILE 2&gt;&amp;1`<br \/>\nRES=$?<\/p>\n<p>if [ $RES != 0 ]; then<br \/>\ncat $TMPFILE<br \/>\n\/bin\/rm -f $TMPFILE<br \/>\nexit 2<br \/>\nfi<\/p>\n<p>STATUS=`cat $TMPFILE | cut -d&#8221;:&#8221; -f 1`<br \/>\necho $STATUS<br \/>\nCHRS=`echo $STATUS | grep OK`<br \/>\nTESTVAL=$?<br \/>\nif [ $TESTVAL -eq 0 ]; then<br \/>\n#echo &#8220;OK!&#8221;<br \/>\nRETVAL=0<br \/>\nelse<br \/>\nCHRS=`echo $STATUS | grep WARNING`<br \/>\nTESTVAL=$?<br \/>\nif [ $TESTVAL -eq 0 ]; then<br \/>\n#echo &#8220;Warning, something&#8217;s wrong&#8221;<br \/>\nRETVAL=1<br \/>\nelse<br \/>\nCHRS=`echo $STATUS | grep CRITICAL`<br \/>\nTESTVAL=$?<br \/>\nif [ $TESTVAL -ne 0 ]; then<br \/>\n#echo &#8220;you&#8217;re screwed&#8221;<br \/>\nRETVAL=3<br \/>\nelse<br \/>\nRETVAL=2<br \/>\nfi<br \/>\nfi<br \/>\nfi<\/p>\n<p>#echo &#8216;end&#8217;<br \/>\ncat $TMPFILE<br \/>\n\/bin\/rm -f $TMPFILE<br \/>\necho $RETSTR<br \/>\n#echo $RETVAL<br \/>\nexit $RETVAL<\/p>\n<p>&#8212;-<\/p>\n<p>*whew* that&#8217;s a mouthful. save it and close. recheck nagios, then restart it<\/p>\n<\/div>\n<\/div>\n<div class=\"how-to-step steps-content \">\n<div class=\"step-header\">\n<div class=\"number\">6<\/div>\n<h3>Configuring Nagios, part 3 (The end&#8230; supposedly)<\/h3>\n<\/div>\n<div class=\"step-content\">\n<p>Now for the final part! let&#8217;s add the command to your host check!<\/p>\n<p>Inside the host file for your vm host, add this definition:<\/p>\n<p>define service{<br \/>\nuse generic-service ; Name of service template to use<br \/>\nhost_name acpevmsqlhost01<br \/>\nservice_description MegaRaid status<br \/>\ncheck_command check_megaraid_snmp<br \/>\n}<\/p>\n<p>save, close, recheck nagios, restart<\/p>\n<p>Now check your nagios site for status:<\/p>\n<\/div>\n<\/div>\n<div class=\"how-to-step steps-content \">\n<div class=\"step-header\">\n<div class=\"number\">7<\/div>\n<h3>Good output in Nagios<\/h3>\n<\/div>\n<div class=\"step-image resized\"><img decoding=\"async\" src=\"https:\/\/static.spiceworks.com\/images\/how_to_steps\/0000\/6962\/example_good1.png\" alt=\"\" \/><\/div>\n<\/div>\n<p>If this helped you, please refer people for our services! and LIKE us on facebook https:\/\/facebook.com\/cdnhost<\/p>\n<p>&nbsp;<\/p>\n<p>https:\/\/cdnhost.net<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Steps are required. &nbsp; 1. download VMWare CLI\u00a0https:\/\/my.vmware.com\/group\/vmware\/details?downloadGroup=VCLI550&amp;productId=352 2. Download check_megaraid_sas @ http:\/\/www.techno-obscura.com\/~delgado\/code\/check_megaraid_sas a change has to be made in the script to make it report correctly: on line 144, change if ( m\/Size\\s*:\\s*((\\d+\\.?\\d*)\\s*(MB|GB|TB))\/ ) { to if ( m\/^Size\\s*:\\s*((\\d+\\.?\\d*)\\s*(MB|GB|TB))\/ ) { Copy both MegaCli and check_megaraid_sas to your vmware host copy MegaCli \/usr\/bin\/ chmod [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-4722","post","type-post","status-publish","format-standard","hentry","category-blog","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"builder_content":"","_links":{"self":[{"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/posts\/4722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/comments?post=4722"}],"version-history":[{"count":0,"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/posts\/4722\/revisions"}],"wp:attachment":[{"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/media?parent=4722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/categories?post=4722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cdnhost.net\/content\/wp-json\/wp\/v2\/tags?post=4722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}