Page 1 of 1

NSCLIENT++ CHECK_LOGFILES NEED EXAMPLE

Posted: Wed Oct 21, 2015 11:06 am
by gogginl
I need to use the CHECK_LOGFILES with NSCLIENT++

I have successfully installed nsclient++ on a machine with a log files I need to scan.

I tried the nscp test (loaded plugin check_logfiles) but have no idea what parameters this takes

The internet pages I found don't seem to help me.

For example I tried the following;

nscp test
load check_logfiles
check_logfiles <filename> <pattern> BUT THIS IS NOT THE CORRECT PARAMTERS!

I was thinking this was a simple tool when I started? Any help on this would be appreciated.

Also any script that can be shared to do the same would be great!

Re: NSCLIENT++ CHECK_LOGFILES NEED EXAMPLE

Posted: Wed Oct 21, 2015 2:07 pm
by lmiltchev
Can you give us a little bit more info about how you installed check_logfiles? Did you install this plugin? Can you show us the nsclient.ini file?

Re: NSCLIENT++ CHECK_LOGFILES NEED EXAMPLE

Posted: Wed Oct 21, 2015 7:01 pm
by rajasegar
gogginl wrote:I need to use the CHECK_LOGFILES with NSCLIENT++

I have successfully installed nsclient++ on a machine with a log files I need to scan.

I tried the nscp test (loaded plugin check_logfiles) but have no idea what parameters this takes

The internet pages I found don't seem to help me.

For example I tried the following;

nscp test
load check_logfiles
check_logfiles <filename> <pattern> BUT THIS IS NOT THE CORRECT PARAMTERS!

I was thinking this was a simple tool when I started? Any help on this would be appreciated.

Also any script that can be shared to do the same would be great!
This uses the external check_logfiles which is the best log file scanner.
Dump the check_logfiles.exe in c:/Program Files/NSClient++/scripts

Create directory c:/Program Files/NSClient++/config
Create directory c:/Program Files/NSClient++/log
Dump all your check_logfiles config files in c:/Program Files/NSClient++/config
For more sample config files, type check_logfiles.exe --help or refer to this website
https://labs.consol.de/nagios/check_logfiles/

myconfigfile.cfg sample

Code: Select all

$seekfilesdir = 'C:\\Program Files\\NSClient++\\log';
# where the state information will be saved.

$protocolsdir = 'C:\\Program Files\\NSClient++\\log';
# where protocols with found patterns will be stored.

$scriptpath = 'C:\\Program Files\\NSClient++\\config';

# where scripts will be searched for.

$MACROS = {LOGDIR => "D:\\XGATE\\log"};

@searches = (
  {
    tag => 'ChannelPOG',
    logfile => '$LOGDIR$\\PogLog.log',
    criticalpatterns => ['processBracGate\(3\) Exception',
                         'processBracGate\(6\) Exception',
                         'processCMTGate\(1\) Exception',
                         'processCMTGate\(4\) Exception',
                         'processKotakGate\(8\) Exception',
                         'processMetroGate\(7\) Exception',
                         'processNiagaGate\(4\) Exception'],
    warningpatterns => ['##Nagios - Not Defined##'],
	options => 'nocase'
  }
);

Code: Select all

Ensure the following is there in nsclient.ini. I am using arguments or you can hard code the details here.

; A list of wrappped scripts (ie. using the template mechanism)
[/settings/external scripts/wrapped scripts]
check_logfiles = check_logfiles.exe $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$


; A list of templates for wrapped scripts
[/settings/external scripts/wrappings]
exe = scripts\\%SCRIPT% %ARGS%

Code: Select all

define service {
	host_name			myhost
	service_description		Log: ChannelPOG
	use				STPT-Mytemplate
	check_command			check_nrpe_win!check_logfiles!" -t 30"!" -f config\\myconfigfile.cfg"!!!!!
	max_check_attempts		1
	check_interval			5
	retry_interval			1
	register			1
	}	

Re: NSCLIENT++ CHECK_LOGFILES NEED EXAMPLE

Posted: Thu Oct 22, 2015 9:09 am
by hsmith
Thank you @rajasegar. Appreciate the post.

@gogginl, did this work out for you?