<div>Have you tested the command from the command line?</div>
<div> </div>
<div>before implementing a WMI CHeck in NC_Net it should be tested via the command line, to make sure you get the desired results.</div>
<div> </div>
<div>Read the help Files.</div>
<div>./check_nt --help=WMICHECK -should be run from command line it returns mutiple lines</div>
<div>./check_nt --help=WMICOUNTER -can use -c and -w against query</div>
<div>./check_nt --help=WMICAT - should be used in nagios instead of WMICHECK</div>
<div>and the Readme from NC_Net</div>
<div> </div>
<div>This command will not work.. the syntax is wrong and it does not define a Query</div>
<div><font size="2">command_line    $USER1$check_nt -H $HOSTADDRESS$ -v WMICHECK -l "cimv2/win32_logicaldrive"</font></div>
<div>It should be win32_logicaldisk and it needs to have a select part of the statement like * thus the following should be used instead (all the following are parsed to the same query)</div>
<div>-l "cimv2^*^win32_logicaldisk"</div>
<div>-l "cimv2^select * from win32_logicaldisk" </div>
<div>
<div>-l "cimv2&*&win32_logicaldisk"</div>
<div>-l "cimv2&select * from win32_logicaldisk" </div></div>
<div> </div>
<div>as for the command:</div>
<div><font size="2">command_line    /usr/local/nagios/libexec/check_nt -H $HOSTADDRESS$ -v WMICHECK -l "cimv2^select name,freespace,deviceid,status from win32_DiskDrive"</font></div>
<div><font size="2">win32_DiskDrive does not have Freespace remove it and it should work:</font></div>
<div>-l "cimv2^select name,deviceid,status from win32_diskdrive"</div>
<div> </div>
<div>As for the command:</div>
<div>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">command_line    $USER$/check_nt -H $HOSTADDRESS$ -v WMICHECK -l "cimv2^select DeviceID,Status from win32_DiskDrive"</span></font>
</p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">THis ran OK on my system? </span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></span></font> </p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">steps to resolve the issue:</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Make sure the Check_Nt works from the command line.</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Make sure this Check_nt is in the libexec directory of Nagios.</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Check the permissions of check_nt to make sure user Nagios can run it.</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">For the most part Check_nt should always return a 0,1,2,3 so it may be a permission or missing file issue.</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Also WMICHECK is really meant to be run from the command line because it returns multiple lines and NAgios only resolves the first line of the output.
</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">WMICAT should be used instead of WMICHECK in nagios.</span></font></p></div>
<div>A example of checking all drives freespace and then returning a critical if any drive has less than 1Gig of space is: (Make sure to exclude all drives that do not implement freespace like floppy and CR-Roms.)</div>
<div> -v WMICOUNTER -l "cimv2^select freespace from win32_logicaldisk where name != 'a:' "  -c 1000000000<br> </div>
<div>for more information and on WMI query see <a href="http://msdn.com">msdn.com</a>:</div>
<div><a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wql_sql_for_wmi.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wql_sql_for_wmi.asp</a></div>
<div> </div>
<div>NC_Net has been tested for use mostly with simple select statement, thus all queries should be checked using the command line before implementing in nagios.</div>
<div> </div>
<div>IF WMICAT and WMICOUNTER do not meed your nagios needs, Then WMICHECK can be used but should be invoked form a wrapper script that will parse the data into a more appropriate format for Nagios.</div>
<div> </div>
<div> </div>
<div>I hope this helps clarifying some of the usage of WMI with NC_Net</div>
<div> </div>
<div>TOny</div>
<div><a href="mailto:amontibello@shatterit.com">amontibello@shatterit.com</a></div>
<div> </div>
<div> </div>
<div><br> </div>
<div><span class="gmail_quote">On 10/5/05, <b class="gmail_sendername"><a href="mailto:Gaston_Perez@itginc.com">Gaston_Perez@itginc.com</a></b> <<a href="mailto:Gaston_Perez@itginc.com">Gaston_Perez@itginc.com</a>> wrote:
</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi All I am pretty new to Linux / Nagios and I am running Nagios 1.2, on a Redhat 9 server. I have Nagios plugins 1.42 installed on my server and on my windows 2003 servers I have nc_net 
2.28. I am trying to run wmi queries to check the physical hard drive to report back to me if one fails. Here is what I have in my checkcommands</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"># 'WMI Harddrive check' command definition</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">define command{</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        command_name    check_nt_wmihdd</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        command_line    $USER1$check_nt -H $HOSTADDRESS$ -v WMICHECK -l "cimv2/win32_logicaldrive"</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        }</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I have also tried this</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">       command_line    /usr/local/nagios/libexec/check_nt -H $HOSTADDRESS$ -v WMICHECK -l "cimv2^select name,freespace,deviceid,status from win32_DiskDrive"
</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">       }</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">And this</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">command_line    $USER$/check_nt -H $HOSTADDRESS$ -v WMICHECK -l "cimv2^select DeviceID,Status from win32_DiskDrive"</span></font>
</p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        }</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Here is my services command</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">define service{</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        use                             check-nt-service</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        register                        1</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        host_name                       server1</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        service_description             WMI HDD</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        check_command                   check_nt_wmihdd</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        max_check_attempts              3</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        normal_check_interval           5</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        retry_check_interval            3</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        check_period                    24x7</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        notification_interval           120</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        notification_period             workhours</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        notification_options            w,c,r</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        contact_groups                  prodsupp</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">        }</span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font></p>
<p><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Response I have seen from the server is</span></font></p>
<p><font face="Times New Roman" size="3"><span style="FONT-SIZE: 12pt">(Return code of 127 is out of bounds - plugin may be missing) </span></font></p>
<p><font face="Times New Roman" size="3"><span style="FONT-SIZE: 12pt">Nagios Log displays this</span></font></p>
<p><font face="Times New Roman" size="3"><span style="FONT-SIZE: 12pt">[1128541333] Warning: Return code of 127 for check of service 'WMI HDD' on host 'rad-db01' was out of bounds. Make sure the plugin you're trying to run actually exists.
</span></font></p>
<p><font face="Times New Roman" size="3"><span style="FONT-SIZE: 12pt">When I ran the first check command statement above this is the output to the Nagios log</span></font></p>
<p><font face="Times New Roman" size="3"><span style="FONT-SIZE: 12pt">rad-db01;WMI HDD;CRITICAL;HARD;3;(Return code of 127 is out of bounds - plugin may be missing)</span></font></p>
<p><font face="Times New Roman" size="3"><span style="FONT-SIZE: 12pt"> </span></font></p>
<p><font face="Times New Roman" size="3"><span style="FONT-SIZE: 12pt">Now I checked my nc_net plugin and it is the version (2.28) that can read wmi checks. I also verified that the Nagios plugins I am using (1.42)can understand wmi checks. Any help at all would be greatly appreciated, Thanks in Advance
</span></font><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></span></font></p></div><pre>-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
This message is for the named person's use only. This communication is for
informational purposes only and has been obtained from sources believed to
be reliable, but it is not necessarily complete and its accuracy cannot be
guaranteed. It is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation of any
transaction. Moreover, this material should not be construed to contain any
recommendation regarding, or opinion concerning, any security. It may
contain confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission. If
you receive this message in error, please immediately delete it and all
copies of it from your system, destroy any hard copies of it and notify the
sender. You must not, directly or indirectly, use, disclose, distribute,
print, or copy any part of this message if you are not the intended
recipient.  Any views expressed in this message are those of the individual
sender, except where the message states otherwise and the sender is
authorized to state them to be the views of any such entity.

ITG Inc. and/or its affiliates reserves the right to monitor and archive
all electronic communications through its network.

ITG Inc. Member NASD, SIPC
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
</pre></blockquote></div><br>