Problem with folder_watch.pl

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
comfone
Posts: 127
Joined: Fri May 01, 2015 3:28 am

Re: Problem with folder_watch.pl

Post by comfone »

As requested, file uploaded.
Thank you for your help.
Cheers,
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problem with folder_watch.pl

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
comfone
Posts: 127
Joined: Fri May 01, 2015 3:28 am

Re: Problem with folder_watch.pl

Post 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 #
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problem with folder_watch.pl

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
comfone
Posts: 127
Joined: Fri May 01, 2015 3:28 am

Re: Problem with folder_watch.pl

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problem with folder_watch.pl

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
comfone
Posts: 127
Joined: Fri May 01, 2015 3:28 am

Re: Problem with folder_watch.pl

Post 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 ~]$
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problem with folder_watch.pl

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked