Page 2 of 2

Re: Problem with folder_watch.pl

Posted: Thu Apr 14, 2016 5:32 am
by comfone
As requested, file uploaded.
Thank you for your help.
Cheers,

Re: Problem with folder_watch.pl

Posted: Thu Apr 14, 2016 11:27 am
by tgriep
The folder watch script is the same as mine so it isn't a version issue.
The only thing I see different between your debug output and mine is how the date is displayed for the ls -l command

The output on my system

Code: Select all

got line: -rw-r--r-- 1 root root   0 Apr 11 15:17 Murat.log
  processed: time=1460405820 mode=644 size=0 time_line=Apr 11 15:17 nfiles=1 group=root filename=Murat.log user=root type=file
    parsed: time=1460405820 mode=644 size=0 time_line=Apr 11 15:17 nfiles=1 group=root filename=Murat.log user=root type=file time=1460405820 mode=644 size=0 time_line=Apr 11 15:17 nfiles=1 group=root filename=Murat.log user=root type=file
This is what yours looks like.

Code: Select all

got line: -rw-r--r-- 1 nagios nagios 84 2016-04-06 09:57 murat.log
processed: time= mode=644 size=84 time_line=2016-04-06 09:57 murat.log nfiles=1 group=nagios user=nagios type=file
parsed: time= mode=644 size=84 time_line=2016-04-06 09:57 murat.log nfiles=1 group=nagios user=nagios type=file time= mode=644 size=84 time_line=2016-04-06 09:57 murat.log nfiles=1 group=nagios user=nagios type=file
Date 1460547117 Oldest_filetime: undef Newest_filetime: undef
I think the difference in the date string is causing the problem.

What Operating system is running on the server you are testing and it's version number as well?
Can you run the following command on the remote system and post it here?

Code: Select all

locale
ls -l --time-style=locale

Re: Problem with folder_watch.pl

Posted: Wed Apr 20, 2016 3:26 am
by comfone
csvdb008:/tmp/nagiosxitest # ls -l
total 4
-rw-r--r-- 1 nagios nagios 84 Apr 6 09:57 murat.log
csvdb008:/tmp/nagiosxitest # locale
LANG=POSIX
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
csvdb008:/tmp/nagiosxitest # ls -l --time-style=locale
total 4
-rw-r--r-- 1 nagios nagios 84 Apr 6 09:57 murat.log
csvdb008:/tmp/nagiosxitest #

Re: Problem with folder_watch.pl

Posted: Wed Apr 20, 2016 1:56 pm
by tgriep
Lets set the time-style for your ls command and see if that fixes it. Try running this and see if it works for you.

Code: Select all

/usr/local/nagios/libexec/folder_watch.pl -C 'ssh [email protected] ls -l --time-style=locale /tmp/nagiosxitest' -F 'murat.log' -T 'files' -w '@1:1' -v

Re: Problem with folder_watch.pl

Posted: Thu Apr 21, 2016 2:19 am
by comfone
Still not working :-(
/usr/local/nagios/libexec/folder_watch.pl -C 'ssh nagios@nnnnnnn ls -l --time-style=locale /tmp/nagiosxitest' -F 'murat.log' -T 'files' -w '@1:1' -v
Translated filespec 'murat.log' to regex 'murat\.log'
Only warning value check is specified - setting critical to ~
folder_watch.pl plugin version 0.43_nagios
Alarm at 30
Command Specified: ssh nagios@csvdb008 ls -l --time-style=locale /tmp/nagiosxitest
Executing ssh nagios@csvdb008 ls -l --time-style=locale /tmp/nagiosxitest 2>&1
got line: total 4
processed: type=unset
parsed: type=unset type=unset
got line: -rw-r--r-- 1 nagios nagios 84 2016-04-06 09:57 murat.log
processed: time= mode=644 size=84 time_line=2016-04-06 09:57 murat.log nfiles=1 group=nagios user=nagios type=file
parsed: time= mode=644 size=84 time_line=2016-04-06 09:57 murat.log nfiles=1 group=nagios user=nagios type=file time= mode=644 size=84 time_line=2016-04-06 09:57 murat.log nfiles=1 group=nagios user=nagios type=file
Date 1461222908 Oldest_filetime: undef Newest_filetime: undef
Largest file has size of octet and smallest octet
OK - 0 murat.log files found

Re: Problem with folder_watch.pl

Posted: Thu Apr 21, 2016 11:19 am
by tgriep
Darn, run the following with the date time string set.

Code: Select all

/usr/local/nagios/libexec/folder_watch.pl -C 'ssh [email protected] ls -l --time-style="+%b %d %l:%M" /tmp/nagiosxitest' -F 'murat.log' -T 'files' -w '@1:1' -v

Re: Problem with folder_watch.pl

Posted: Thu Apr 21, 2016 2:55 pm
by comfone
Nope :-(
[nagios@cnaxi212 ~]$ id
uid=500(nagios) gid=500(nagios) groups=500(nagios),501(nagcmd)
[nagios@cnaxi212 ~]$ /usr/local/nagios/libexec/folder_watch.pl -C 'ssh nagios@nnnnnnnn ls -l --time-style="+%b %d %l:%M" /tmp/nagiosxitest' -F 'murat.log' -T 'files' -w '@1:1' -v
Translated filespec 'murat.log' to regex 'murat\.log'
Only warning value check is specified - setting critical to ~
folder_watch.pl plugin version 0.43_nagios
Alarm at 30
Command Specified: ssh nagios@csvdb008 ls -l --time-style="+%b %d %l:%M" /tmp/nagiosxitest
Executing ssh nagios@csvdb008 ls -l --time-style="+%b %d %l:%M" /tmp/nagiosxitest 2>&1
got line: ls: cannot access %d: No such file or directory
processed: type=unset nofilesfound=1
parsed: type=unset nofilesfound=1 type=unset nofilesfound=1
got line: ls: cannot access %l:%M: No such file or directory
processed: type=unset nofilesfound=1
parsed: type=unset nofilesfound=1 type=unset nofilesfound=1
got line: /tmp/nagiosxitest:
processed: type=unset
parsed: type=unset type=unset
got line: total 4
processed: type=unset
parsed: type=unset type=unset
got line: -rw-r--r-- 1 nagios nagios 84 Apr murat.log
processed: group=nagios nfiles=1 mode=644 user=nagios type=file size=84
parsed: group=nagios nfiles=1 mode=644 user=nagios type=file size=84 group=nagios nfiles=1 mode=644 user=nagios type=file size=84
Date 1461268357 Oldest_filetime: undef Newest_filetime: undef
Largest file has size of octet and smallest octet
OK - 0 murat.log files found
[nagios@cnaxi212 ~]$

Re: Problem with folder_watch.pl

Posted: Thu Apr 21, 2016 4:22 pm
by tgriep
Try this command. The quotes need to be escaped.

Code: Select all

/usr/local/nagios/libexec/folder_watch.pl -C 'ssh [email protected] ls -l --time-style=\"+%b %d %l:%M\" /tmp/nagiosxitest' -F 'murat.log1' -T 'files' -w '@1:1' -v