WMI Query
Anthony Montibello
amontibello at gmail.com
Fri Oct 7 07:44:11 CEST 2005
Have you tested the command from the command line?
before implementing a WMI CHeck in NC_Net it should be tested via the
command line, to make sure you get the desired results.
Read the help Files.
./check_nt --help=WMICHECK -should be run from command line it returns
mutiple lines
./check_nt --help=WMICOUNTER -can use -c and -w against query
./check_nt --help=WMICAT - should be used in nagios instead of WMICHECK
and the Readme from NC_Net
This command will not work.. the syntax is wrong and it does not define a
Query
command_line $USER1$check_nt -H $HOSTADDRESS$ -v WMICHECK -l
"cimv2/win32_logicaldrive"
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)
-l "cimv2^*^win32_logicaldisk"
-l "cimv2^select * from win32_logicaldisk"
-l "cimv2&*&win32_logicaldisk"
-l "cimv2&select * from win32_logicaldisk"
as for the command:
command_line /usr/local/nagios/libexec/check_nt -H $HOSTADDRESS$ -v WMICHECK
-l "cimv2^select name,freespace,deviceid,status from win32_DiskDrive"
win32_DiskDrive does not have Freespace remove it and it should work:
-l "cimv2^select name,deviceid,status from win32_diskdrive"
As for the command:
command_line $USER$/check_nt -H $HOSTADDRESS$ -v WMICHECK -l "cimv2^select
DeviceID,Status from win32_DiskDrive"
THis ran OK on my system?
steps to resolve the issue:
Make sure the Check_Nt works from the command line.
Make sure this Check_nt is in the libexec directory of Nagios.
Check the permissions of check_nt to make sure user Nagios can run it.
For the most part Check_nt should always return a 0,1,2,3 so it may be a
permission or missing file issue.
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.
WMICAT should be used instead of WMICHECK in nagios.
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.)
-v WMICOUNTER -l "cimv2^select freespace from win32_logicaldisk where name
!= 'a:' " -c 1000000000
for more information and on WMI query see msdn.com <http://msdn.com>:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wql_sql_for_wmi.asp
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.
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.
I hope this helps clarifying some of the usage of WMI with NC_Net
TOny
amontibello at shatterit.com
On 10/5/05, Gaston_Perez at itginc.com <Gaston_Perez at itginc.com> wrote:
>
> 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
>
> # 'WMI Harddrive check' command definition
>
> define command{
>
> command_name check_nt_wmihdd
>
> command_line $USER1$check_nt -H $HOSTADDRESS$ -v WMICHECK -l
> "cimv2/win32_logicaldrive"
>
> }
>
> I have also tried this
>
> command_line /usr/local/nagios/libexec/check_nt -H $HOSTADDRESS$ -v
> WMICHECK -l "cimv2^select name,freespace,deviceid,status from
> win32_DiskDrive"
>
> }
>
> And this
>
> command_line $USER$/check_nt -H $HOSTADDRESS$ -v WMICHECK -l "cimv2^select
> DeviceID,Status from win32_DiskDrive"
>
> }
>
> Here is my services command
>
> define service{
>
> use check-nt-service
>
> register 1
>
> host_name server1
>
> service_description WMI HDD
>
> check_command check_nt_wmihdd
>
> max_check_attempts 3
>
> normal_check_interval 5
>
> retry_check_interval 3
>
> check_period 24x7
>
> notification_interval 120
>
> notification_period workhours
>
> notification_options w,c,r
>
> contact_groups prodsupp
>
> }
>
> Response I have seen from the server is
>
> (Return code of 127 is out of bounds - plugin may be missing)
>
> Nagios Log displays this
>
> [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.
>
> When I ran the first check command statement above this is the output to
> the Nagios log
>
> rad-db01;WMI HDD;CRITICAL;HARD;3;(Return code of 127 is out of bounds -
> plugin may be missing)
>
> 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
>
> -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
> 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
> -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20051007/f9045da0/attachment.html>
More information about the Users
mailing list