OK so there are a number of things I will talk about here. Sorry if it gets complicated
The commands in 0.4.3 have changed and the online manual isn't that great. I'm still learning them however I am providing you with some examples which should give you what you are after. The key thing is that you want the check called
check_files NOT CheckFiles.
When targeting a specific file, instead of using:
Code: Select all
path="c:\\Program Files\\NSClient++" pattern="nsclient.log"
Use this instead:
Code: Select all
file="c:\\Program Files\\NSClient++\\nsclient.log"
When using a path and pattern, it iterates over all the files in that path to find the file.
When using file, it only looks for that specific file in that location.
guizalan wrote:1- How do I change size from bytes to Megabytes or Gigabytes?
I found there is an argument called
perf-config however this documentation did not contain much information:
http://docs.nsclient.org/reference/wind ... heck-files
However the key information is here:
http://nsclient.org/nscp/ticket/684
Code: Select all
"perf-config=size(unit:M)"
"perf-config=size(unit:G)"
NOTE: The capital M or G is required, lower case does not work!
Now, this only appears to affect the performance data part of the string (everything to the RIGHT of the pipe | symbol).
Code: Select all
CRITICAL: 0/1 files (nsclient.log)|'nsclient.log size'=0.31999M;0;0.00009
You can display the file size in the status detail (everything to the LEFT of the pipe | symbol). This is done using the detail-syntax argument HOWEVER it is displayed as the original value.
Code: Select all
"detail-syntax=${status}%(file) = %(size)"
Code: Select all
CRITICAL: 0/1 files (nsclient.log = 339708)|'nsclient.log size'=0.32397M;0;0.00292
I have logged a feature request / bug report for this on GitHub:
https://github.com/mickem/nscp/issues/125
guizalan wrote:On this case, when the file size is smaller then what is configured, it shows: "No drives found!" I would like to change this to "OK" or just to output the file size. How do I do that?
Regardless of version, using a filter restricts what is returned. If the file size is smaller then what is configured in the filter, then is is not included in the matches and hence cannot be reported on when there is an OK state.
What you want is to use the critical argument to specify the size. NOTE: This also has changed, it is critical not MaxCrit and has a syntax.
Code: Select all
CRITICAL: 0/1 files (nsclient.log)|'nsclient.log size'=0.3331M;0;0.00009
NOTE: the lower CASE k is important here, upper case K will not work.
Sooooo with all that in mind, here are the commands you should be using:
Code: Select all
Command:
check_nrpe -H naud12 -c check_files -a file="c:\\Program Files\\NSClient++\\nsclient.log" "critical=size>100k" "perf-config=size(unit:M)" "detail-syntax=${status}%(file) = %(size)"
Output:
CRITICAL: 0/1 files (nsclient.log = 357446)|'nsclient.log size'=0.34088M;0;0.09765
Code: Select all
Command:
check_nrpe -H naud12 -c check_files -a file="c:\\Program Files\\NSClient++\\nsclient.log" "critical=size>1000k" "perf-config=size(unit:M)" "detail-syntax=${status}%(file) = %(size)"
Output:
OK: All 1 files are ok|'nsclient.log size'=0.34167M;0;0.97656
So now that leaves us with a bug that I have just identified:
When the file matches the critical criteria, it is not reported correctly:
Code: Select all
CRITICAL: 0/1 files (nsclient.log = 357446)|'nsclient.log size'=0.34088M;0;0.09765
It should say
1/1 files.
Rest assured that the CRITICAL state is being correctly returned:
I have reported this as a bug on GitHub:
https://github.com/mickem/nscp/issues/124
Let us know if that all makes sense.