NSClient++ 0.0.1 RC5 updated (and new CheckFileSize plugin)

Michael Medin michael at medin.name
Tue Mar 1 22:34:49 CET 2005


Hi,

First off sorry for the lateness, but I've been home sick the last week 
and been rather unproductive.
Anyways here is a new version that has a few new features and a few new 
fixes.

Mainly;
 * Improved thread safety in Core
This *might* fix the crash that someone had.

 + Added exception handling and logging in PDH code
This should give better error messages in these parts (as opposed to 
before when they silently failed).

+ New module for check size of files/directories
Hehe, bored last week I did a quick plug in to check the size of a file, 
group of files, directory.

 * Changed build to Dynamic link
Someone said this was better, I'm skeptical. Mainly this means (for non 
programmers) that there are now 3 DLLs distributed along with NSClient 
(and the files are smaller).

* Changed the default port to 12489.

* Added a simple/rough/quick check_nscp client for *nix (so now you can 
use the EventlogChecker that has been there for a while :)

Now for the details.
This build has an optional debug log "mode" that I would like everyone 
that run into problems to enable.
Edit NSC.ini and make sure this is not commented out: "debug=1". Also if 
you run into problems feel free to send along the log (NSC.log). And as 
usually you can run it with -test and use the console logger.

Secondly the new CheckFileSize plug-in is used along the following lines:
CheckFileSize&<option>&<option>
where <option> one of the following:
MaxWarn=<size gmkb>
MaxCrit=<size gmkb>
MinWarn=<size gmkb>
MinCrit=<size gmkb>
ShowAll
File=<path>
File:<shortname>=<path>

<size gmkb> is a size with a possible modifier letter (such as G for 
gigabyte, M for Megabyte, K for kilobyte etc)

This means that 
CheckFileSize&ShowAll&MaxWarn=1024M&MaxCrit=4096M&File:WIN=c:\WINDOWS\*.*
Will check all files under c:\windows and using the short name WIN, and 
warn if the size is above 1024megabytes and Critical if the size is 
above 4096megabytes.
On my computer this returns:
WIN: 1G (2110962363B)|WIN:2110962363:1073741824:4294967296

Known bugs:
returned size are truncated to G for instance the above should have been 
1.96G not 1G.
performance data only shows max warn and crit (not minimum)


Thirdly:
The Eventlog Checker

CheckEventLog&<logfile>&<Query string>&<Query string>...
This is rather complex, and I think next update will be a web interface 
for the SF page where I can start documenting these but a few simple 
ideas on how it works:
CheckEventLog&Application&warn.require.eventType=warnig&critical.require.eventType=error&truncate=1024&descriptions&all.exclude.eventSourceRege
xp=^(Win|Msi|NSClient\+\+|Userenv|ASP\.NET|LoadPerf|Outlook|ApplicatioE|NSClient).*

/Application
/log file (options are System, Security and whatever you have in your 
syslog)
/warn.require.eventType=warnig
/Means for an event to be considerd a warning it has to have event type 
"warning" (options are information, error, etc)
/critical.require.eventType=error
/Means for an event to be considerd an error it has to have event type 
"error.
/truncate=1024
/Truncate the response at 1024 chars (to prevent buffers from overflowing)
/descriptions
/Means we show description for events.
/all.exclude.eventSourceRegexp=^(Win|Msi|NSClient\+\+|Userenv|ASP\.NET|LoadPerf|Outlook|ApplicatioE|NSClient).*
/This means we exclude (from all, as in warning and error) all event 
sources matching this regular expression.

A quick note on "warn.require.eventType" they all look 
<type>.<action>.<key> where;
type is: warn, error, all
action is: require, exclude
and key can be one of the following:
eventType, eventSource, eventSourceRegexp, generatedBeforeDelta, 
generatedAfterDelta, writtenBeforeDelta, writtenAfterDelta, regexp
As I said this is rather complex and not easy, I will try to clear the 
documentation up, and also look at similar projects to see how they do 
things. This was just done so I could see if it was possible.


Fourth:
check_nscp is included under unix_client. This is a C client (hacked 
version of check_nt) for unix that is more generic and should work to 
send checks to NSClient++ (not regular NSClient), mainly I would use 
this only to play with CheckEventLog and CheckFileSize.

Usage: check_nscp -H host [-p port] -c command -s password [-t timeout]

Options:
-H, --hostname=HOST
  Name of the host to check
-p, --port=INTEGER
  Optional port number (default: 12489)
-s, --password <password>
  Password needed for the request
-c, --command <command>
  Command to execute on remote node
-t, --timeout=INTEGER
  Seconds before connection attempt times out (default: 10)
-h, --help
  Print this help screen
-V, --version
  Print version information

The -c <command> is they key, here you enter the *entire* command, as 
oposed to check_nt that has other arguments.
So -c 
'CheckFileSize&ShowAll&MaxWarn=1024M&MaxCrit=4096M&File:WIN=c:\WINDOWS\*.*' 
will do the Checksize exaple from before.

To compile this *I* did:
gcc -I. -I.. -I../lib -I../intl -I/include -g -O2 -MT check_nscp.o -MD 
-MP -c -o check_nscp.o check_nscp.c;
gcc -g -O2  -L. -L/usr/lib -o check_nscp check_nscp.o netutils.o utils.o 
../lib/libnagiosplug.a ../lib/libcoreutils.a -lnsl -lresolv -I/usr/include
But that was because that was what check_nt did on my computer, so if 
someone is good at making ./configure or make for *nix feel free to help 
me out.

Ohh, lastly: http://sourceforge.net/projects/nscplus/ is where you will 
find it :)


Anyways now I'm off for bed...

// Michael Medin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050301/3077eb3c/attachment.html>


More information about the Users mailing list