Check file size windows

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.
brandon
Posts: 30
Joined: Wed Aug 19, 2015 4:10 am

Check file size windows

Post by brandon »

Hello,

when using CheckFiles for monitoring file size:

Code: Select all

check_nrpe -H 192.168.1.10 -c CheckFiles -a file="c:\\test\test.txt" "critical=size>100k" "perf-config=size(unit:M)" "detail-syntax=${status}%(file) = %(size)"
or

check_nrpe -H 192.168.1.10 -c alias_file_size -a file="c:\\test\test.txt" "critical=size>100k" "perf-config=size(unit:M)" "detail-syntax=${status}%(file) = %(size)"

Output:
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option)
.


The same topic: https://support.nagios.com/forum/viewto ... =7&t=31926 , but for me does not work
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check file size windows

Post by hsmith »

Can you post your nsc.ini/nsclient.ini with any passwords / sensitive IP addresses excluded?
Former Nagios Employee.
me.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check file size windows

Post by rkennedy »

You will need to edit your nsclient.ini on your windows machine, and add the following lines -

Code: Select all

[/settings/NRPE/server]
allow arguments=1
Former Nagios Employee
brandon
Posts: 30
Joined: Wed Aug 19, 2015 4:10 am

Re: Check file size windows

Post by brandon »

password and login are OK, as they checked other plugins and running

Only problem I have with this plugin

maybe we should not executes the command?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check file size windows

Post by rkennedy »

Did you make the change to your nsclient.ini, and restart the service after?
Former Nagios Employee
brandon
Posts: 30
Joined: Wed Aug 19, 2015 4:10 am

Re: Check file size windows

Post by brandon »

In nsclient.ini I have:
alias_file_size = CheckFiles "filter=size > $ARG2$" "path=$ARG1$" MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" max-dir-depth=10
the file has not been modified
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check file size windows

Post by rkennedy »

Did you add this line to your nsclient.ini? It's needed for certain commands to run.

Code: Select all

[/settings/NRPE/server]
allow arguments=1
Former Nagios Employee
brandon
Posts: 30
Joined: Wed Aug 19, 2015 4:10 am

Re: Check file size windows

Post by brandon »

so maybe I ask:, what should be on the server query:

Code: Select all

define service{
        use                             none         
        host_name                       server
        service_description             Check File Log
        check_command                   check_file_size!path='c:\\test\test.txt' 'critical=size>100k' 'perf-config=size(unit:M)' 'detail-syntax=${status}%(file) = %(size)'
        }
output:

Code: Select all

 	Not a file or directory (or doesn't exist), don't know what to do with file=c: esttest.txt 
and running plugin, for example:

Code: Select all

define service{
        use                             none
        host_name                       server
        service_description             Open Files
        check_command                   check_open_files.pl!-w 30 -c 50!
        }
output

Code: Select all

OK: 1856 open files (0% of max 205045) 
The only problem is check_file_size plugin
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check file size windows

Post by hsmith »

What happens when you run check_nrpe -H 192.168.1.10 -c alias_file_size -a file="c:\\test\test.txt" "critical=size>100k" "perf-config=size(unit:M)" "detail-syntax=${status}%(file) = %(size)" from the command line?
Former Nagios Employee.
me.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Check file size windows

Post by Box293 »

hsmith wrote:What happens when you run check_nrpe -H 192.168.1.10 -c alias_file_size -a file="c:\\test\test.txt" "critical=size>100k" "perf-config=size(unit:M)" "detail-syntax=${status}%(file) = %(size)" from the command line?
Also, the file path requires double back slashes all the way through it, you have c:\\test\test.txt but it should be c:\\test\\test.txt

I would also try single quotes instead of double quotes.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked