folder_watch.pl with whitespace in path

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
chrisbooth
Posts: 43
Joined: Thu Dec 01, 2016 10:09 am

folder_watch.pl with whitespace in path

Post by chrisbooth »

this works fine

Code: Select all

./folder_watch.pl -C 'ssh [email protected] ls -l /mnt/SAN_gskVideo/' -F '[^\0]+' -T 'dir'  -w 1 -c 5 -f
CRITICAL - [^\0]+ is 22 (more than 5) | '[^\0]+'=22;1;5;;;
but the sub-folder has whitespace in it's path

Code: Select all

./folder_watch.pl -C 'ssh [email protected] ls -l /mnt/SAN_gskVideo/Auto\ Archive/' -F '[^\0]+' -T 'dir'  -w 1 -c 5 -f
OK - 0 [^\0]+ files found | '[^\0]+'=0;1;5;;;
without the plugin this work

Code: Select all

[nagios@localhost libexec]$ ssh [email protected] ls -l '/mnt/SAN_gskVideo/Auto\ Archive/'
total 448
drwxr-xr-x 1866 root root 434176 Dec  5 22:07 Logs
drwxrwxrwx    3 root root      2 Dec 13 10:53 Problem Files
drwxrwxrwx    2 root root  24576 Dec  5 22:07 To Archive
but when i use that with the plugin it doesn't

Code: Select all

[nagios@localhost libexec]$ ./folder_watch.pl -C 'ssh [email protected] ls -l '/mnt/SAN_gskVideo/Auto\ Archive/'' -F '[^\0]+' -T 'dir'  -w 1 -c 5 -f
OK - 0 [^\0]+ files found | '[^\0]+'=0;1;5;;;
[nagios@localhost libexec]$
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: folder_watch.pl with whitespace in path

Post by dwhitfield »

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.

I already asked for your profile in one of your other threads, yes? The plugin won't be in the profile, so that's not a duplicate request. :)
chrisbooth
Posts: 43
Joined: Thu Dec 01, 2016 10:09 am

Re: folder_watch.pl with whitespace in path

Post by chrisbooth »

Here you go. I believe it came bundled with NagiosXI
folder_watch.pl
You do not have the required permissions to view the files attached to this post.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: folder_watch.pl with whitespace in path

Post by avandemore »

That's because your quoting is different. Something like this should work:

Code: Select all

./folder_watch.pl -C 'ssh [email protected] ls -l "/mnt/SAN_gskVideo/Auto\ Archive/"' -F '[^\0]+' -T 'dir'  -w 1 -c 5 -f
Previous Nagios employee
chrisbooth
Posts: 43
Joined: Thu Dec 01, 2016 10:09 am

Re: folder_watch.pl with whitespace in path

Post by chrisbooth »

ok that works great in the terminal

Code: Select all

./folder_watch.pl -C 'ssh [email protected] ls -l "/mnt/SAN_gskVideo/Auto\ Archive/Problem\ Files"' -F '[^\0]+' -T 'dir'  -w 0 -c 5 -f
but i'm noticing when i run a command test within nagios xi it's converting the "

Code: Select all

[[email protected] ~]# /usr/local/nagios/libexec/folder_watch.pl -C 'ssh [email protected] ls -l "/mnt/SAN_gskVideo/Auto\ Archive/Problem\ Files"'  -s 0,5 -f
Usage: /usr/local/nagios/libexec/folder_watch.pl [-v] [-t <timeout>] -D <directory> -F <files to check> -w <warn level(s)> -c <crit level(s)> [-a [<warn age>,<crit age>]] [-s [<warn size>,<crit size>]] [-S [<warn size>,<crit size>]] [-f] [-r] [-l] [-T files|dir] [-L label] [-V] [-H <hostaddress> | -I | -C <cmd that does &apos;ls -l>&apos;]
Screen Shot 2016-12-14 at 10.06.55.png
Screen Shot 2016-12-14 at 10.06.40.png
You do not have the required permissions to view the files attached to this post.
chrisbooth
Posts: 43
Joined: Thu Dec 01, 2016 10:09 am

Re: folder_watch.pl with whitespace in path

Post by chrisbooth »

The service does work now tho!

it's just the check command seems to convert the "

..but that's not a deal breaker just something to note
chrisbooth
Posts: 43
Joined: Thu Dec 01, 2016 10:09 am

Re: folder_watch.pl with whitespace in path

Post by chrisbooth »

Ok it now works as a check command also

thank you so much for the help
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: folder_watch.pl with whitespace in path

Post by avandemore »

Glad to hear it works. If you have further issues, please open a new thread.
Previous Nagios employee
Locked