Page 2 of 2

Re: check_logfiles plugin

Posted: Mon Aug 09, 2021 4:14 pm
by ssax
Try deleting the protocols files from C:\Nagios\NSClient++, use the code below, and then test again:

Code: Select all

use File::stat;

$protocolsdir = 'C:/Nagios/NSClient++';
$seekfilesdir = 'C:/Nagios/NSClient++';

my @files = sort {stat($a)->mtime <=> stat($b)->mtime} glob '"C:\Program Files\Apache Software Foundation\Tomcat 8.5_Tomcat8_BMC_SmartIT\logs\localhost.*.log"';
my $latest_file = $files[-1];

@searches = ();

push(@searches, {
    tag => basename("$latest_file"),
    logfile => "$latest_file",
    criticalpatterns => ['java.net.SocketException: Connection reset by peer']
});

# Need to end with this
1;
It's working on mine with the last as well with the same directory layout and files.

Re: check_logfiles plugin

Posted: Tue Aug 10, 2021 2:07 am
by deek
Tried , Im getting the same error . Is it something to do with the directory permission ?

Re: check_logfiles plugin

Posted: Tue Aug 10, 2021 4:01 pm
by ssax
It may be, are you running the nsclient++ service as Local System or a different users account?

What do the permissions show on C:\Nagios\NSClient++?

Try creating D:\testing and then change it to this:

Code: Select all

use File::stat;

$protocolsdir = 'D:\testing';
$seekfilesdir = 'D:\testing';

my @files = sort {stat($a)->mtime <=> stat($b)->mtime} glob '"C:\Program Files\Apache Software Foundation\Tomcat 8.5_Tomcat8_BMC_SmartIT\logs\localhost.*.log"';
my $latest_file = $files[-1];

@searches = ();

push(@searches, {
    tag => basename("$latest_file"),
    logfile => "$latest_file",
    criticalpatterns => ['java.net.SocketException: Connection reset by peer']
});

# Need to end with this
1;

Re: check_logfiles plugin

Posted: Wed Aug 11, 2021 9:04 am
by deek
nsclient++ is running as Local system .

I created D:\testing and tries , but im getting same output .

[nagios@abcd ~]$ /usr/local/nagios/libexec/check_nrpe -H 172.**.***.** -u -t 100 -c check_logfile_Tomcat8_BMC
CRITICAL - (1 errors, 1 unknown in Tomcat8_BMC.protocol-2021-08-11-05-28-18) - cannot write status file D:\testing/Tomcat8_BMC...\! check your filesystem (permissions/usage/integrity) and disk devices |'.\_lines'=0 '.\_warnings'=0 '.\_criticals'=1 '.\_unknowns'=1


Tomcat8_BMC.protocol-2021-08-11-05-28-18 file :
CRITICAL Errors in .\ (tag .\)
cannot write status file D:\testing/Tomcat8_BMC...\! check your filesystem (permissions/usage/integrity) and disk devices
UNKNOWN Errors in .\ (tag .\)
could not find logfile

Capture_nsclient.PNG

Re: check_logfiles plugin

Posted: Wed Aug 11, 2021 3:23 pm
by ssax
I'm unable to replicate it.

What Windows version is it running? What NSClient++ version is it running?

Please PM me your nsclient.ini as well.