<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.5726" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I've hacked something together that seems to work 
using WSH and WMI (no smartmontools).</FONT></DIV>
<DIV><FONT face=Arial size=2>It displays the following for the "Service State 
Information":</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><TR><TD class=dataVar><FONT face=Arial size=2>    Current 
Status: OK   (for 0d 0h 14m 52s)</TD></TR> </FONT></DIV>
<DIV><TR><TD class=dataVar valign="top"><FONT face=Arial 
size=2>    Status Information:</TD><TD class=dataVal>SMART Status 
is OK<BR>    Performance Data:</TD><TD class=dataVal>WDC 
WD1500HLFS-01G6U0 139 GB</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>In "nsc.ini" on the client, I've made the following 
changes:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>    uncommented 
NRPEListener.dll</FONT></DIV>
<DIV><FONT face=Arial size=2>    added to </FONT><FONT face=Arial 
size=2>[External Scripts]<BR>    check_smart_disk0=cscript.exe 
//T:30 //NoLogo "C:\Program Files\NSClient++\scripts\smart.vbs" 
0<BR>    check_smart_disk1=cscript.exe //T:30 //NoLogo 
"C:\Program Files\NSClient++\scripts\smart.vbs" 1</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The file "smart.vbs" contains:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>    set args = 
wscript.arguments<BR>    drive = Cint(args(0))</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>    strComputer = "."</FONT></DIV>
<DIV><FONT face=Arial size=2>    Set objWMIService = 
GetObject("winmgmts:" _<BR>    & 
"{impersonationLevel=impersonate}!\\" & strComputer _<BR>    
& "\root\cimv2")</FONT></DIV>
<DIV><FONT face=Arial size=2><BR>    Set diskset = 
objWMIService.ExecQuery _<BR>        ("Select * 
from Win32_DiskDrive")</DIV>
<DIV> </DIV>
<DIV>    For Each disk in diskset<BR>    If 
disk.index = drive Then<BR>       Select Case 
Disk.Status<BR>         Case 
"OK"<BR>           WScript.Echo 
"SMART Status is OK| " & Disk.Model & " " & 
Int(Disk.Size/1073741824) & " 
GB"<BR>           
WScript.Quit(0)<BR>         Case 
Else<BR>           Wscript.Echo 
"SMART Status is " & 
Disk.Status<BR>           
Wscript.quit(1)<BR>        End Select<BR>  
    End If<BR>    next</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>There are actually a bunch of different error 
states, but I figure I want to know about anything other than "OK".  I 
kept the level as "WARNING", as I don't know if it's going to be 
useful until I get more experience with the real-life disk 
error messages.  I'm aware that disks sometimes die with no 
warning from SMART.   </FONT><FONT face=Arial size=2>I've never used 
visual basic before, so feel free to improve on this.  I just cobbled 
together little snippets of code I found via google.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>On the Nagios server side,  the service and 
hostgroup definitions look like the following:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>define 
service{<BR>        
use                     
generic-service<BR>        
hostgroup_name               
check_smart_disk0<BR>        
service_description     SMART Disk 
0<BR>        
check_command           
check_nrpe!check_smart_disk0<BR>        
check_interval  720<BR>        
}<BR>define service{<BR>        
use                     
generic-service<BR>        
hostgroup_name               
check_smart_disk1<BR>        
service_description     SMART Disk 
1<BR>        
check_command           
check_nrpe!check_smart_disk1<BR>        
check_interval  720<BR>        
}</FONT></DIV>
<DIV><FONT face=Arial size=2><BR>define 
hostgroup{<BR>        hostgroup_name  
check_smart_disk0<BR>        
alias           Windows SMART 
Disk0 status<BR>        
members         host1, host2, 
host3<BR>         }<BR>define 
hostgroup{<BR>        hostgroup_name  
check_smart_disk1<BR>        
alias           Windows SMART 
Disk1 status<BR>        
members         
host2<BR>        }<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>I do have to know ahead of time the number of disks 
to check on the client.  Seems to be working so far.</FONT></DIV>
<DIV><FONT face=Arial size=2>-e</DIV></FONT></TD></TR>
<BLOCKQUOTE dir=ltr 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=epearce@amberpoint.com href="mailto:epearce@amberpoint.com">Eric 
  Pearce</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=amontibello@gmail.com 
  href="mailto:amontibello@gmail.com">Anthony Montibello</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Cc:</B> <A 
  title=nagios-users@lists.sourceforge.net 
  href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, January 15, 2009 3:14 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Nagios-users] Windows disk 
  health monitoring with smartmontoolsl/NSClient++?</DIV>
  <DIV><BR></DIV>
  <DIV>
  <DIV class=body>
  <P><FONT face=Arial size=2>Thanks for the tip -  I think I'm making some 
  progress, i.e. </FONT></P>
  <P><FONT face=Arial size=2> C:\Program 
  Files\NSClient++>"nsclient++.exe" CheckWMI Select Status from 
  Win32_DiskDrive</FONT></P>
  <P><FONT face=Arial size=2> \NSClient++.cpp(370) Attempting to start 
  NSCLient++ - 0.3.5.2 2008-09-24 </FONT></P>
  <P><FONT face=Arial size=2>l \NSClient++.cpp(476) NSCLient++ - 0.3.5.2 
  2008-09-24 Started! </FONT></P>
  <P><FONT face=Arial size=2>l \CheckWMI.cpp(306) |--------+ </FONT></P>
  <P><FONT face=Arial size=2>l \CheckWMI.cpp(307) | Status | </FONT></P>
  <P><FONT face=Arial size=2>l \CheckWMI.cpp(308) |--------+ </FONT></P>
  <P><FONT face=Arial size=2>l \CheckWMI.cpp(317) | OK | </FONT></P>
  <P><FONT face=Arial size=2>l \CheckWMI.cpp(319) |--------+ </FONT></P>
  <P><FONT face=Arial size=2>l \NSClient++.cpp(530) Attempting to stop 
  NSCLient++ - 0.3.5.2 2008-09-24 </FONT></P>
  <P><FONT face=Arial size=2>l \NSClient++.cpp(589) NSCLient++ - 0.3.5.2 
  2008-09-24 Stopped succcessfully </FONT></P>
  <P><FONT face=Arial size=2>But I dont' see how to turn this output into 
  something useful for Nagios, i.e. "OK", "WARNING", "CRITICAL". It appears that 
  the possible return values for "Status" are one of the following: 
  OK,Error,Degraded,Unknown,Pred Fail, Starting, Stopping, Service, Stressed, 
  NonRecover, No Contact or Lost Comm. I would be happy with "OK" resulting in a 
  Nagios "OK" and anything else being a "WARNING". Ideally, "WARNING" followed 
  by the "Status" output from WMI. Is there a way to do this using the  
  NSClient "filter" and Max/Min syntax?   </FONT></P>
  <P><FONT face=Arial size=2>Bonus question: What do you do if you have multiple 
  drives? I don't see any obvious way to specify a drive to check.</FONT></P>
  <P><FONT face=Arial size=2>Thanks </FONT></P>
  <P><FONT face=Arial size=2>-e</FONT> </P></DIV></DIV>
  <BLOCKQUOTE 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
    <A title=amontibello@gmail.com href="mailto:amontibello@gmail.com">Anthony 
    Montibello</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A title=epearce@amberpoint.com 
    href="mailto:epearce@amberpoint.com">Eric Pearce</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>Cc:</B> <A 
    title=nagios-users@lists.sourceforge.net 
    href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</A> 
    </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, January 14, 2009 8:58 
    PM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Nagios-users] Windows 
    disk health monitoring with smartmontoolsl/NSClient++?</DIV>
    <DIV><BR></DIV>
    <DIV>USe WMI: </DIV>
    <DIV>the path to the smart data:</DIV>
    <DIV>root/Cimv2/Win32_DiskDrive/</DIV>
    <DIV>[Instance] --> Status<BR></DIV>
    <DIV> </DIV>
    <DIV>Hope this helps</DIV>
    <DIV>Tony (Author of NC_Net)<BR></DIV>
    <DIV class=gmail_quote>On Tue, Jan 13, 2009 at 10:49 PM, Eric Pearce <SPAN 
    dir=ltr><<A 
    href="mailto:epearce@amberpoint.com">epearce@amberpoint.com</A>></SPAN> 
    wrote:<BR>
    <BLOCKQUOTE class=gmail_quote 
    style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
      <DIV bgcolor="#ffffff">
      <DIV><FONT face=Arial size=2>I'd like to get SMART disk health status 
      for Windows machines.  It looks like smartctl would work fine on 
      Windows - has someone got it working with NSClient++?</FONT></DIV>
      <DIV><FONT face=Arial size=2>I've found some people asking about this in 
      the list archives, but haven't found any concrete examples.</FONT></DIV>
      <DIV><FONT face=Arial size=2>All I'm looking for is a basic "OK" or 
      "something bad is going to happen soon" alert from Nagios.</FONT></DIV>
      <DIV><FONT face=Arial size=2>Thanks</FONT></DIV>
      <DIV><FONT face=Arial size=2>-e</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT> </DIV>
      <DIV><FONT face=Arial 
      size=2></FONT> </DIV></DIV><BR>------------------------------------------------------------------------------<BR>This 
      SF.net email is sponsored by:<BR>SourcForge Community<BR>SourceForge wants 
      to tell your story.<BR><A href="http://p.sf.net/sfu/sf-spreadtheword" 
      target=_blank>http://p.sf.net/sfu/sf-spreadtheword</A><BR>_______________________________________________<BR>Nagios-users 
      mailing list<BR><A 
      href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</A><BR><A 
      href="https://lists.sourceforge.net/lists/listinfo/nagios-users" 
      target=_blank>https://lists.sourceforge.net/lists/listinfo/nagios-users</A><BR>::: 
      Please include Nagios version, plugin version (-v) and OS when reporting 
      any issue.<BR>::: Messages without supporting info will risk being sent to 
      /dev/null<BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>