Filter over Windows Files


#1

Hi,

I have a couple of windows 2000 Server Boxes that i’m already monitoring with NSClient (CPU,MEM, DISKS, Services…).

So far so good… now i’ve got a request of checking a log file in one of them, this file is generated by a BI application (it doesn’t really matter ), but the point is i must find errors inside that file (at an specified time).

From a DOS console i can filter it easily with “find” command.

Does anyone know a way to achive this from nagios? or better, using nsclient?

Thanks in advance…
PD: excuse my poor english :blush:


#2

It is possible… but the file you need to search MUST ALWAYS have the same name… !!!

Add this to your nrpe.cfg file

command[backup_text_search]=c:\windows\system32\cscript.exe //NoLogo //T:30 c:\nrpe_nt\file_text_search.wsf “A” “Search String”

Then get the “file_text_search” from Nagios Exchange (nagiosexchange.org/NRPE_Plug … view%5D=88)
Extract this to (IN my case c:\nrpe_nt) you nrpe Directory

Then from your Nagios Box run
./check_nrpe -H $HOSTADDRESS$ -c file_text_search

You should get
OK: Search string has been found.

This will ONLY check for the TEXT YOU ADD to the command argument in nrpe.cfg.

Hope this helps


#3

Thanks for the reply…

Correct me if i’m wrong but i think i don’t have that file (nrpe.cfg) and i didn’t see it in the documentation of NSClient.

The only files i have are: pnsclient.exe, a cuple of .dll and counters.defs.
I guess you are making reference to another plugin.

is there any other way to execute a batch file in win2k ?

Cheers


#4

OK.
Get nrpe-2.0 for Nagios it is in there.
Install and Set it up as you need with port numbers etc (For Linu:evil: so it maches you windows machines (Port numbers that is!!)

Then do what I said in my first post… just noticed that some forward slash’s have been removed !!! ooooooops !!!

So put this in your nrpe.cfg file…

command[backup_text_search]=c:/$windows/$system32/$cscript.exe //NoLogo //T:30 c:/$nrpe_nt/$file_text_search.wsf “A” “Search String”


#5

DO NOT USE THE $ SIGNS !!!


#6

thanks!, it works great! Sadly i had to code smth in batch script for DOS. :S