Page 1 of 1

Nsclient++ 0.3.9.327 - check_files script

Posted: Wed Sep 19, 2018 3:54 am
by bvladan
Hello,

I'm trying to monitor number of files in some folder using script check_files (default script with installation nsclient++, author of script is [email protected] 2010-12-21), but without success. Can somebody help me how should I configure NSC.ini properly in order to recognise command from nagios? And also maybe I'm using wrong script, so If somebody have a good one, pls notice that or send me.

This is what I put in nsc.ini:

[Wrapped Scripts]
check_files=check_files.vbs

Command that I tried from Nagios directly from folder libexec:

./check_nrpe -H 192.168.99.107 -t 30 -c check_files -a path='E:\\TEST' pattern=*.* 'warning=count>5' 'critical=count>10' top-syntax='${status}: ${problem_count}/${count} files' 'empty-state=ok'

I got this:

0
Usage: check_files /path:<value> [/namefilter:<value>] [/age:<value>] [/selage:<value>] [/searchdepth:<value>] [/seldat:<value>] [/size:<value>] [/warning:<value>] [/critical:<value>] [/expectmatch:<value>] [/weekdays:<value>] [/alias:<value>]

/path Path

[/namefilter] Filename Filter
[/age] Age
[/selage] newer, older, hour, ignore
[/searchdepth] depth of subdirs to search
[/seldat] modified or created
[/size] size
[/warning] warning threshold
[/critical] critical threshold
[/expectmatch] expect at least x matches
[/weekdays] 1,2,3,... 1-Sun 2-Mon 3-Tue...
[/alias] Alias

Re: Nsclient++ 0.3.9.327 - check_files script

Posted: Wed Sep 19, 2018 10:26 am
by mcapra
There is a difference in the check_files.vbs plugin found here:
https://exchange.nagios.org/directory/P ... nt/details

And the native check_files command for NSClient++:
https://docs.nsclient.org/reference/win ... heck_files

You seem to be confused about which one you're hitting. In your command example, you're clearly hitting the check_files.vbs script yet seem to be passing native NSClient++ check_files command arguments. Which one would you like to use?

If you would like to use check_files.vbs, I would suggest passing arguments (via -a) that are accepted by that script. Additionally, altering your wrapping to actually accept arguments as demonstrated in this documentation:
https://docs.nsclient.org/howto/external_scripts/

If you would like to use the native NSClient++ check_files command, I would suggest not aliasing it to check_files.vbs in your NSC.ini file.

Re: Nsclient++ 0.3.9.327 - check_files script

Posted: Wed Sep 19, 2018 2:21 pm
by scottwilkerson
I agree with mcapra

I think with the syntax you have you should remove this line form the config

Code: Select all

check_files=check_files.vbs
and restart nsclient

Re: Nsclient++ 0.3.9.327 - check_files script

Posted: Thu Sep 20, 2018 2:53 am
by bvladan
I'm pritty confused about this, you right. Just now, thanks to you, I find out there are two ways for same check. But, when I remove this line from nsc.ini (check_files=check_files.vbs) I got this:

UNKNOWN: No handler for that command

But also in nsci.ini in secton [External Alias] I can see this line:

alias_file_size=CheckFiles "filter=size > $ARG2$" "path=$ARG1$" MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" max-dir-depth=10

And I tried this command but I only got message "Parsing failed:"

./check_nrpe -H 192.168.99.107 -t 30 -c CheckFiles -a path='E:\\TEST' 'MaxWarn=count>5' 'MaxCrit=count>10' syntax='${status}: ${problem_count}/${count} files'
Parsing failed:

I only want to count all files in folder and there is no files, then would be green service with OK state.
Any idea, pls :(

Re: Nsclient++ 0.3.9.327 - check_files script

Posted: Thu Sep 20, 2018 11:14 am
by scottwilkerson
Can you attach your whole nsc.ini ? (obfuscate any sensitive data)

Re: Nsclient++ 0.3.9.327 - check_files script

Posted: Fri Sep 21, 2018 1:48 am
by bvladan
Yes, file is attached. Thanks
NSC.ini
NSC.ini
(12.32 KiB) Downloaded 599 times

Re: Nsclient++ 0.3.9.327 - check_files script

Posted: Fri Sep 21, 2018 11:44 am
by scottwilkerson
Is there any possibility to upgrade your version of nsclient to a newer version, as this version is so old the documentation has been completely removed from their servers

Re: Nsclient++ 0.3.9.327 - check_files script

Posted: Mon Sep 24, 2018 8:01 am
by bvladan
Everything is fine now, after installation a new version of nsclient NSCP-0.5.2.3.
Thank you very much for help!

Re: Nsclient++ 0.3.9.327 - check_files script

Posted: Mon Sep 24, 2018 8:06 am
by scottwilkerson
bvladan wrote:Everything is fine now, after installation a new version of nsclient NSCP-0.5.2.3.
Thank you very much for help!
Great! Glad to hear it!

Locking thread