Nsclient++ 0.3.9.327 - check_files script

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
bvladan
Posts: 4
Joined: Wed Sep 19, 2018 1:56 am

Nsclient++ 0.3.9.327 - check_files script

Post 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 werner.fuerst@assmann.at 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nsclient++ 0.3.9.327 - check_files script

Post 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.
Former Nagios employee
https://www.mcapra.com/
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nsclient++ 0.3.9.327 - check_files script

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
bvladan
Posts: 4
Joined: Wed Sep 19, 2018 1:56 am

Re: Nsclient++ 0.3.9.327 - check_files script

Post 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 :(
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nsclient++ 0.3.9.327 - check_files script

Post by scottwilkerson »

Can you attach your whole nsc.ini ? (obfuscate any sensitive data)
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
bvladan
Posts: 4
Joined: Wed Sep 19, 2018 1:56 am

Re: Nsclient++ 0.3.9.327 - check_files script

Post by bvladan »

Yes, file is attached. Thanks
NSC.ini
NSC.ini
(12.32 KiB) Downloaded 567 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nsclient++ 0.3.9.327 - check_files script

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
bvladan
Posts: 4
Joined: Wed Sep 19, 2018 1:56 am

Re: Nsclient++ 0.3.9.327 - check_files script

Post by bvladan »

Everything is fine now, after installation a new version of nsclient NSCP-0.5.2.3.
Thank you very much for help!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nsclient++ 0.3.9.327 - check_files script

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked