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

Problem with folder_watch.pl

Post 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 ~]$
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problem with folder_watch.pl

Post 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
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 »

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"
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problem with folder_watch.pl

Post 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
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 »

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

Re: Problem with folder_watch.pl

Post 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.
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 »

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

Re: Problem with folder_watch.pl

Post 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
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 »

[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 ~]$
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problem with folder_watch.pl

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