Page 1 of 2

Problem with folder_watch.pl

Posted: Wed Apr 06, 2016 5:11 am
by comfone
Hi All
We are running Nagios XI 5.2.3 on CentOS release 6.7 (Final)
I'm trying to use "folder_watch.pl" configure over the wizard.
But even on the cl it is not working as you can see below.
I am checking the folder /tmp/nagiosxitest on a remote server over ssh, if the file 'murat.log' is present.
Nagios lists the file, but gives as output "OK - 0 murat.log files found | 'murat.log'=0".
My goal is to trigger an alarm if the file "murat.log" is found in the folder "/tmp/nagiosxitest."
Please help.

****************************************************************************************
[nagios@cnaxi212 ~]$ /usr/local/nagios/libexec/folder_watch.pl -C 'ssh [email protected] ls -l /tmp/nagiosxitest' -F 'murat.log' -T 'files' -f -v
Translated filespec 'murat.log' to regex 'murat\.log'
folder_watch.pl plugin version 0.43_nagios
Alarm at 30
Command Specified: ssh [email protected] ls -l /tmp/nagiosxitest
Executing ssh [email protected] ls -l /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 1459936924 Oldest_filetime: undef Newest_filetime: undef
Largest file has size of octet and smallest octet
OK - 0 murat.log files found | 'murat.log'=0
[nagios@cnaxi212 ~]$

Re: Problem with folder_watch.pl

Posted: Wed Apr 06, 2016 12:32 pm
by lmiltchev
You can try using the negate plugin changing the "OK" status to "CRITICAL". For more information on the negate plugin, see the document below:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: Problem with folder_watch.pl

Posted: Wed Apr 06, 2016 1:42 pm
by comfone
Is the problem not that the plugin does not find the file?
The output show "OK - 0 murat.log files found | 'murat.log'=0".
But as you can see on the"ls -l", there is a file named "murat.log"

Re: Problem with folder_watch.pl

Posted: Wed Apr 06, 2016 2:32 pm
by lmiltchev
Run the following commands and show us the output:

On the remote box:

Code: Select all

uname -a
cat /etc/*release
ls -ld /tmp/nagiosxitest
On the Nagios XI server:

Code: Select all

grep nag /etc/group
ls -l /usr/local/nagios/libexec/folder_watch.pl

Re: Problem with folder_watch.pl

Posted: Thu Apr 07, 2016 1:26 am
by comfone
On the remote box:
csvdb008:/tmp/nagiosxitest # uname -a
Linux csvdb008 2.6.34.10-0.6-default #1 SMP 2011-12-13 18:27:38 +0100 x86_64 x86_64 x86_64 GNU/Linux
csvdb008:/tmp/nagiosxitest # cat /etc/*release
openSUSE 11.3 (x86_64)
VERSION = 11.3
csvdb008:/tmp/nagiosxitest # ls -ld /tmp/nagiosxitest
drwxr-xr-x 2 root root 60 Apr 6 09:59 /tmp/nagiosxitest
csvdb008:/tmp/nagiosxitest #


On the Nagios XI server:
[root@cnaxi212 ~]# grep nag /etc/group
nagios:x:500:nagios,apache
nagcmd:x:501:nagios,apache
[root@cnaxi212 ~]# ls -l /usr/local/nagios/libexec/folder_watch.pl
-rwxr-xr-x 1 root nagios 40695 Dec 8 17:29 /usr/local/nagios/libexec/folder_watch.pl
[root@cnaxi212 ~]#

Re: Problem with folder_watch.pl

Posted: Thu Apr 07, 2016 12:47 pm
by tgriep
Try adding a warning threshold like below to your command.

Code: Select all

-w @1:1
This will make the check return OK if the file doesn't exist and critical if it does.

Re: Problem with folder_watch.pl

Posted: Mon Apr 11, 2016 4:34 am
by comfone
It's still not working:

[nagios@cnaxi212 ~]$ /usr/local/nagios/libexec/folder_watch.pl -C 'ssh [email protected] ls -l /tmp/nagiosxitest' -F 'murat.log' -T 'files' -w '@1:1'
OK - 0 murat.log files found

The file is there!
remoteserver:/tmp/nagiosxitest # ls -l
total 4
-rw-r--r-- 1 nagios nagios 84 Apr 6 09:57 murat.log

Re: Problem with folder_watch.pl

Posted: Mon Apr 11, 2016 3:18 pm
by tgriep
Run the command adding verbose output "-v" and post the output.

Code: Select all

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

Re: Problem with folder_watch.pl

Posted: Wed Apr 13, 2016 6:34 am
by comfone
[nagios@cnaxi212 ~]$ /usr/local/nagios/libexec/folder_watch.pl -C 'ssh nagios@csvdb008 ls -l /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 /tmp/nagiosxitest
Executing ssh nagios@csvdb008 ls -l /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 1460547117 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: Wed Apr 13, 2016 11:05 am
by lmiltchev
Can you zip up the "/usr/local/nagios/libexec/folder_watch.pl" file, and upload it to the forum? I would like to compare it to the one we are using in house.